Sqrt
NicoLaval opened this issue · 5 comments
NicoLaval commented
Sqrt throws errors for calls with null / NaN / negative values, BdI tests assume null to be the correct result.
NicoLaval commented
NaN
:sqrt
only admits number as parameter, seems to be the good behaviour to throw an exceptionnegative
: Trevas bug , has to return valuenull
:- scalars :
sqrt(null)
null has no inferred type, you have to writesqrt(cast(null, number))
- components / datasets:
Consideringds_1 := ds[calc sq := sqrt(a)];
andds
:
- scalars :
id | a |
---|---|
IDENTIFIER | MEASURE |
INTEGER | INTEGER |
1 | 2 |
2 | -2 |
3 | null |
Trevas ds_1
result will be:
id | a | sq |
---|---|---|
IDENTIFIER | MEASURE | MEASURE |
INTEGER | INTEGER | INTEGER |
1 | 2 | 4 |
2 | -2 | 4 |
3 | null | null |
Thanks to dataset metadata, null is recognized as integer.
NicoLaval commented
TODO: fix behaviour for negative inputs
noahboerger commented
Thank you for the explanations and plan to fix it for negative inputs.
hadrienk commented
Just a comment here, but I think I've seen somewhere in the spec that type inference should be supported. It's a very small paragraph and there's not much details. Technically I think this isn't too hard to implement and has great value for the users. But this need to be reworked in the spec.