Average Error: 0 → 0
Time: 20.8s
Precision: 64
$valB \gt 0.0 \land valA \gt 0.0$
$\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 r1597814 = valB;
double r1597815 = lenAsq;
double r1597816 = lenCsq;
double r1597817 = r1597815 + r1597816;
double r1597818 = lenBsq;
double r1597819 = r1597817 - r1597818;
double r1597820 = r1597814 * r1597819;
double r1597821 = valA;
double r1597822 = r1597818 + r1597816;
double r1597823 = r1597822 - r1597815;
double r1597824 = r1597821 * r1597823;
double r1597825 = r1597820 + r1597824;
double r1597826 = 0.5;
double r1597827 = r1597825 * r1597826;
return r1597827;
}


double f(double valB, double lenAsq, double lenCsq, double lenBsq, double valA) {
double r1597828 = valB;
double r1597829 = lenAsq;
double r1597830 = lenCsq;
double r1597831 = r1597829 + r1597830;
double r1597832 = lenBsq;
double r1597833 = r1597831 - r1597832;
double r1597834 = r1597828 * r1597833;
double r1597835 = valA;
double r1597836 = r1597832 + r1597830;
double r1597837 = r1597836 - r1597829;
double r1597838 = r1597835 * r1597837;
double r1597839 = r1597834 + r1597838;
double r1597840 = 0.5;
double r1597841 = r1597839 * r1597840;
return r1597841;
}



# 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
:pre (and (> valB 0.0) (> valA 0.0))
(* (+ (* valB (- (+ lenAsq lenCsq) lenBsq)) (* valA (- (+ lenBsq lenCsq) lenAsq))) 0.5))