[Lazarus] Floating point comparison with ulps precision

Florian Klämpfl florian at freepascal.org
Tue Aug 14 13:42:41 CEST 2012


Am 14.08.2012 11:51, schrieb Sven Barth:
>> My concern is with integer and FP representation.
>> IIUC, there are both big-endian and little-endian ARM versions?
> 
> Yes, some of them can even be switched from big-endian to little-endian.
> Most ARMs seem to be little-endian though...
> 
>> Are Double values always in IEEE754 format?
>>
> 
> Sorry, I don't know.

In general, ARM uses the IEEE754 format. Newer ones are all little
endian, older ones were often big endian. FPC has defines for this:
FPC_LITTLE_ENDIAN/FPC_BIG_ENDIAN

The caveats are:
- fpa (old ARM hardware fpu, seldomly implemented, today dead in
practice) used a strange double format: the bytes inside the two dwords
followed the endianess of the cpu, the dwords itself are big endian,
i.e. first hi dword, then lo dword. If this is the case, fpc defines
FPC_DOUBLE_HILO_SWAPPED
- IIRC some fpus are not fully IEEE754 compliant regarding computational
results but this does not affect the formst itself

Implementing TExtended80Rec and friends properly should easily hide
these issues in user code though.




More information about the Lazarus mailing list