[fpc-devel] How to convert Double to Comp without warning

petr.kristan at epos.cz petr.kristan at epos.cz
Fri Apr 4 12:43:32 CEST 2008


On Fri, Apr 04, 2008 at 11:53:03AM +0200, Marco van de Voort wrote:
> > How I can make this conversion without warning?
> > Overtyping m := Comp(t) is confusing and not delphi compatible.
> 
> FPC is not warning compatible with FPC. Proposed solution looks fine to me.
program co;
uses
  Classes, SysUtils;

var
  t: TDateTime;
  m: Comp;
begin
  t := 1000.999;
  m := Comp(t);
  writeln(m);
end.

#fpc -S2 co.pas
#./co
 1.00100000000000E+0003

#fpc -Sd co.pas
#./co
 4.65201609613812E+0018

#dcc co.pas
 4.65201609613812E+0018

Petr

-- 
Ing. Petr Kristan
.
EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice
tel: +420 466335223    Czech Republic (Eastern Europe) 
fax: +420 466510709



More information about the fpc-devel mailing list