Yard/selib/math.yard

24 lines
294 B
Plaintext
Raw Normal View History

2023-01-02 11:06:30 +00:00
@pragma(once)
@feature(conv, math)
@author(Sven Vogel)
floor(x:rat) = rat {
to_rat(to_int(x))
}
round(x:rat) = rat {
to_rat(to_int(x + 0.5))
}
ceil(x:rat) = rat {
to_rat(to_int(x + 1.0))
}
fract(x:rat) = rat {
x - floor(x)
}
log(x:rat, b:rat) = rat {
log(x) / log(b)
}