Python Forum
float constants - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: float constants (/thread-25857.html)



float constants - Skaperen - Apr-14-2020

i don't see any of these kinds of float constants defined in the obvious modules.

1. the highest possible float value.
2. the lowest possible float value.
3. the highest float value that when 1.0 is subtracted, the result can be represented exactly.
4. the lowest float value that when 1.0 is added, the result can be represented exactly.

these values could vary by platform. if constants are not defined for these, then i will write some functions to calculate these values without using C.

i might need to think about platforms which have floats that are not based of powers of two.


RE: float constants - buran - Apr-14-2020

sys.float_info


RE: float constants - Skaperen - Apr-14-2020

i assume these are for i386 or x86_64.

i only see one of the constants i listed in there, so i will go ahead and create these functions.