13 lines
606 B
Mojo
13 lines
606 B
Mojo
# probe: std.math's pi: as a Float64, and in arithmetic and comparisons with literals (folded exactly at compile time?) and with Float64 values
|
|
from std.math import pi
|
|
|
|
|
|
def main():
|
|
var x = 2.0
|
|
print(pi, Float64(pi), Int(Float64(pi)))
|
|
print(pi * 2.0, pi / 3.0, Float64(pi) / 3.0, pi / 2, pi * 2)
|
|
print(pi - 3.141592653589793, Float64(pi) - 3.141592653589793)
|
|
print(x * pi, pi * x, pi / x, Float64(pi) / Float64(2), pi + 0.1, Float64(pi) + 0.1)
|
|
print(pi * 1e300 * 1e10, -pi, pi > 3.14, pi == 3.141592653589793)
|
|
print(0.1 + 0.2 == 0.3, 1e16 + 1.0 > 1e16, pi < 3.1415926535897932)
|