Float functions
abs
abs(): float
Returns the absolute value of a float. If the float is negative, it will return the positive value of it
Input example
<p>{{ -5.125.abs() }}</p>
Output
<p>5.125</p>
ceil
ceil(): int
Returns the rounded up value of a float to the nearest integer
Input example
<p>{{ 5.125.ceil() }}</p>
Output
<p>6</p>
floor
floor(): int
Returns the rounded down value of a float to the nearest integer
Input example
<p>{{ 5.125.floor() }}</p>
Output
<p>5</p>
int
int(): int
Converts a float to an integer by removing the decimal part of the number. It doesn't round the number, it just removes the decimal part
Input example
<p>{{ 5.5.int() }}</p>
Output
<p>5</p>
round
round(): int
Rounds a float to the nearest integer. 1.5 -> 2
, 1.4 -> 1
, 1.6 -> 2
Input example
<p>{{ 5.5.round() }}</p>
Output
<p>6</p>
str
str(): str
Converts a float to a string. It's useful when you want to manipulate the float as a string. For displaying the float, you don't need to use this function, as Textwire automatically converts the float to a string when displaying it
Input example
<p>{{ 5.125.str() }}</p>
Output
<p>5.125</p>