# ?

Average Error: 0.1 → 0.1
Time: 22.7s
Precision: binary64
Cost: 2496

# ?

$\left(\left(\left(\left(\left(\left(\left(-1 \leq ay \land ay \leq 1\right) \land \left(-1 \leq hy \land hy \leq 1\right)\right) \land \left(-1 \leq dha \land dha \leq 1\right)\right) \land \left(-1 \leq cz \land cz \leq 1\right)\right) \land \left(-1 \leq hz \land hz \leq 1\right)\right) \land \left(-1 \leq dhc \land dhc \leq 1\right)\right) \land \left(-1 \leq az \land az \leq 1\right)\right) \land \left(-1 \leq cy \land cy \leq 1\right)$
$\left(ay - \left(2 \cdot hy\right) \cdot dha\right) \cdot \left(cz - \left(2 \cdot hz\right) \cdot dhc\right) - \left(az - \left(2 \cdot az\right) \cdot dha\right) \cdot \left(cy - \left(2 \cdot hy\right) \cdot dhc\right)$
$\begin{array}{l} t_0 := cz + dhc \cdot \left(hz \cdot -2\right)\\ \left(t_0 \cdot ay + t_0 \cdot \left(dha \cdot \left(-2 \cdot hy\right)\right)\right) + \left(az + dha \cdot \left(-2 \cdot az\right)\right) \cdot \left(dhc \cdot \left(hy \cdot 2\right) - cy\right) \end{array}$
(FPCore (ay hy dha cz hz dhc az cy)
:precision binary64
(-
(* (- ay (* (* 2.0 hy) dha)) (- cz (* (* 2.0 hz) dhc)))
(* (- az (* (* 2.0 az) dha)) (- cy (* (* 2.0 hy) dhc)))))
(FPCore (ay hy dha cz hz dhc az cy)
:precision binary64
(let* ((t_0 (+ cz (* dhc (* hz -2.0)))))
(+
(+ (* t_0 ay) (* t_0 (* dha (* -2.0 hy))))
(* (+ az (* dha (* -2.0 az))) (- (* dhc (* hy 2.0)) cy)))))
double code(double ay, double hy, double dha, double cz, double hz, double dhc, double az, double cy) {
return ((ay - ((2.0 * hy) * dha)) * (cz - ((2.0 * hz) * dhc))) - ((az - ((2.0 * az) * dha)) * (cy - ((2.0 * hy) * dhc)));
}

double code(double ay, double hy, double dha, double cz, double hz, double dhc, double az, double cy) {
double t_0 = cz + (dhc * (hz * -2.0));
return ((t_0 * ay) + (t_0 * (dha * (-2.0 * hy)))) + ((az + (dha * (-2.0 * az))) * ((dhc * (hy * 2.0)) - cy));
}

real(8) function code(ay, hy, dha, cz, hz, dhc, az, cy)
real(8), intent (in) :: ay
real(8), intent (in) :: hy
real(8), intent (in) :: dha
real(8), intent (in) :: cz
real(8), intent (in) :: hz
real(8), intent (in) :: dhc
real(8), intent (in) :: az
real(8), intent (in) :: cy
code = ((ay - ((2.0d0 * hy) * dha)) * (cz - ((2.0d0 * hz) * dhc))) - ((az - ((2.0d0 * az) * dha)) * (cy - ((2.0d0 * hy) * dhc)))
end function

real(8) function code(ay, hy, dha, cz, hz, dhc, az, cy)
real(8), intent (in) :: ay
real(8), intent (in) :: hy
real(8), intent (in) :: dha
real(8), intent (in) :: cz
real(8), intent (in) :: hz
real(8), intent (in) :: dhc
real(8), intent (in) :: az
real(8), intent (in) :: cy
real(8) :: t_0
t_0 = cz + (dhc * (hz * (-2.0d0)))
code = ((t_0 * ay) + (t_0 * (dha * ((-2.0d0) * hy)))) + ((az + (dha * ((-2.0d0) * az))) * ((dhc * (hy * 2.0d0)) - cy))
end function

public static double code(double ay, double hy, double dha, double cz, double hz, double dhc, double az, double cy) {
return ((ay - ((2.0 * hy) * dha)) * (cz - ((2.0 * hz) * dhc))) - ((az - ((2.0 * az) * dha)) * (cy - ((2.0 * hy) * dhc)));
}

public static double code(double ay, double hy, double dha, double cz, double hz, double dhc, double az, double cy) {
double t_0 = cz + (dhc * (hz * -2.0));
return ((t_0 * ay) + (t_0 * (dha * (-2.0 * hy)))) + ((az + (dha * (-2.0 * az))) * ((dhc * (hy * 2.0)) - cy));
}

def code(ay, hy, dha, cz, hz, dhc, az, cy):
return ((ay - ((2.0 * hy) * dha)) * (cz - ((2.0 * hz) * dhc))) - ((az - ((2.0 * az) * dha)) * (cy - ((2.0 * hy) * dhc)))

