\[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\]
↓
\[\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
t_2 := a + b \cdot c\\
t_3 := t_1 - c \cdot \left(\left(a + c \cdot b\right) \cdot i\right)\\
\mathbf{if}\;c \leq -2.9 \cdot 10^{+65}:\\
\;\;\;\;2 \cdot \left(t_3 \cdot \left(t_3 \cdot \frac{1}{t_3}\right)\right)\\
\mathbf{elif}\;c \leq 3.7 \cdot 10^{-177}:\\
\;\;\;\;2 \cdot \left(t_1 - \left(t_2 \cdot c\right) \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t_1 - c \cdot \left(t_2 \cdot i\right)\right)\\
\end{array}
\]
(FPCore (x y z t a b c i)
:precision binary64
(* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
↓
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t)))
(t_2 (+ a (* b c)))
(t_3 (- t_1 (* c (* (+ a (* c b)) i)))))
(if (<= c -2.9e+65)
(* 2.0 (* t_3 (* t_3 (/ 1.0 t_3))))
(if (<= c 3.7e-177)
(* 2.0 (- t_1 (* (* t_2 c) i)))
(* 2.0 (- t_1 (* c (* t_2 i))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
end function
↓
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = (x * y) + (z * t)
t_2 = a + (b * c)
t_3 = t_1 - (c * ((a + (c * b)) * i))
if (c <= (-2.9d+65)) then
tmp = 2.0d0 * (t_3 * (t_3 * (1.0d0 / t_3)))
else if (c <= 3.7d-177) then
tmp = 2.0d0 * (t_1 - ((t_2 * c) * i))
else
tmp = 2.0d0 * (t_1 - (c * (t_2 * i)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
\[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\]
Simplified4.2
\[\leadsto \color{blue}{2 \cdot \left(\left(x \cdot y + z \cdot t\right) - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)}
\]
Proof
[Start]26.0
\[ 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\]
rational_best.json-simplify-2 [=>]26.0
\[ 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{i \cdot \left(\left(a + b \cdot c\right) \cdot c\right)}\right)
\]
rational_best.json-simplify-2 [=>]26.0
\[ 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - i \cdot \color{blue}{\left(c \cdot \left(a + b \cdot c\right)\right)}\right)
\]
rational_best.json-simplify-44 [=>]4.2
\[ 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)}\right)
\]
rational_best.json-simplify-2 [=>]4.2
\[ 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - c \cdot \color{blue}{\left(\left(a + b \cdot c\right) \cdot i\right)}\right)
\]
Applied egg-rr4.3
\[\leadsto 2 \cdot \color{blue}{\left(\left(\left(x \cdot y + z \cdot t\right) - c \cdot \left(\left(a + c \cdot b\right) \cdot i\right)\right) \cdot \left(\left(\left(x \cdot y + z \cdot t\right) - c \cdot \left(\left(a + c \cdot b\right) \cdot i\right)\right) \cdot \frac{1}{\left(x \cdot y + z \cdot t\right) - c \cdot \left(\left(a + c \cdot b\right) \cdot i\right)}\right)\right)}
\]
if -2.9e65 < c < 3.69999999999999993e-177
Initial program 0.9
\[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\]
if 3.69999999999999993e-177 < c
Initial program 9.1
\[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\]
Simplified4.8
\[\leadsto \color{blue}{2 \cdot \left(\left(x \cdot y + z \cdot t\right) - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)}
\]
Proof
[Start]9.1
\[ 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\]
rational_best.json-simplify-2 [=>]9.1
\[ 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{i \cdot \left(\left(a + b \cdot c\right) \cdot c\right)}\right)
\]
rational_best.json-simplify-2 [=>]9.1
\[ 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - i \cdot \color{blue}{\left(c \cdot \left(a + b \cdot c\right)\right)}\right)
\]
rational_best.json-simplify-44 [=>]4.8
\[ 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)}\right)
\]
rational_best.json-simplify-2 [=>]4.8
\[ 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - c \cdot \color{blue}{\left(\left(a + b \cdot c\right) \cdot i\right)}\right)
\]
Recombined 3 regimes into one program.
Final simplification2.6
\[\leadsto \begin{array}{l}
\mathbf{if}\;c \leq -2.9 \cdot 10^{+65}:\\
\;\;\;\;2 \cdot \left(\left(\left(x \cdot y + z \cdot t\right) - c \cdot \left(\left(a + c \cdot b\right) \cdot i\right)\right) \cdot \left(\left(\left(x \cdot y + z \cdot t\right) - c \cdot \left(\left(a + c \cdot b\right) \cdot i\right)\right) \cdot \frac{1}{\left(x \cdot y + z \cdot t\right) - c \cdot \left(\left(a + c \cdot b\right) \cdot i\right)}\right)\right)\\
\mathbf{elif}\;c \leq 3.7 \cdot 10^{-177}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\
\end{array}
\]
herbie shell --seed 2023089
(FPCore (x y z t a b c i)
:name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(* 2.0 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i))))
(* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))