[Numpy-discussion] longdouble (float96) literals

josef.pktd@gmai... josef.pktd@gmai...
Wed Aug 18 10:09:33 CDT 2010


On Wed, Aug 18, 2010 at 11:07 AM, David Cournapeau <cournape@gmail.com> wrote:
> On Wed, Aug 18, 2010 at 11:52 PM,  <josef.pktd@gmail.com> wrote:
>> On Wed, Aug 18, 2010 at 10:36 AM, Charles R Harris
>> <charlesr.harris@gmail.com> wrote:
>>>
>>>
>>> On Wed, Aug 18, 2010 at 8:25 AM, Colin Macdonald <macdonald@maths.ox.ac.uk>
>>> 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
>
> For all practical purposes, double == long double on windows: although
> some compilers support the intel long format or even quadd precision,
> the MSVC runtime does not (so you cannot print, scan, etc... making
> them useless).

Thanks for the info, I can stop playing

Josef

>
> cheers,
>
> David
>>
>>>>> 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
>>> NumPy-Discussion@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>
>>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>


More information about the NumPy-Discussion mailing list