Open Thirumalai-Shaktivel opened 2 years ago
CPython only takes the first 16 digits after the decimal points, in case of a highly precise decimal value specified by the user.
❯ bat examples/expr2.py
───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: examples/expr2.py
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 ~ │ 0.899374917340990314093809431749732947891749873896489364589327
───────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ python3.11 -m ast examples/expr2.py
Module(
body=[
Expr(
value=Constant(value=0.8993749173409903))],
type_ignores=[])
Whereas in case of exponential values,
❯ bat examples/expr2.py
───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: examples/expr2.py
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 ~ │ 0.899374917340990314093809431749732947891749873896489364589327e30
2 ~ │ 1e309
3 ~ │ 749813274982310948098213094e70
───────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ python3.11 -m ast examples/expr2.py
Module(
body=[
Expr(
value=Constant(value=8.993749173409903e+29)),
Expr(
value=Constant(value=inf)),
Expr(
value=Constant(value=7.498132749823109e+96))],
type_ignores=[])