diff --git a/core/Float.carp b/core/Float.carp index 7383a6e8..73596daf 100644 --- a/core/Float.carp +++ b/core/Float.carp @@ -14,6 +14,7 @@ suffixed with `f`.") (register to-bytes (Fn [Float] Int)) (register from-int (Fn [Int] Float)) (register copy (Fn [(Ref Float)] Float)) + (register round (Fn [Float] Int)) (register = (Fn [Float Float] Bool)) (register < (Fn [Float Float] Bool)) diff --git a/core/carp_float.h b/core/carp_float.h index af9d3dd9..196f6f4b 100644 --- a/core/carp_float.h +++ b/core/carp_float.h @@ -130,3 +130,7 @@ float Float_floor(float x) { float Float_mod(float x, float y) { return fmodf(x, y); } + +int Float_round(float x) { + return roundf(x); +}