On Wed, Aug 18, 2010 at 7:37 AM, Colin Macdonald
<[email protected]>wrote:

> On 08/18/10 13:43, Charles R Harris wrote:
> >
> >
> > On Wed, Aug 18, 2010 at 3:46 AM, Colin Macdonald
> > <[email protected] <mailto:[email protected]>> wrote:
> >
> >     How can I enter longdouble (float96) literals into my python/numpy
> >     programs?  In C, I would postfix such numbers with 'L', but this
> gives
> >     a SyntaxError in python.
> >
> > I don't know how to do this without using strings and having numpy do
> > it's own string conversions. IIRC, we currently rely on Python for
> > this and Python doesn't support long doubles. You might open a ticket
> > with a request for an enhancement as we should fix this at some point.
>
> I'd be at least partially satisfied with doing a string conversion ;-)
> How would I do that?  Is there something like strtolongdouble()?  Or a
> sscanf function?
>
>
If you are willing to work at the C-Level you can probably use sscanf with
the proper format specifier. Or you might write a parser in python. Numpy
just doesn't have support for this at the moment, at least not that I am
aware of. However, the various constants supplied by numpy, pi and such, are
full precision.



> I will try to remember to open a ticket for the issue.
>
> Perhaps the issue that numpy.longdouble("0.4") doesn't work properly a
> slightly separate bug...
>

I'm pretty sure it goes through a double and can't be fixed until there is
long double support for string conversions. Unicode makes this even trickier
as to use the C-library it needs to be converted to ascii first.

Chuck
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to