27 lines
638 B
Mojo
27 lines
638 B
Mojo
# probe: which decimal texts does atof read, and as which Float64? (signs, exponents, leading zeros, a bare point, many digits, the smallest subnormal, past the range)
|
|
def show(t: String):
|
|
try:
|
|
print(t, "->", atof(t))
|
|
except e:
|
|
print(t, "-> raised:", e)
|
|
|
|
|
|
def main():
|
|
show("2.5")
|
|
show("1e3")
|
|
show("-0.125")
|
|
show("10")
|
|
show("007.5")
|
|
show("0.1")
|
|
show("+3")
|
|
show(".5")
|
|
show("5.")
|
|
show("-0")
|
|
show("1E-2")
|
|
show("123456789012345678901234567890")
|
|
show("2.2250738585072011e-308")
|
|
show("4.9e-324")
|
|
show("1e400")
|
|
show("1e-400")
|
|
show("0.30000000000000004")
|