[Lazarus] Cross-compile for Linux strange behaviour with floating point constants
Giuliano Colla
giuliano.colla at fastwebnet.it
Sun Nov 24 01:28:01 CET 2019
Il 20/11/2019 19:19, R Smith via lazarus ha scritto:
> The problem I've run into is a simple program (made in Lazarus) where
> I use floating point constants. It compiles and runs perfectly on
> Windows, but when cross-compiling for Linux, it fails for specific
> floating point values.
>
> I realise immediately that, if this is a bug, it's probably an FPC bug
> and not Lazarus specific, but the problem is so obviously wrong, I'm
> thinking it cannot possibly be a compiler bug, and since I am
> cross-compiling from Lazarus, figured I would start asking here and
> rule out the obvious things first.
I tested your program by compiling natively in Linux, (Lazarus 1.8 and
fpc 3.04) and it works just fine. Output is:
> Setting Variable: x := 0.5;
> FloatToStr( x ) --> 0.5
> FloatToStr( 0.5 ) --> 0.5
>
> Setting Variable: x := 0.35;
> FloatToStr( x ) --> 0.35
> FloatToStr( 0.35 ) --> 0.35
As with the given code Lazarus does pretty much nothing, and all the job
is done by the fpc compiler,
it must be an fpc cross-compiler specific issue.
Target processor "Default" is the right choice? Maybe a more specific
choice will tell the cross-compiler to pick up the right choice for fp
math. Just a guess.
Giuliano
--
Do not do to others as you would have them do to you.They might have different tastes.
More information about the lazarus
mailing list