AFC - Abacus Formula Compiler for Java

Decompiled Code For TRIMMEAN( C855, D855 )

The expression

=TRIMMEAN( C855, D855 )

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 (!(get$2() >= 0.0) || get$2() >= 1.0) {
            Runtime_v2.fun_ERROR("#NUM! because not 0 <= k < 1 in TRIMMEAN");
            d = (double) -1;
        } else if (Math.floor(get$2() * 1.0 / 2.0) == 0.0)
            d = get$3();
        else {
            $Root root_0_ = this;
            double d_2_;
            double d_1_ = d_2_ = Math.floor(get$2() * 1.0 / 2.0);
            double d_3_;
            if (!(1.0 - Math.floor(get$2() * 1.0 / 2.0) + 1.0 <= 1.0)
                || 1.0 - Math.floor(get$2() * 1.0 / 2.0) + 1.0 < 1.0) {
                Runtime_v2
                    .fun_ERROR("#NUM! because not 1 <= k <= n in SMALL/LARGE");
                d_3_ = (double) -1;
            } else {
                double d_4_;
                d_3_ = get$5(d_4_
                             = 1.0 - Math.floor(get$2() * 1.0 / 2.0) + 1.0);
            }
            double d_6_;
            double d_5_ = d_6_ = d_3_;
            double d_7_;
            if (!(Math.floor(get$2() * 1.0 / 2.0) <= 1.0)
                || Math.floor(get$2() * 1.0 / 2.0) < 1.0) {
                Runtime_v2
                    .fun_ERROR("#NUM! because not 1 <= k <= n in SMALL/LARGE");
                d_7_ = (double) -1;
            } else {
                double d_8_;
                d_7_ = get$7(d_8_ = Math.floor(get$2() * 1.0 / 2.0));
            }
            double d_9_;
            d = root_0_.get$4(d_1_, d_5_, d_9_ = d_7_);
        }
        return d;
    }

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

    final double get$3() {
        double d = 0.0;
        d += get$1();
        return d / 1.0;
    }

    final double get$4(double d, double d_10_, double d_11_) {
        double d_12_ = 0.0;
        double d_13_ = 0.0;
        double d_14_ = 0.0;
        d_12_ = get$1() < d_10_ &#38;&#38; get$1() > d_11_ ? d_12_ + get$1() : d_12_;
        d_13_ = get$1() >= d_10_ ? d_13_ + 1.0 : d_13_;
        d_14_ = get$1() <= d_11_ ? d_14_ + 1.0 : d_14_;
        return ((d_12_ + (d_13_ - d) * d_10_ + (d_14_ - d) * d_11_)
                / (1.0 - 2.0 * d));
    }

    final double get$5(double d) {
        double d_15_ = -1.7976931348623157E308;
        double d_16_ = 1.0;
        d_15_ = d_16_ > d ? d_15_ : get$6(d_16_, d_15_);
        d_16_++;
        return d_15_;
    }

    final double get$6(double d, double d_17_) {
        double d_18_ = 1.7976931348623157E308;
        double d_19_ = 0.0;
        d_18_ = get$1() > d_17_ ? RuntimeDouble_v2.min(get$1(), d_18_) : d_18_;
        d_19_ = get$1() <= d_17_ ? d_19_ + 1.0 : d_19_;
        return d_19_ >= d ? d_17_ : d_18_;
    }

    final double get$7(double d) {
        double d_20_ = -1.7976931348623157E308;
        double d_21_ = 1.0;
        d_20_ = d_21_ > d ? d_20_ : get$8(d_21_, d_20_);
        d_21_++;
        return d_20_;
    }

    final double get$8(double d, double d_22_) {
        double d_23_ = 1.7976931348623157E308;
        double d_24_ = 0.0;
        d_23_ = get$1() > d_22_ ? RuntimeDouble_v2.min(get$1(), d_23_) : d_23_;
        d_24_ = get$1() <= d_22_ ? d_24_ + 1.0 : d_24_;
        return d_24_ >= d ? d_22_ : d_23_;
    }

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

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