Average Error: 6.9 → 0.6
Time: 3.9s
Precision: binary64
\[ \begin{array}{c}[y, t] = \mathsf{sort}([y, t])\\ \end{array} \]
\[\left(x \cdot y - z \cdot y\right) \cdot t \]
\[\begin{array}{l} t_1 := t \cdot \left(y \cdot \left(x - z\right)\right)\\ t_2 := x \cdot y - y \cdot z\\ t_3 := \left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{if}\;t_2 \leq -3.675024877736191 \cdot 10^{+161}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_2 \leq -2.532347618419866 \cdot 10^{-187}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_2 \leq 3.350296082224214 \cdot 10^{-201}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;t_2 \leq 3.647665142799277 \cdot 10^{+268}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
(FPCore (x y z t) :precision binary64 (* (- (* x y) (* z y)) t))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (* y (- x z))))
        (t_2 (- (* x y) (* y z)))
        (t_3 (* (- x z) (* y t))))
   (if (<= t_2 -3.675024877736191e+161)
     t_3
     (if (<= t_2 -2.532347618419866e-187)
       t_1
       (if (<= t_2 3.350296082224214e-201)
         (* y (* (- x z) t))
         (if (<= t_2 3.647665142799277e+268) t_1 t_3))))))
double code(double x, double y, double z, double t) {
	return ((x * y) - (z * y)) * t;
}
double code(double x, double y, double z, double t) {
	double t_1 = t * (y * (x - z));
	double t_2 = (x * y) - (y * z);
	double t_3 = (x - z) * (y * t);
	double tmp;
	if (t_2 <= -3.675024877736191e+161) {
		tmp = t_3;
	} else if (t_2 <= -2.532347618419866e-187) {
		tmp = t_1;
	} else if (t_2 <= 3.350296082224214e-201) {
		tmp = y * ((x - z) * t);
	} else if (t_2 <= 3.647665142799277e+268) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
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) :: t_3
    real(8) :: tmp
    t_1 = t * (y * (x - z))
    t_2 = (x * y) - (y * z)
    t_3 = (x - z) * (y * t)
    if (t_2 <= (-3.675024877736191d+161)) then
        tmp = t_3
    else if (t_2 <= (-2.532347618419866d-187)) then
        tmp = t_1
    else if (t_2 <= 3.350296082224214d-201) then
        tmp = y * ((x - z) * t)
    else if (t_2 <= 3.647665142799277d+268) then
        tmp = t_1
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	return ((x * y) - (z * y)) * t;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = t * (y * (x - z));
	double t_2 = (x * y) - (y * z);
	double t_3 = (x - z) * (y * t);
	double tmp;
	if (t_2 <= -3.675024877736191e+161) {
		tmp = t_3;
	} else if (t_2 <= -2.532347618419866e-187) {
		tmp = t_1;
	} else if (t_2 <= 3.350296082224214e-201) {
		tmp = y * ((x - z) * t);
	} else if (t_2 <= 3.647665142799277e+268) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t):
	return ((x * y) - (z * y)) * t
def code(x, y, z, t):
	t_1 = t * (y * (x - z))
	t_2 = (x * y) - (y * z)
	t_3 = (x - z) * (y * t)
	tmp = 0
	if t_2 <= -3.675024877736191e+161:
		tmp = t_3
	elif t_2 <= -2.532347618419866e-187:
		tmp = t_1
	elif t_2 <= 3.350296082224214e-201:
		tmp = y * ((x - z) * t)
	elif t_2 <= 3.647665142799277e+268:
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t)
	return Float64(Float64(Float64(x * y) - Float64(z * y)) * t)
end
function code(x, y, z, t)
	t_1 = Float64(t * Float64(y * Float64(x - z)))
	t_2 = Float64(Float64(x * y) - Float64(y * z))
	t_3 = Float64(Float64(x - z) * Float64(y * t))
	tmp = 0.0
	if (t_2 <= -3.675024877736191e+161)
		tmp = t_3;
	elseif (t_2 <= -2.532347618419866e-187)
		tmp = t_1;
	elseif (t_2 <= 3.350296082224214e-201)
		tmp = Float64(y * Float64(Float64(x - z) * t));
	elseif (t_2 <= 3.647665142799277e+268)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp = code(x, y, z, t)
	tmp = ((x * y) - (z * y)) * t;
