A floating-point number.
A limited-precision representation of a real number. Typst uses 64 bits to store floats. Wherever a float is expected, you can also pass an integer.
You can convert a value to a float with this type's constructor.
#3.14 \ #1e4 \ #(10 / 4)
ConstructorIf a type has a constructor, you can call it like a function to create a new value of the type.
Converts a value to a float.
- Booleans are converted to
- Integers are converted to the closest 64-bit float.
- Ratios are divided by 100%.
- Strings are parsed in base 10 to the closest 64-bit float. Exponential notation is supported.
#float(false) \ #float(true) \ #float(4) \ #float(40%) \ #float("2.7") \ #float("1e5")
The value that should be converted to a float.