print(4.2) print(type(4.2)) print(200000000000000000.0) print(2e400) print(-2e400) print(0.1 + 0.2) print(0.1 * 3) print(1e-4) print(4.0) print(0.2) print(1e6) print(1e6) print(0.4e7) print(type(0.4e7)) print(4.2e-4) print(1.79e308) print(1.8e308) print(5e-324) print(1e-325) # Integer numbers print(float(9)) print(float(-99999)) # Strings representing numbers print(float("2")) print(float("-200")) print(float("2.25")) # Floating-point numbers print(int(10.6)) print(int(3.25)) # Strings representing numbers print(int("2")) print(10.0 .is_integer()) print(10.2 .is_integer()) print((10).bit_length()) print(1e308) print(1e-308) import sys print(sys.float_info.min) # 2.2250738585072014e-308 is the maximum positive floating point value. print(sys.float_info.max) # 1.7976931348623157e+308 is the smallest positive floating point value. # no es lo que uno podria creer print(0.1 + 0.2 == 0.3) print(0.2 + 0.2 + 0.2 == 0.6) print(1.2 + 2.4 + 3.6 == 7.2) print(0.1 + 0.2 <= 0.3) print(10.4 + 20.8 > 31.2) print(0.8 - 0.1 > 0.7) numerator, denominator = (0.1).as_integer_ratio() print(f"0.1 ≈ {numerator} / {denominator}") print(format(numerator / denominator, ".55f")) print(format(0.1, ".17g")) print(format(0.2, ".17g")) print(format(0.3, ".17g")) import math print(math.isclose(0.1 + 0.2, 0.3)) a = 0.1 + 0.2 b = 0.3 print(abs(a - b)) print(math.isclose(0.1 + 0.2, 0.3, rel_tol=1e-20))