Mathlib round corrections

This commit is contained in:
2025-09-22 20:03:17 +10:00
parent 7e76d473e7
commit 5e7de482e7
3 changed files with 5 additions and 5 deletions

View File

@@ -137,8 +137,8 @@ add $player.xpos 10 &player.xpos
@endMovement @endMovement
pusharg $player.xpos $player.ypos 20 20 0 255 255 pusharg $player.xpos $player.ypos 20 0 255 255
!grogs:drawRect &out !grogs:drawCircle &out
!grogs:renderFrame &out !grogs:renderFrame &out
!grogs:clearRenderer &out !grogs:clearRenderer &out

View File

@@ -30,17 +30,17 @@ GroundValue modVal(GroundValue* args, int arg_count) {
GroundValue floorVal(GroundValue* args, int arg_count) { GroundValue floorVal(GroundValue* args, int arg_count) {
VALIDATE_ARGS_1(GROUND_DOUBLE); VALIDATE_ARGS_1(GROUND_DOUBLE);
return GROUND_DOUBLE_VAL(floor(GET_DOUBLE(args[0]))); return GROUND_INT_VAL(int(floor(GET_DOUBLE(args[0]))));
} }
GroundValue ceilVal(GroundValue* args, int arg_count) { GroundValue ceilVal(GroundValue* args, int arg_count) {
VALIDATE_ARGS_1(GROUND_DOUBLE); VALIDATE_ARGS_1(GROUND_DOUBLE);
return GROUND_DOUBLE_VAL(ceil(GET_DOUBLE(args[0]))); return GROUND_INT_VAL(int(ceil(GET_DOUBLE(args[0]))));
} }
GroundValue roundVal(GroundValue* args, int arg_count) { GroundValue roundVal(GroundValue* args, int arg_count) {
VALIDATE_ARGS_1(GROUND_DOUBLE); VALIDATE_ARGS_1(GROUND_DOUBLE);
return GROUND_DOUBLE_VAL(round(GET_DOUBLE(args[0]))); return GROUND_INT_VAL(int(round(GET_DOUBLE(args[0]))));
} }
GroundValue randomInt(GroundValue* args, int arg_count) { GroundValue randomInt(GroundValue* args, int arg_count) {

BIN
math/math.so Executable file

Binary file not shown.