(FPCore (x y z t) :precision binary64 (* (- (* x y) (* z y)) t))
↓
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x y) (* y z))) (t_2 (* y (* t (- x z)))))
(if (<= t_1 -2e+191)
t_2
(if (<= t_1 -1e-119)
(* t (* y (- x z)))
(if (<= t_1 0.0)
(* (- x z) (* y t))
(if (<= t_1 5e+181) (* t_1 t) t_2))))))
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * y) - (z * y)) * t
end function
↓
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * y) - (y * z)
t_2 = y * (t * (x - z))
if (t_1 <= (-2d+191)) then
tmp = t_2
else if (t_1 <= (-1d-119)) then
tmp = t * (y * (x - z))
else if (t_1 <= 0.0d0) then
tmp = (x - z) * (y * t)
else if (t_1 <= 5d+181) then
tmp = t_1 * t
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
return ((x * y) - (z * y)) * t;
}
(*.f64 (-.f64 x z) (*.f64 y t)): 0 points increase in error, 0 points decrease in error
(Rewrite<= *-commutative_binary64 (*.f64 (*.f64 y t) (-.f64 x z))): 0 points increase in error, 2 points decrease in error
(*.f64 (*.f64 y t) (Rewrite=> sub-neg_binary64 (+.f64 x (neg.f64 z)))): 8 points increase in error, 0 points decrease in error
(Rewrite=> distribute-lft-in_binary64 (+.f64 (*.f64 (*.f64 y t) x) (*.f64 (*.f64 y t) (neg.f64 z)))): 0 points increase in error, 4 points decrease in error
(+.f64 (Rewrite<= associate-*r*_binary64 (*.f64 y (*.f64 t x))) (*.f64 (*.f64 y t) (neg.f64 z))): 0 points increase in error, 8 points decrease in error
(+.f64 (*.f64 y (*.f64 t x)) (Rewrite=> distribute-rgt-neg-out_binary64 (neg.f64 (*.f64 (*.f64 y t) z)))): 8 points increase in error, 0 points decrease in error
(+.f64 (*.f64 y (*.f64 t x)) (neg.f64 (Rewrite<= associate-*r*_binary64 (*.f64 y (*.f64 t z))))): 0 points increase in error, 8 points decrease in error
(+.f64 (*.f64 y (*.f64 t x)) (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (*.f64 y (*.f64 t z))))): 0 points increase in error, 0 points decrease in error
if -0.0 < (-.f64 (*.f64 x y) (*.f64 z y)) < 5.0000000000000003e181
Initial program 0.4
\[\left(x \cdot y - z \cdot y\right) \cdot t
\]
Recombined 4 regimes into one program.
Final simplification0.8
\[\leadsto \begin{array}{l}
\mathbf{if}\;x \cdot y - y \cdot z \leq -2 \cdot 10^{+191}:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\mathbf{elif}\;x \cdot y - y \cdot z \leq -1 \cdot 10^{-119}:\\
\;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\
\mathbf{elif}\;x \cdot y - y \cdot z \leq 0:\\
\;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;x \cdot y - y \cdot z \leq 5 \cdot 10^{+181}:\\
\;\;\;\;\left(x \cdot y - y \cdot z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\end{array}
\]
herbie shell --seed 2022343
(FPCore (x y z t)
:name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t)))
(* (- (* x y) (* z y)) t))