Getting a floating point number from a float-object 
Author Message
 Getting a floating point number from a float-object

Given a python object (PyObject *value), and given that I
know value is a floating point number, how do I find out
what floating point number value represents?

I have an object I've written in C (extending python).  In it's
__setattr__ method, I would like to say

 if (strcmp(name, "max_displacement"))
   self->max_displacement = value

but value is a PyObject.

thanx for any help

--
David Redish            Computer Science Department CMU
                        Neural Processes in Cognition Training Program
                        Center for the Neural Basis of Cognition
http://www.*-*-*.com/



Mon, 15 Dec 1997 03:00:00 GMT  
 Getting a floating point number from a float-object

Quote:
>Given a python object (PyObject *value), and given that I
>know value is a floating point number, how do I find out
>what floating point number value represents?

getfloatvalue(), pardon, PyFloat_AsDouble().

--Guido



Tue, 16 Dec 1997 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. An alternative to floating point (was Re: Floating point non-exactness)

2. IBM 370 Floating point to IEEE floating point

3. vax floating pont to unix floating point

4. Floating point numbers and shared library

5. Floating Point numbers in VW2.0 Database tools?

6. Comparing numbers, floating point error ?

7. Floating point NUMBER? needed

8. Dylan floating-point numbers

9. floating-point number's architecturs

10. Precision of Floating Point Numbers (Was: Second historic...)

11. Read/Write binary floating point numbers

12. floating point number into integer -JavaScript

 

 
Powered by phpBB® Forum Software