emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using the GNU GMP Library for Bignums in Emacs


From: Eli Zaretskii
Subject: Re: Using the GNU GMP Library for Bignums in Emacs
Date: Wed, 18 Jul 2018 18:55:35 +0300

> From: Paul Eggert <address@hidden>
> Date: Wed, 18 Jul 2018 03:20:40 -0700
> Cc: Tom Tromey <address@hidden>, address@hidden
> 
> +/* Return true if X and Y are the same floating-point value.
> +   This looks at X's and Y's representation, since (unlike '==')
> +   it returns true if X and Y are the same NaN.  */
> +static bool
> +same_float (Lisp_Object x, Lisp_Object y)
> +{
> +  union double_and_words
> +    xu = { .val = XFLOAT_DATA (x) },
> +    yu = { .val = XFLOAT_DATA (y) };
> +  EMACS_UINT neql = 0;
> +  for (int i = 0; i < WORDS_PER_DOUBLE; i++)
> +    neql |= xu.word[i] ^ yu.word[i];
> +  return !neql;
> +}

Wouldn't calling this upon every float comparison yield a
non-negligible run-time penalty?  Maybe we should use 'isnan' instead?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]