fix: support integer arithmetic for divided_by, closes #465

This commit is contained in:
Harttle
2022-04-22 02:19:36 +08:00
parent ace5309c08
commit e69a51025e
5 changed files with 44 additions and 3 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ export const abs = argumentsToValue(Math.abs)
export const atLeast = argumentsToValue(Math.max)
export const atMost = argumentsToValue(Math.min)
export const ceil = argumentsToValue(Math.ceil)
export const dividedBy = argumentsToValue((v: number, arg: number) => v / arg)
export const dividedBy = argumentsToValue((dividend: number, divisor: number, integerArithmetic = false) => integerArithmetic ? Math.floor(dividend / divisor) : dividend / divisor)
export const floor = argumentsToValue(Math.floor)
export const minus = argumentsToValue((v: number, arg: number) => v - arg)
export const modulo = argumentsToValue((v: number, arg: number) => v % arg)