def code(ay, hy, dha, cz, hz, dhc, az, cy):
t_0 = cz + (dhc * (hz * -2.0))
return ((t_0 * ay) + (t_0 * (dha * (-2.0 * hy)))) + ((az + (dha * (-2.0 * az))) * ((dhc * (hy * 2.0)) - cy))

function code(ay, hy, dha, cz, hz, dhc, az, cy)
return Float64(Float64(Float64(ay - Float64(Float64(2.0 * hy) * dha)) * Float64(cz - Float64(Float64(2.0 * hz) * dhc))) - Float64(Float64(az - Float64(Float64(2.0 * az) * dha)) * Float64(cy - Float64(Float64(2.0 * hy) * dhc))))
end

function code(ay, hy, dha, cz, hz, dhc, az, cy)
t_0 = Float64(cz + Float64(dhc * Float64(hz * -2.0)))
return Float64(Float64(Float64(t_0 * ay) + Float64(t_0 * Float64(dha * Float64(-2.0 * hy)))) + Float64(Float64(az + Float64(dha * Float64(-2.0 * az))) * Float64(Float64(dhc * Float64(hy * 2.0)) - cy)))
end

function tmp = code(ay, hy, dha, cz, hz, dhc, az, cy)
tmp = ((ay - ((2.0 * hy) * dha)) * (cz - ((2.0 * hz) * dhc))) - ((az - ((2.0 * az) * dha)) * (cy - ((2.0 * hy) * dhc)));
end

function tmp = code(ay, hy, dha, cz, hz, dhc, az, cy)
t_0 = cz + (dhc * (hz * -2.0));
tmp = ((t_0 * ay) + (t_0 * (dha * (-2.0 * hy)))) + ((az + (dha * (-2.0 * az))) * ((dhc * (hy * 2.0)) - cy));
end

