GNU Info

Info Node: (gmp.info)Assembler Floating Point

(gmp.info)Assembler Floating Point


Next: Assembler SIMD Instructions Prev: Assembler Cache Handling Up: Assembler Coding
Enter node , (file) or (file)node

Floating Point
--------------

   Floating point arithmetic is used in GMP for multiplications on CPUs
with poor integer multipliers.  Floating point generally doesn't suit
other operations like additions or shifts, due to difficulties
implementing carry handling.

   With IEEE 53-bit double precision floats, integer multiplications
producing up to 53 bits will give exact results.  Breaking a
multiplication into 16x32->48 bit pieces is convenient.  With some care
though three 21x32->53 bit products can be used to do a 64x32 multiply,
if one of those 21x32 parts uses the sign bit.

   Generally limbs want to be treated as unsigned, but on some CPUs
floating point conversions only treat integers as signed.  Copying
through a zero extended memory region or testing and adjusting for a
sign bit may be necessary.

   Currently floating point FFTs aren't used for large multiplications.
On some processors they probably have a good chance of being
worthwhile, if great care is taken with precision control.


automatically generated by info2www version 1.2.2.9