183 |
NaN. For practical purposes, there's no significant difference between |
NaN. For practical purposes, there's no significant difference between |
184 |
different NaN values in Emacs Lisp, and there's no rule for precisely |
different NaN values in Emacs Lisp, and there's no rule for precisely |
185 |
which NaN value should be used in a particular case, so Emacs Lisp |
which NaN value should be used in a particular case, so Emacs Lisp |
186 |
doesn't try to distinguish them. Here are the read syntaxes for |
doesn't try to distinguish them (but it does report the sign, if you |
187 |
these special floating point values: |
print it). Here are the read syntaxes for these special floating |
188 |
|
point values: |
189 |
|
|
190 |
@table @asis |
@table @asis |
191 |
@item positive infinity |
@item positive infinity |
192 |
@samp{1.0e+INF} |
@samp{1.0e+INF} |
193 |
@item negative infinity |
@item negative infinity |
194 |
@samp{-1.0e+INF} |
@samp{-1.0e+INF} |
195 |
@item Not-a-number |
@item Not-a-number |
196 |
@samp{0.0e+NaN}. |
@samp{0.0e+NaN} or @samp{-0.0e+NaN}. |
197 |
@end table |
@end table |
198 |
|
|
199 |
In addition, the value @code{-0.0} is distinguishable from ordinary |
To test whether a floating point value is a NaN, compare it with |
200 |
zero in @acronym{IEEE} floating point (although @code{equal} and |
itself using @code{=}. That returns @code{nil} for a NaN, and |
201 |
@code{=} consider them equal values). |
@code{t} for any other floating point value. |
202 |
|
|
203 |
|
The value @code{-0.0} is distinguishable from ordinary zero in |
204 |
|
@acronym{IEEE} floating point, but Emacs Lisp @code{equal} and |
205 |
|
@code{=} consider them equal values. |
206 |
|
|
207 |
You can use @code{logb} to extract the binary exponent of a floating |
You can use @code{logb} to extract the binary exponent of a floating |
208 |
point number (or estimate the logarithm of an integer): |
point number (or estimate the logarithm of an integer): |