Issue found with floor function for decimal data type

Not supported with calc.floor with long decimal numbers

#calc.floor(decimal(“200000000000000000000000000”)) is giving error the result is too large.

#calc.abs(decimal(“200000000000000000000000000”)) is works

Why floor is not supporting despite abs function supporting long decimals?

1 Like

I think it is because the result of calc.floor is guaranteed to be an integer and therefore the output type of that function is integer, but for very large decimals, integer cannot hold the result. calc.abs does not always return an integer, so the result is not automatically converted to that type (even if the specific value happens to be one).

This is exactly right. We had actually changed calc.floor temporarily to not return integers, but really just floor in the type itself, but it lead to quite a lot of breakage in packages. Since we weren’t sure whether we will add support for bigints down the road, we reverted this change.

2 Likes