[fpc-pascal] Floating point miscalculations on PowerPC

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Mar 13 13:50:51 CET 2010

On 13 Mar 2010, at 12:30, Tobias Giesen wrote:

> I'm using FPC 2.2.4 (ppcppc) to create a PowerPC app with Lazarus. It's
> running under Rosetta on an Intel Mac.

Note that hardware exceptions cannot be handled by FPC when running under Rosetta.

> Simple floating point operations like this result in wrong code

What wrong code?

> that
> creates wrong results:

Which wrong results?

> -------------------
> var it:Int64;
>    dt:TDateTime
> begin
>  it:=ANumber;
>  dt:Trunc(it/10.0+0.5) / 86400.0;
> end;
> -------------------

Please always post
a) compilable code
b) the actual results
c) the expected results

> Does anybody remember a bug with TDateTime calculations and floating
> point constants that would only occur on the PowerPC platform? Has
> it been fixed?

There are no known bugs with floating point calculations on PPC. However, there are several wrong assumptions often made by people who normally only use x86. You may be running into http://wiki.freepascal.org/User_Changes_2.2.0#Floating_point_calculations in combination with http://wiki.freepascal.org/User_Changes_2.2.0#Floating_point_constants


More information about the fpc-pascal mailing list