On Wed, Aug 18, 2010 at 10:36 AM, Charles R Harris
<[email protected]> wrote:
>
>
> On Wed, Aug 18, 2010 at 8:25 AM, Colin Macdonald <[email protected]>
> wrote:
>>
>> On 08/18/10 15:14, Charles R Harris wrote:
>> > However, the various constants supplied by numpy, pi and such, are
>> > full precision.
>>
>> no, they are not.  My example demonstrated that numpy.pi is only
>> double precision.
>>
>
> Hmm, the full precision values are available internally but it looks like
> they aren't available to the public. I wonder what the easiest way to
> provide them would be? Maybe they should be long double types by default?

playing with some examples, I don't seem to be able to do anything
with longdouble on win32, py2.5

>>> np.array([3141592653589793238L], np.int64).astype(np.longdouble)[0]
3141592653589793300.0
>>> np.array([3141592653589793238L], np.int64).astype(float)[0]
3.1415926535897933e+018
>>> 1./np.array([np.pi],np.longdouble)[0] - 1/np.pi
0.0
>>> 1./np.array([np.pi],np.longdouble)[0]
0.31830988618379069

and it doesn't look like it's the print precision
>>> 1./np.array([np.pi],np.longdouble)[0]*1e18
318309886183790720.0
>>> 1./np.array([np.pi],float)[0]*1e18
3.1830988618379072e+017


type conversion and calculations seem to go through float

Josef

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

Reply via email to