octave-maintainers
[Top][All Lists]
Advanced

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

Re: confused by liboctave/util/lo-ieee.cc


From: John W. Eaton
Subject: Re: confused by liboctave/util/lo-ieee.cc
Date: Fri, 16 Jun 2017 14:39:33 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 06/16/2017 01:17 PM, Rik wrote:
While working on other things I stumbled upon lo-ieee.cc and I have some
questions about the implementation.

First, now that C++11 is an Octave requirement, do we really need to check
for standard functions being in the cmath library?  It seems like a hard
requirement that the corresponding C and C++ libraries implement what is in
C++11.  Example code is

I suppose not, if C++11 says they should exist. The only case we should have to worry about is if we need to replace one of these functions because of some known bug, but that's a separate issue.

--- Code #1 ---
int
__lo_ieee_isnan (double x)
{
#if defined (HAVE_CMATH_ISNAN)
  return std::isnan (x);
#else
  // Gnulib provides.
  return isnan (x);
#endif
}
--- End Code #1 ---

I guess we should just deprecate these functions now if isnan is a standard function that we can expect to exist on all platforms that we care about.

Second, if the #if defined checks should remain, shouldn't they differ
between float and double versions?

Yes, that's probably just an oversight.

Finally, if we're relying on the C++ std library which contains templated
versions of functions, why do we need to have special code for floats?

I don't think we should. Let's just use the std:: functions directly now and eliminate our wrappers.

> In
the extracted code below, the case of doubles just uses std::isfinite, but
the float version is more complicated.

I don't know why there was a difference.

jwe





reply via email to

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