diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-09-24 12:44:38 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-09-24 12:44:38 -0700 |
commit | ea043ef03925f7f5dfaa87efee682e42809b1b05 (patch) | |
tree | 39ced31a8e4ee827d022c20baff6514b3ef0ad2a /doc | |
parent | dc467ba8af91f21994e10bedd133f4423e14862b (diff) | |
download | nasm-ea043ef03925f7f5dfaa87efee682e42809b1b05.tar.gz nasm-ea043ef03925f7f5dfaa87efee682e42809b1b05.tar.bz2 nasm-ea043ef03925f7f5dfaa87efee682e42809b1b05.zip |
nasmdoc: document the __float*__ operators
Diffstat (limited to 'doc')
-rw-r--r-- | doc/nasmdoc.src | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index 79db7e5..ba5d9cb 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -1392,17 +1392,20 @@ when they are operands to \c{dw}. \S{fltconst} \I{floating-point, constants}Floating-Point Constants \i{Floating-point} constants are acceptable only as arguments to -\i\c{DW}, \i\c{DD}, \i\c{DQ}, \i\c{DT}, and \i\c{DO}. They are -expressed in the traditional form: digits, then a period, then -optionally more digits, then optionally an \c{E} followed by an -exponent. The period is mandatory, so that NASM can distinguish -between \c{dd 1}, which declares an integer constant, and \c{dd 1.0} -which declares a floating-point constant. - -NASM also support C99-style hexadecimal floating-point: \c{0x}, -hexadecimal digits, period, optionally more hexadeximal digits, then -optionally a \c{P} followed by a \e{binary} (not hexadecimal) exponent -in decimal notation. +\i\c{DW}, \i\c{DD}, \i\c{DQ}, \i\c{DT}, and \i\c{DO}, or as arguments +to the special operators \i\c{__float16__}, \i\c{__float32__}, +\i\c{__float64__}, \i\c{__float80m__}, \i\c{__float80e__}, +\i\c{__float128l__}, and \i\c{__float128h__}. + +Floating-point constants are expressed in the traditional form: +digits, then a period, then optionally more digits, then optionally an +\c{E} followed by an exponent. The period is mandatory, so that NASM +can distinguish between \c{dd 1}, which declares an integer constant, +and \c{dd 1.0} which declares a floating-point constant. NASM also +support C99-style hexadecimal floating-point: \c{0x}, hexadecimal +digits, period, optionally more hexadeximal digits, then optionally a +\c{P} followed by a \e{binary} (not hexadecimal) exponent in decimal +notation. Some examples: @@ -1415,6 +1418,22 @@ Some examples: \c dt 3.141592653589793238462 ; pi \c do 1.e+4000 ; IEEE quad precision +The special operators are used to produce floating-point numbers in +other contexts. They produce the binary representation of a specific +floating-point number as an integer, and can use anywhere integer +constants are used in an expression. \c{__float80m__} and +\c{__float80e__} produce the 64-bit mantissa and 16-bit exponent of an +80-bit floating-point number, and \c{__float128l__} and +\c{__float128h__} produce the lower and upper 64-bit half of a 128-bit +floating-point number, respectively. + +For example: + +\c mov rax,__float64__(3.141592653589793238462) + +... would assign the binary representation of pi as a 64-bit floating +point number into \c{RAX}. + 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 |