NetBSD 6.1.5 doesn't have ldexpl in math.h

Eric S. Raymond esr at thyrsus.com
Thu Sep 14 00:52:35 UTC 2017


Gary E. Miller via devel <devel at ntpsec.org>:
> Yo Mark!
> 
> On Wed, 13 Sep 2017 23:15:10 +0000
> Mark Atwood <fallenpegasus at gmail.com> wrote:
> 
> > We could just grab from NetBSD7.
> 
> Nope, that is very low level FPU assembly code.  Very arch dependent.
> Usually buried deep in the C compiler as a builtin.
> 
> Just look at gcc for all the arch options it has for floating point!
> 
> > Or if we know it's an IEEE754
> > float, just do the direct bit ops.
> 
> Sort of a float, it is a long double.  The IEEE754 does not specify how
> big in memory a long double is.  It may be 80 bits, or 128 bits, or?
> 
> IEEE754 also does not specify how the bits are arranged in memory.
> 
> > Or the direct fp cpu op.
> 
> Assuming you even have a long double FPU.  Remember this has to
> support various, ARM, i386, amd64, MIPS, sparc, etc.  you may not even
> have any FPU.

Mark: Rolling our own lldexp is getting into the territory of "really
bad ideas that raise the hair on my neck".

The reason I'm getting that feeling is that lldexp is unlike - say - strlcpy
in an important way.  Floating-point code is a *notorious* defect attractor.
It's infamously difficult to even test it in a way that catches all its edge
cases, especially cross-architecture.  

I can all too easily see us committing to this, then spending an
amount of maintainence effort that diverges to infinity on code that
is never quite right, constantly delivering a trickle of unpleasant
low-level surprises.

In principle, things could be different. If we had a dev with a strong
background in FP code and numerical analysis (say, as strong in that
domain as Daniel is in security/crypto), I might consider a homebrew
emulation a risk worth taking for an OS version that is minor-platform
and aging out rapidly.

As it is, give the team we have, I'm going to strongly recommend not going
there.  We're good, but we're no good enough at *this*.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

My work is funded by the Internet Civil Engineering Institute: https://icei.org
Please visit their site and donate: the civilization you save might be your own.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: not available
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20170913/e775a1cf/attachment.bin>


More information about the devel mailing list