return
return

Reputation: 1049

fractional part of a extended number

For get fractional part in a number i have problem.

I tried with this way:

var
  x: Extended;
begin
  x := 1.563;
  x := Frac(x);
  ShowMessage(FormatFloat('#.000', x));
end;

It will give result .563 but i dont need . (dot) in the result.

Actually, the issues for separate fractional of number is a dot in the result.

How i get just 563 in that example ? Is there other way for do that ?

Thanks ...

Upvotes: 1

Views: 216

Answers (1)

David Heffernan
David Heffernan

Reputation: 612884

A trivial solution is to strip off the decimal separator:

Copy(FormatFloat('#.000', x), 2, MaxInt);

Upvotes: 2

Related Questions