AFC - Abacus Formula Compiler for Java

Decompiled Code For NEGBINOMDIST( C285, D285, E285 )

The expression

=NEGBINOMDIST( C285, D285, E285 )

is compiled to the following class(es):

package org.formulacompiler.gen;
import org.formulacompiler.runtime.Computation;
import org.formulacompiler.runtime.internal.Environment;
import org.formulacompiler.runtime.internal.RuntimeDouble_v2;
import org.formulacompiler.runtime.internal.Runtime_v2;
import org.formulacompiler.tests.reference.base.Inputs;
import org.formulacompiler.tests.reference.base.Outputs;

final class $Root extends Outputs implements Computation
{
    private final Inputs $inputs;
    final Environment $environment;

    $Root(Inputs inputs, Environment environment) {
        $environment = environment;
        $inputs = inputs;
    }

    final double get$0() {
        double d;
        if (!(0.0 < get$3()) || !(get$3() < 1.0) || !(get$1() >= 0.0)
            || get$2() < 1.0) {
            Runtime_v2.fun_ERROR
                ("#NUM! because not 0 < p < 1, x >= 0, r >= 1 in NEGBINOMDIST");
            d = (double) -1;
        } else {
            double d_0_;
            if (!(Math.floor(get$1()) + Math.floor(get$2()) - 1.0 >= 0.0)
                || !(Math.floor(get$2()) - 1.0 >= 0.0)
                || (Math.floor(get$1()) + Math.floor(get$2()) - 1.0
                    < Math.floor(get$2()) - 1.0)) {
                Runtime_v2.fun_ERROR
                    ("#NUM! because n < 0 or k < 0 or n < k in COMBIN");
                d_0_ = (double) -1;
            } else
                d_0_ = ((Math.floor(get$1()) + Math.floor(get$2()) - 1.0
                          Math.floor(get$2()) - 1.0)
                        ? 1.0 : Math.floor(get$2()) - 1.0  1.0
                        ? Math.floor(get$1()) + Math.floor(get$2()) - 1.0
                        : (RuntimeDouble_v2.fun_FACT(Math.floor(get$1())
                                                     + Math.floor(get$2())
                                                     - 1.0)
                           / RuntimeDouble_v2
                                 .fun_FACT(Math.floor(get$2()) - 1.0)
                           / RuntimeDouble_v2.fun_FACT(Math.floor(get$1())
                                                       + Math.floor(get$2())
                                                       - 1.0
                                                       - (Math.floor(get$2())
                                                          - 1.0))));
            d = (d_0_ * Math.pow(get$3(), Math.floor(get$2()))
                 * Math.pow(1.0 - get$3(), Math.floor(get$1())));
        }
        return d;
    }

    public final double dbl() {
        return get$0();
    }

    final double get$1() {
        return $inputs.dbl(0);
    }

    final double get$2() {
        return $inputs.dbl(1);
    }

    final double get$3() {
        return $inputs.dbl(2);
    }
}