[NumPy-Tickets] [NumPy] #2164: Incorrect overflow warning message for float128

NumPy Trac numpy-tickets@scipy....
Fri Jun 15 15:45:05 CDT 2012


#2164: Incorrect overflow warning message for float128
----------------------+-----------------------------------------------------
 Reporter:  edcjones  |       Owner:  somebody   
     Type:  defect    |      Status:  new        
 Priority:  normal    |   Milestone:  Unscheduled
Component:  Other     |     Version:  1.6.1      
 Keywords:            |  
----------------------+-----------------------------------------------------
 I use up-to-date Debian testing (wheezy), amd64 architecture.  I have
 installed packages python3, version 3.23~rc1-2, and python3-numpy, version
 1:1.6.2-1.

 For float128, I get an overflow warning message, when I calculate 2**8192.
 The maximum exponent should be 16384.

 Program:
 #! /usr/bin/env python3.2

 import numpy

 print('float128')
 fi = numpy.finfo(numpy.float128)
 print('ibeta:', fi.machar.ibeta)
 print('maxexp:', fi.machar.maxexp)
 print('xmax:', fi.machar.xmax)
 two = numpy.float128(2)
 big = numpy.float128(8191)
 x = numpy.power(two, big)  # OK
 print('2**8191:', x)
 big = numpy.float128(8192)
 x = numpy.power(two, big)

 Output:

 float128
 ibeta: 2
 maxexp: 16384
 xmax: 1.18973149536e+4932
 2**8191: 5.4537406781e+2465
 ./z97.py:16: RuntimeWarning: overflow encountered in power
   x = numpy.power(two, big)

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/2164>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list