bug-gnulib
[Top][All Lists]
Advanced

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

Re: isnanl, printf, and non-IEEE values


From: Rich Felker
Subject: Re: isnanl, printf, and non-IEEE values
Date: Mon, 18 Jun 2012 13:50:51 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Jun 18, 2012 at 10:21:34AM -0700, Ben Pfaff wrote:
> Bruno Haible <address@hidden> writes:
> 
> > In theory you would be right that data should be validated at the boundaries
> > of the program, that is, when they are read from outside sources. But no
> > program I know of does this for unconstrained floating-point numbers.
> 
> That's an interesting point.  GNU PSPP reads unconstrained
> "double"s from SPSS data files without validating them[*], since

This is not a problem. As long as you're assuming IEEE, all 64-bit
patterns are valid long double values. The issue only occurs for long
double, a type that's very different in both arithmetic properties and
representation between systems. On typical systems, it has padding
bits (which might or might not be required to be all-zero) as well as
bit combinations that are completely invalid.

> it never occurred to me that this was a bad idea.  A function to
> validate a floating-point number would therefore be useful in
> PSPP.

It's only as useful as long doubles, which is, well, not very useful
to most people.

Rich



reply via email to

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