code[ay_, hy_, dha_, cz_, hz_, dhc_, az_, cy_] := N[(N[(N[(ay - N[(N[(2.0 * hy), $MachinePrecision] * dha),$MachinePrecision]), $MachinePrecision] * N[(cz - N[(N[(2.0 * hz),$MachinePrecision] * dhc), $MachinePrecision]),$MachinePrecision]), $MachinePrecision] - N[(N[(az - N[(N[(2.0 * az),$MachinePrecision] * dha), $MachinePrecision]),$MachinePrecision] * N[(cy - N[(N[(2.0 * hy), $MachinePrecision] * dhc),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]), $MachinePrecision]  code[ay_, hy_, dha_, cz_, hz_, dhc_, az_, cy_] := Block[{t$95$0 = N[(cz + N[(dhc * N[(hz * -2.0),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]}, N[(N[(N[(t$95$0 * ay), $MachinePrecision] + N[(t$95$0 * N[(dha * N[(-2.0 * hy),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]), $MachinePrecision] + N[(N[(az + N[(dha * N[(-2.0 * az),$MachinePrecision]), $MachinePrecision]),$MachinePrecision] * N[(N[(dhc * N[(hy * 2.0), $MachinePrecision]),$MachinePrecision] - cy), $MachinePrecision]),$MachinePrecision]), \$MachinePrecision]]

\left(ay - \left(2 \cdot hy\right) \cdot dha\right) \cdot \left(cz - \left(2 \cdot hz\right) \cdot dhc\right) - \left(az - \left(2 \cdot az\right) \cdot dha\right) \cdot \left(cy - \left(2 \cdot hy\right) \cdot dhc\right)

\begin{array}{l}
t_0 := cz + dhc \cdot \left(hz \cdot -2\right)\\
\left(t_0 \cdot ay + t_0 \cdot \left(dha \cdot \left(-2 \cdot hy\right)\right)\right) + \left(az + dha \cdot \left(-2 \cdot az\right)\right) \cdot \left(dhc \cdot \left(hy \cdot 2\right) - cy\right)
\end{array}


# Try it out?

Results

 In Out
Enter valid numbers for all inputs

# Derivation?

1. Initial program 0.1

$\left(ay - \left(2 \cdot hy\right) \cdot dha\right) \cdot \left(cz - \left(2 \cdot hz\right) \cdot dhc\right) - \left(az - \left(2 \cdot az\right) \cdot dha\right) \cdot \left(cy - \left(2 \cdot hy\right) \cdot dhc\right)$
2. Applied egg-rr0.1

$\leadsto \color{blue}{\left(\left(cz + dhc \cdot \left(hz \cdot -2\right)\right) \cdot ay + \left(cz + dhc \cdot \left(hz \cdot -2\right)\right) \cdot \left(dha \cdot \left(hy \cdot -2\right)\right)\right)} - \left(az - \left(2 \cdot az\right) \cdot dha\right) \cdot \left(cy - \left(2 \cdot hy\right) \cdot dhc\right)$
3. Final simplification0.1

$\leadsto \left(\left(cz + dhc \cdot \left(hz \cdot -2\right)\right) \cdot ay + \left(cz + dhc \cdot \left(hz \cdot -2\right)\right) \cdot \left(dha \cdot \left(-2 \cdot hy\right)\right)\right) + \left(az + dha \cdot \left(-2 \cdot az\right)\right) \cdot \left(dhc \cdot \left(hy \cdot 2\right) - cy\right)$

# Alternatives

Alternative 1
Error0.1
Cost1984
$\left(cz + dhc \cdot \left(hz \cdot -2\right)\right) \cdot \left(ay + dha \cdot \left(-2 \cdot hy\right)\right) + \left(az + dha \cdot \left(-2 \cdot az\right)\right) \cdot \left(dhc \cdot \left(hy \cdot 2\right) - cy\right)$
Alternative 2
Error0.5
Cost1600
$\left(cz + dhc \cdot \left(hz \cdot -2\right)\right) \cdot \left(ay + dha \cdot \left(-2 \cdot hy\right)\right) + az \cdot \left(2 \cdot \left(dhc \cdot hy\right) - cy\right)$
Alternative 3
Error17.7
Cost1225
$\begin{array}{l} \mathbf{if}\;cz \leq -1.45 \cdot 10^{-99} \lor \neg \left(cz \leq 6.6 \cdot 10^{-172}\right):\\ \;\;\;\;cz \cdot \left(ay + -2 \cdot \left(dha \cdot hy\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(cy + -2 \cdot \left(dhc \cdot hy\right)\right) \cdot \left(az \cdot \left(dha \cdot 2 + -1\right)\right)\\ \end{array}$
Alternative 4
Error4.6
Cost1216
$ay \cdot \left(cz + -2 \cdot \left(dhc \cdot hz\right)\right) + az \cdot \left(2 \cdot \left(dhc \cdot hy\right) - cy\right)$
Alternative 5
Error25.6
Cost973
$\begin{array}{l} \mathbf{if}\;ay \leq -5 \cdot 10^{-147} \lor \neg \left(ay \leq 1.1 \cdot 10^{-132}\right) \land ay \leq 4.2 \cdot 10^{-28}:\\ \;\;\;\;ay \cdot \left(cz + -2 \cdot \left(dhc \cdot hz\right)\right)\\ \mathbf{else}:\\ \;\;\;\;cz \cdot \left(ay + -2 \cdot \left(dha \cdot hy\right)\right)\\ \end{array}$
Alternative 6
Error19.8
Cost841
$\begin{array}{l} \mathbf{if}\;cz \leq -8.5 \cdot 10^{-105} \lor \neg \left(cz \leq 2.2 \cdot 10^{-172}\right):\\ \;\;\;\;cz \cdot \left(ay + -2 \cdot \left(dha \cdot hy\right)\right)\\ \mathbf{else}:\\ \;\;\;\;cy \cdot \left(2 \cdot \left(dha \cdot az\right) - az\right)\\ \end{array}$
Alternative 7
Error30.3
Cost712
$\begin{array}{l} \mathbf{if}\;cz \leq -4 \cdot 10^{-247}:\\ \;\;\;\;cz \cdot ay\\ \mathbf{elif}\;cz \leq 1.46 \cdot 10^{-263}:\\ \;\;\;\;ay \cdot \left(hz \cdot \left(dhc \cdot -2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;cz \cdot ay\\ \end{array}$
Alternative 8
Error30.3
Cost712
$\begin{array}{l} \mathbf{if}\;cz \leq -1.25 \cdot 10^{-247}:\\ \;\;\;\;cz \cdot ay\\ \mathbf{elif}\;cz \leq 3.6 \cdot 10^{-264}:\\ \;\;\;\;\left(dhc \cdot -2\right) \cdot \left(hz \cdot ay\right)\\ \mathbf{else}:\\ \;\;\;\;cz \cdot ay\\ \end{array}$
Alternative 9
Error27.5
Cost576
$ay \cdot \left(cz + -2 \cdot \left(dhc \cdot hz\right)\right)$
Alternative 10
Error31.0
Cost192
$cz \cdot ay$

# Reproduce?

herbie shell --seed 1
(FPCore (ay hy dha cz hz dhc az cy)
:name "(ay - 2 * hy * dha) * (cz - 2 * hz * dhc) - (az - 2 * az * dha) * (cy - 2 * hy * dhc)"
:precision binary64
:pre (and (and (and (and (and (and (and (and (<= -1.0 ay) (<= ay 1.0)) (and (<= -1.0 hy) (<= hy 1.0))) (and (<= -1.0 dha) (<= dha 1.0))) (and (<= -1.0 cz) (<= cz 1.0))) (and (<= -1.0 hz) (<= hz 1.0))) (and (<= -1.0 dhc) (<= dhc 1.0))) (and (<= -1.0 az) (<= az 1.0))) (and (<= -1.0 cy) (<= cy 1.0)))
(- (* (- ay (* (* 2.0 hy) dha)) (- cz (* (* 2.0 hz) dhc))) (* (- az (* (* 2.0 az) dha)) (- cy (* (* 2.0 hy) dhc)))))