Function: eql

eql is a function defined in fns.c.

Signature

(eql OBJ1 OBJ2)

Documentation

Return t if the two args are eq or are indistinguishable numbers.

Integers with the same value are eql. Floating-point values with the same sign, exponent and fraction are eql. This differs from numeric comparison: (eql 0.0 -0.0) returns nil and
(eql 0.0e+NaN 0.0e+NaN) returns t, whereas = does the opposite.

Other relevant functions are documented in the number, comparison and symbol groups.

View in manual

Probably introduced at or before Emacs version 1.6.

Shortdoc

;; symbol
(eql 'abc 'abc)
    => t
;; comparison
(eql 2 2)
    => t
  (eql 2.0 2.0)
    => t
  (eql 2.0 2)
    => nil
;; number
(eql 4 4)
    => t
  (eql 4.0 4.0)
    => t

Source Code

// Defined in /usr/src/emacs/src/fns.c
{
  if (FLOATP (obj1))
    return FLOATP (obj2) && same_float (obj1, obj2) ? Qt : Qnil;
  else if (BIGNUMP (obj1))
    return ((BIGNUMP (obj2)
	     && mpz_cmp (*xbignum_val (obj1), *xbignum_val (obj2)) == 0)
	    ? Qt : Qnil);
  else
    return EQ (obj1, obj2) ? Qt : Qnil;
}