0

I am using the Apache Commons library (org.apache.commons.math3.distribution.NormalDistribution) for calculating the normal distribution. My program is cyclic so it repeats this process. After some 30-40 cycles, I obtain question marks instead of the values. While debugging I have found that the program sees NaN (not a number), whereas I am sure that I put numbers there. The output looks like this:

� � � � � � � � � � � � � � � �

The piece of code:

private double normDistr(double num){
    double nd = 0;
    NormalDistribution n = new NormalDistribution(0,30);
    nd = 1.0 - n.cumulativeProbability(num);
    //System.out.println("ND " + nd);
    return nd;
}

Any idea of what could be the cause of the problem? Or, could you recommend me any other library for these purposes?

Thank you.

Aidos
  • 729
  • 7
  • 20

0 Answers0