[Orbit-python-list] Possible bug in double-precision floating-point marshalling
Status: Inactive
Brought to you by:
tack
From: Chip R. <ch...@ni...> - 2001-10-11 15:28:44
|
I've mentioned this briefly on the orbit-python IRC channel, and I believe I have now discovered the source of the problem. What I'm seeing is double-precision floating-point numbers (CORBA "double") are being crammed into single-precision floating-point containers on their way out of orbit-python servers. I have short demo code, in case anyone wants to see it in action. I first discovered it when trying to pass back a Python "time.time ()" value, which takes a bit more than "float" precision to represent accurately. After building C versions of my test client and server (which made me glad I'm using Python for my real app!), I determined that the problem was in the o-p *server* code, which allowed me to look closer at the marshal_double function in marshal.c and finally see what I think is the error. Sorry this isn't in the form of a patch against the latest CVS source, but it's short and simple enough that it shouldn't be any trouble for a person with CVS access to apply. In marshal.c, version 0.3.0, line 465 (in marshal_double) looks like this: v = (CORBA_float)PyFloat_AsDouble(arg); I believe it should look more like this, using CORBA_double as a cast: v = (CORBA_double)PyFloat_AsDouble(arg); If I am mistaken about this, I apologize for wasting everyone's time. -- Chip |