tags:

views:

326

answers:

2

What could possibly cause this weird python behaviour?

Python 2.6.2 (r262:71600, May 31 2009, 03:55:41)
[GCC 3.3.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> .1
1251938906.2350719
>>> .1
0.23507189750671387
>>> .1
0.0
>>> .1
-1073741823.0
>>> .1
-1073741823.0
>>> .1
-1073741823.0
>>>

It gives the same output for 0.1, 0.5, 5.1, 0.0, etc.. Integers are echoed back at me correctly, but anything with a decimal point gives me the crazy numbers.

This is a python binary compiled for ARM, installed via Optware on a Synology DiskStation 101j.

Has anyone seen anything like this before?

+7  A: 

Maybe it's compiled for the wrong VFP version.

Or your ARM has no VFP and needs to use software emulation instead, but the python binary tries to use hardware.


EDIT

Your DS-101j build on FW IXP420 BB cpu, which is Intel XScale (armv5b) (link). It has no hardware floating-point support. And "b" in armv5b stands for Big Endian. Some people has build problems, because gcc generates little endian code by default. Maybe this is the problem of your software FP lib. Check this search for more info.

zxcat
A: 

As zxcat said, this sounds like you're running on an ARM with no hardware-floating point and a busted soft-float library. A quick search didn't turn up what ARM variant is in the DS101j; anyone know?

Stephen Canon
Don't know, but I certainly wouldn't expect to see a hardware FP on a NAS box.
bobince
If you just want to comment on a solution, then add a comment, rather than a new solution.
Glenn Maynard