#elisp
Sometimes it is useful to compare numbers with equal
, which
treats two numbers as equal if they have the same data type (both
integers, or both floating point) and the same value. By contrast,
=
can treat an integer and a floating-point number as equal.
If you want to change selection, open document below and click on "Move attachment"
GNU Emacs Lisp Reference Manual: Comparison of Numbersunknown value is not a number—it accepts arguments of
any type. By contrast, = signals an error if the arguments are
not numbers or markers. However, it is better programming practice to
use = if you can, even for comparing integers.
<span>Sometimes it is useful to compare numbers with equal , which
treats two numbers as equal if they have the same data type (both
integers, or both floating point) and the same value. By contrast,
= can treat an integer and a floating-point number as equal.
See Equality Predicates.
There is another wrinkle: because floating-point arithmetic is not
exact, it is often a bad idea to check for equality of floating-point
values. Usually it i Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details