end
function tmp_2 = code(x, y, z, t)
	t_1 = t * (y * (x - z));
	t_2 = (x * y) - (y * z);
	t_3 = (x - z) * (y * t);
	tmp = 0.0;
	if (t_2 <= -3.675024877736191e+161)
		tmp = t_3;
	elseif (t_2 <= -2.532347618419866e-187)
		tmp = t_1;
	elseif (t_2 <= 3.350296082224214e-201)
		tmp = y * ((x - z) * t);
	elseif (t_2 <= 3.647665142799277e+268)
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x - z), $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -3.675024877736191e+161], t$95$3, If[LessEqual[t$95$2, -2.532347618419866e-187], t$95$1, If[LessEqual[t$95$2, 3.350296082224214e-201], N[(y * N[(N[(x - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 3.647665142799277e+268], t$95$1, t$95$3]]]]]]]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
t_1 := t \cdot \left(y \cdot \left(x - z\right)\right)\\
t_2 := x \cdot y - y \cdot z\\
t_3 := \left(x - z\right) \cdot \left(y \cdot t\right)\\
\mathbf{if}\;t_2 \leq -3.675024877736191 \cdot 10^{+161}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;t_2 \leq -2.532347618419866 \cdot 10^{-187}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t_2 \leq 3.350296082224214 \cdot 10^{-201}:\\
\;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\

\mathbf{elif}\;t_2 \leq 3.647665142799277 \cdot 10^{+268}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.9
Target3.2
Herbie0.6
\[\begin{array}{l} \mathbf{if}\;t < -9.231879582886777 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t < 2.543067051564877 \cdot 10^{+83}:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \end{array} \]

Derivation

  1. Split input into 3 regimes
  2. if (-.f64 (*.f64 x y) (*.f64 z y)) < -3.6750248777361908e161 or 3.647665142799277e268 < (-.f64 (*.f64 x y) (*.f64 z y))

    1. Initial program 29.6

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Simplified1.9

      \[\leadsto \color{blue}{y \cdot \left(t \cdot \left(x - z\right)\right)} \]
    3. Taylor expanded in y around 0 1.9

      \[\leadsto \color{blue}{\left(t \cdot x - t \cdot z\right) \cdot y} \]
    4. Simplified1.5

      \[\leadsto \color{blue}{\left(x - z\right) \cdot \left(t \cdot y\right)} \]

    if -3.6750248777361908e161 < (-.f64 (*.f64 x y) (*.f64 z y)) < -2.5323476184198661e-187 or 3.35029608222421406e-201 < (-.f64 (*.f64 x y) (*.f64 z y)) < 3.647665142799277e268

    1. Initial program 0.3

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Simplified9.7

      \[\leadsto \color{blue}{y \cdot \left(t \cdot \left(x - z\right)\right)} \]
    3. Applied egg-rr31.0

      \[\leadsto \color{blue}{{\left(\sqrt{t \cdot \left(\left(x - z\right) \cdot y\right)}\right)}^{2}} \]
    4. Applied egg-rr0.3

      \[\leadsto \color{blue}{\left(\left(x - z\right) \cdot y\right) \cdot t} \]

    if -2.5323476184198661e-187 < (-.f64 (*.f64 x y) (*.f64 z y)) < 3.35029608222421406e-201

    1. Initial program 7.7

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Simplified0.9

      \[\leadsto \color{blue}{y \cdot \left(t \cdot \left(x - z\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - y \cdot z \leq -3.675024877736191 \cdot 10^{+161}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - y \cdot z \leq -2.532347618419866 \cdot 10^{-187}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \mathbf{elif}\;x \cdot y - y \cdot z \leq 3.350296082224214 \cdot 10^{-201}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;x \cdot y - y \cdot z \leq 3.647665142799277 \cdot 10^{+268}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \end{array} \]

Reproduce

herbie shell --seed 2022153 
(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))