GNU Info

Info Node: (nasm.info)Section 3.4.4

(nasm.info)Section 3.4.4


Next: Section 3.5 Prev: Section 3.4.3 Up: Section 3.4
Enter node , (file) or (file)node

3.4.4. Floating-Point Constants
-------------------------------

   Floating-point constants are acceptable only as arguments to `DD',
`DQ' and `DT'. They are expressed in the traditional form: digits, then
a period, then optionally more digits, then optionally an `E' followed
by an exponent. The period is mandatory, so that NASM can distinguish
between `dd 1', which declares an integer constant, and `dd 1.0' which
declares a floating-point constant.

   Some examples:

           dd    1.2                     ; an easy one
           dq    1.e10                   ; 10,000,000,000
           dq    1.e+10                  ; synonymous with 1.e10
           dq    1.e-10                  ; 0.000 000 000 1
           dt    3.141592653589793238462 ; pi

   NASM cannot do compile-time arithmetic on floating-point constants.
This is because NASM is designed to be portable - although it always
generates code to run on x86 processors, the assembler itself can run
on any system with an ANSI C compiler. Therefore, the assembler cannot
guarantee the presence of a floating-point unit capable of handling the
Intel number formats, and so for NASM to be able to do floating
arithmetic it would have to include its own complete set of
floating-point routines, which would significantly increase the size of
the assembler for very little benefit.


automatically generated by info2www version 1.2.2.9