[Python-bugs-list] [ python-Bugs-679520 ] long(3.1415) gives zero on Solaris 8

SourceForge.net noreply@sourceforge.net
Fri, 07 Feb 2003 06:45:25 -0800


Bugs item #679520, was opened at 2003-02-03 14:22
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=679520&group_id=5470

Category: Python Interpreter Core
Group: Platform-specific
Status: Open
Resolution: Works For Me
Priority: 5
Submitted By: Mark Dickinson (marketdickinson)
Assigned to: Nobody/Anonymous (nobody)
Summary: long(3.1415) gives zero on Solaris 8

Initial Comment:
On Solaris 8, running Python 2.2.2, the built-in 
function long() gave me the following peculiar results
when applied to a floating-point argument.

(Unfortunately I don't have administrative access to
this machine, so couldn't test to see whether Python
2.3a has the same problems.)

s0100% uname -a
SunOS s0100.math.lsa.umich.edu 5.8 Generic_108528-14
sun4u sparc SUNW,Sun-Blade-1000
s0100% python
Python 2.2.2 (#22, Dec 23 2002, 12:02:55) 
[GCC 3.0.3] on sunos5
Type "help", "copyright", "credits" or "license" for
more information.
>>> long(3.1415)
0L
>>> _ == 0L
0
>>> long(6e20)
00000000000000000L
>>> _ - 1
37778931862957161709567L
>>> int(3.1415)
3


----------------------------------------------------------------------

>Comment By: Mark Dickinson (marketdickinson)
Date: 2003-02-07 14:45

Message:
Logged In: YES 
user_id=703403

The sysadmin here is (very helpfully) looking into this; 
I'll report any findings.

I should probably also have pointed out in my original
report that this is a 64-bit compile of Python.  (Apologies
if this is obvious to everyone;  it wasn't to me.)





----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-02-07 01:12

Message:
Logged In: YES 
user_id=33168

Mark, can you verify if this is a compiler problem?  I also
don't have this problem on a sun?

----------------------------------------------------------------------

Comment By: Inyeol Lee (inyeol)
Date: 2003-02-03 19:41

Message:
Logged In: YES 
user_id=595280

My machine has similar configuration, but works fine;

$ uname -a
SunOS abbey 5.8 Generic_108528-18 sun4u sparc
SUNW,Sun-Blade-1000

$ python22
Python 2.2.2 (#1, Oct 15 2002, 14:20:16)
[GCC 2.95.3 20010315 (release)] on sunos5
>>> long(3.1415)
3L
>>> long(6e20)
600000000000000000000L
>>> _ - 1
599999999999999999999L

I think it's gcc/glibc optimization issue.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=679520&group_id=5470