procedure TForm1.W3Button23Click(Sender: TObject);
var
f : Double;
amount1, amount2, amount3 : Extended;
begin
WriteLn('Sign -510.825 = '+FloatToStr(Sign(-510.825)));
WriteLn('----------------');
// Set the number to infinity
f := Infinity; // Equivalent to 1.0/0.0
// Although infinite, we can still display it
WriteLn('f = '+FloatToStr(f));
// And we can test to see if it is infinite
if IsInfinite(f)
then WriteLn('f is infinite')
else WriteLn('f = '+FloatToStr(f));
WriteLn('----------------');
// Set the number to an invalid number
f := NAN; // Equivalent to 0.0/0.0
// Although an invalid number, we can still display it
WriteLn('f = '+FloatToStr(f));
// And we can test to see if it is a valid number
if IsNaN(f)
then WriteLn('f is not a number')
else WriteLn('f = '+FloatToStr(f));
WriteLn('----------------');
//Display various sizes of extended data values
amount1 := 1234.123456789; // High precision number
amount2 := 1234.123; // High mantissa digits
amount3 := 1E100; // High value number
WriteLn('Amount1 = '+FloatToStr(amount1));
WriteLn('Amount2 = '+FloatToStr(amount2));
WriteLn('Amount3 = '+FloatToStr(amount3));
WriteLn('Clamp(500, 499, 502) = '+FloatToStr(Clamp(500, 499, 502)));
WriteLn(amount3.Clamp(amount1,amount2));
end;
|