Better handling of NaN and inf

Issue #3 resolved
Barry Wardell created an issue

Currently h5mma passes NaN and inf straight through to MathLink as if they were any other double. This causes problems for Mathematica which doesn't handle them well, often by crashing completely. We should instead convert these to Indeterminate and ComplexInfinity, which Mathematica is much better equipped to handle.

Comments (2)

  1. Ian Hinder

    We would have to change the returned data to be a general expression rather than a numeric array using MLPutFunction, MLPutDouble, MLPutSymbol etc. if we detect problematic numbers. This will prevent packing, so the memory requirement would go up. An alternative would be to simply zero the problematic values and allow a mask to be returned which indicated which values had been zeroed. However, I think this is too complicated; we should go the MLPutSymbol route and live with the fact that there will be no packing. Having NaNs and Infs etc should be rare in any case.

  2. Log in to comment