Python Forum
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
float constants
#1
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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
sys.float_info
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020