Numbers in Duso are floating-point values (64-bit floats). Used for arithmetic, counting, and any numeric operations.
count = 42
price = 19.99
negative = -5
zero = 0
scientific = 1.23e4
All standard arithmetic operators work with numbers:
a = 10
b = 3
print(a + b) // 13 (addition)
print(a - b) // 7 (subtraction)
print(a * b) // 30 (multiplication)
print(a / b) // 3.333... (division)
print(a % b) // 1 (modulo)
Numbers can be compared:
print(5 < 10) // true
print(5 == 5) // true
print(5 != 3) // true
print(5 >= 5) // true
Convert other types to numbers with tonumber():
num = tonumber("42") // 42
num = tonumber("3.14") // 3.14
num = tonumber(true) // 1
Duso provides math functions for common operations:
floor() - Round downceil() - Round upround() - Round to nearestabs() - Absolute valuemin() - Minimum of valuesmax() - Maximum of valuessqrt() - Square rootpow() - Exponentiationclamp() - Constrain between min/maxIn conditions, numbers are truthy except for 0:
if 1 then print("true") end // prints
if 0 then print("true") end // doesn't print