Janilabo

Janilabo | FractionOf() [SCAR Divi]

May 8th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.60 KB | None | 0 0
  1. {==============================================================================]  
  2.   Explanation: Returns fraction of source.                  
  3. [==============================================================================}
  4. function FractionOf(fraction, source: Extended): Extended;
  5. begin
  6.   if (fraction <> 0) then
  7.     Result := (fraction * source)
  8.   else
  9.     Result := 0.0;
  10. end;  
  11.  
  12. begin
  13.   ClearDebug;
  14.   WriteLn(FractionOf(0.01, 123.456));
  15.   WriteLn(FractionOf(0.1, 123.456));
  16.   WriteLn(FractionOf(0.25, 123.456));
  17.   WriteLn(FractionOf(0.5, 123.456));
  18.   WriteLn(FractionOf(1.0, 123.456));
  19. end.
Advertisement
Add Comment
Please, Sign In to add comment