Handle integer conversion errors (#425)

When converting a double larger or equal to math.MaxInt64 to an integer, it previously overflowed silently. It now returns an explicit error.

This fixes along the way, the math.abs(-9223372036854775808) issue.
This commit is contained in:
Jean Hadrien Chabran
2021-07-25 18:25:02 +02:00
committed by GitHub
parent daf4f79e9f
commit 01c87d1bf7
4 changed files with 54 additions and 14 deletions

View File

@@ -17,6 +17,8 @@ NULL
2.0
! math.abs('foo')
'cannot cast "foo" as double'
! math.abs(-9223372036854775808)
'integer out of range'
-- test: math.acos
> math.acos(NULL)