[Tutor] How does the interpreter determine how many decimal places to display for a float?
Roel Schroeven
roel at roelschroeven.net
Sun May 16 12:00:27 EDT 2021
boB Stepp schreef op 15/05/2021 om 20:45:
> How did you ever suspect to look here? "dtoa" = ? Decimal to ASCII?
Double to ASCII, I'm guessing. C has two floating point types: float and
double. Float has 32 bits, double has twice as many, 64 (at least on the
platforms I'm familiar with; I don't know if that is universal). C's
double corresponds to Python's float.
'd' for double is also used in C stdlib functions like strtod, and dtoa
is named analog to itoa (int to ascii).
This style of short cryptic function names has its roots in early C/Unix
habits, on computers with very limited memory and slow I/O over teletypes.
--
"Honest criticism is hard to take, particularly from a relative, a
friend, an acquaintance, or a stranger."
-- Franklin P. Jones
Roel Schroeven
More information about the Tutor
mailing list