[Numpy-discussion] Unexpected float96 precision loss

Pauli Virtanen pav at iki.fi
Thu Sep 2 13:43:36 EDT 2010


Thu, 02 Sep 2010 18:13:23 +0100, Colin Macdonald wrote:
> On 09/02/10 17:06, Christopher Barker wrote:
>> Does the clib for a compiler that provides a float64 also provide an
>> atof() function that supports it? Its seems that it should.
> 
> I think so, for example in C I can do:
> 
> fscanf(fp, "%Lf %Lf %Lf", &x, &y, &z);
> 
> where x,y,z are "long doubles".

The only question here is if that is portable, i.e., in the C89 standard. 
IIRC long doubles and the corresponding sscanf codes are in C89, so they 
should be safe.

We'll just need to add long double versions of NumPyOS_ascii_strtod and 
NumPyOS_ftolf that call sscanf with the correct format string in the end.

-- 
Pauli Virtanen




More information about the NumPy-Discussion mailing list