Nikolay Aleksandrovich Pavlov <[email protected]> wrote:
>> + #if defined(FEAT_EVAL) && defined(FEAT_FLOAT)
>> + # include <float.h>
>> + # if defined(HAVE_MATH_H)
>> + /* for isnan() and isinf() */
>> + # include <math.h>
>> + # endif
>> + # if defined(WIN32) && !defined(isnan)
>> + # define isnan(x) _isnan(x)
>> + # define isinf(x) (!_finite(x) && !_isnan(x))
>
> This really should also be
>
> static inline isinf(double x) { return !_finite(x) && !_isnan(x); }
>
> Such functions are superior to macros because expressions like
> `isinf(x += 10)` or `isinf((x = function_with_side_effects()))`, and
> if below functions are used, then here it should also be function. Or
> below should be two macros.
Simpler would be...
static int isinf(double x) { return x != x; }
The function looks surprising, but it should work
as nan is not equal to any number, including itself.
Dominique
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.