diff options
Diffstat (limited to '408float.mu')
-rw-r--r-- | 408float.mu | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/408float.mu b/408float.mu index d1c04836..2753308b 100644 --- a/408float.mu +++ b/408float.mu @@ -21,3 +21,15 @@ fn rational nr: int, dr: int -> _/xmm0: float { result <- divide divisor return result } + +# n/m rounded up +fn scale-down-and-round-up n: int, m: int -> _/ecx: int { + var result/ecx: int <- copy n + result <- add m + result <- decrement + var result-f/xmm0: float <- convert result + var m-f/xmm1: float <- convert m + result-f <- divide m-f + result <- truncate result-f + return result +} |