Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {==============================================================================]
- Explanation: Returns fraction of position into source.
- [==============================================================================}
- function Fraction(position, source: Extended): Extended;
- begin
- if (position <> 0) then
- Result := (position / source)
- else
- Result := 0.0;
- end;
- var
- x: Extended;
- begin
- ClearDebug;
- x := 100;
- WriteLn(FloatToStr(Fraction(50, x)));
- x := (x + 400);
- WriteLn(FloatToStr(Fraction(250, x)));
- WriteLn(FloatToStr(Fraction(100, x)));
- end.
Advertisement
Add Comment
Please, Sign In to add comment