InseeFr / Trevas

Transformation engine and validator for statistics.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NaNs

NicoLaval opened this issue · comments

@noahboerger you reported Trevas sometimes return NaNs results, could you provide examples please?

Using floating point arithmetic means NaN is a possibility.

@NicoLaval 0.0 / 0.0 or sqrt(-1) are examples.

What I can see is missing though is the possibility to react on it. Something like if foo = NaN maybe? If we have package/namespace we could put all those in a math package.

Yes this is exactly what i have also observed. It seems like in the test cases from BdI cases which are resulting in NaNs are then mapped to nulls, so that at least the script can react on it. Nevertheless i am not sure if this is the correct behaviour, especially because the possibility to distinguish between NaNs and real null values is lost with this approach.

@hadrienk mathematically I agree.

But VTL spec is more precise, Reference manual:

  • line 3184: divided by 0 generates a run-time error (TO CHECK / TODO in Trevas code)
  • line: sqrt is only defined for value >= 0. It's not specified, but I think we have to throw a InvalidParameterError issue if it's not respected