Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-07-13 12:54:31


----- Original Message -----
From: <Peter.Bienstman_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, July 13, 2001 11:04 AM
Subject: [boost] Re: python patch: convert int/double to complex

> Right, I got rid of the casts (bad remnants from copy and paste) and
> replaced PyLong_asLong() to PyLong_asDouble(), for increased safety.
>
> However, I fail to see how we could now lose the *most* significant
> digits in this implementation.

Of course, I never criticized this implementation.
In your earlier implementation you were doing PyLong_AsLong(p) and
converting that to a complex<double>. If the original Python long didn't fit
in a C++ long but did fit in a C++ long, it would lose precision.

Uhh, I guess it's still possible to have a Python long that doesn't fit in a
double, isn't it? Probably that case isn't worth worrying about, but I
think your current code misses it.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk