Average Error: 0 → 0
Time: 18.8s
Precision: 64
$\left(valB \cdot \left(\left(lenAsq + lenCsq\right) - lenBsq\right) + valA \cdot \left(\left(lenBsq + lenCsq\right) - lenAsq\right)\right) \cdot 0.5$
$\left(valB \cdot \left(\left(lenAsq + lenCsq\right) - lenBsq\right) + valA \cdot \left(\left(lenBsq + lenCsq\right) - lenAsq\right)\right) \cdot 0.5$
\left(valB \cdot \left(\left(lenAsq + lenCsq\right) - lenBsq\right) + valA \cdot \left(\left(lenBsq + lenCsq\right) - lenAsq\right)\right) \cdot 0.5
\left(valB \cdot \left(\left(lenAsq + lenCsq\right) - lenBsq\right) + valA \cdot \left(\left(lenBsq + lenCsq\right) - lenAsq\right)\right) \cdot 0.5
double f(double valB, double lenAsq, double lenCsq, double lenBsq, double valA) {
double r1597488 = valB;
double r1597489 = lenAsq;
double r1597490 = lenCsq;
double r1597491 = r1597489 + r1597490;
double r1597492 = lenBsq;
double r1597493 = r1597491 - r1597492;
double r1597494 = r1597488 * r1597493;
double r1597495 = valA;
double r1597496 = r1597492 + r1597490;
double r1597497 = r1597496 - r1597489;
double r1597498 = r1597495 * r1597497;
double r1597499 = r1597494 + r1597498;
double r1597500 = 0.5;
double r1597501 = r1597499 * r1597500;
return r1597501;
}


double f(double valB, double lenAsq, double lenCsq, double lenBsq, double valA) {
double r1597502 = valB;
double r1597503 = lenAsq;
double r1597504 = lenCsq;
double r1597505 = r1597503 + r1597504;
double r1597506 = lenBsq;
double r1597507 = r1597505 - r1597506;
double r1597508 = r1597502 * r1597507;
double r1597509 = valA;
double r1597510 = r1597506 + r1597504;
double r1597511 = r1597510 - r1597503;
double r1597512 = r1597509 * r1597511;
double r1597513 = r1597508 + r1597512;
double r1597514 = 0.5;
double r1597515 = r1597513 * r1597514;
return r1597515;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0

$\left(valB \cdot \left(\left(lenAsq + lenCsq\right) - lenBsq\right) + valA \cdot \left(\left(lenBsq + lenCsq\right) - lenAsq\right)\right) \cdot 0.5$
2. Final simplification0

$\leadsto \left(valB \cdot \left(\left(lenAsq + lenCsq\right) - lenBsq\right) + valA \cdot \left(\left(lenBsq + lenCsq\right) - lenAsq\right)\right) \cdot 0.5$

# Reproduce

herbie shell --seed 1
(FPCore (valB lenAsq lenCsq lenBsq valA)
:name "(valB * (lenAsq + lenCsq - lenBsq) + valA * (lenBsq + lenCsq - lenAsq)) * 0.5"
:precision binary32
(* (+ (* valB (- (+ lenAsq lenCsq) lenBsq)) (* valA (- (+ lenBsq lenCsq) lenAsq))) 0.5))