
(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
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 * 2.0d0) / ((y * z) - (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
def code(x, y, z, t): return (x * 2.0) / ((y * z) - (t * z))
function code(x, y, z, t) return Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x * 2.0) / ((y * z) - (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
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 * 2.0d0) / ((y * z) - (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
def code(x, y, z, t): return (x * 2.0) / ((y * z) - (t * z))
function code(x, y, z, t) return Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x * 2.0) / ((y * z) - (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x 2.0) (- (* y z) (* z t)))))
(if (<= t_1 -1e-276)
(/ (* x 2.0) (* z (- y t)))
(if (<= t_1 4e-97)
(/ (/ (* x -2.0) z) (- t y))
(* (/ 2.0 z) (/ x (- y t)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 2.0) / ((y * z) - (z * t));
double tmp;
if (t_1 <= -1e-276) {
tmp = (x * 2.0) / (z * (y - t));
} else if (t_1 <= 4e-97) {
tmp = ((x * -2.0) / z) / (t - y);
} else {
tmp = (2.0 / z) * (x / (y - t));
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = (x * 2.0d0) / ((y * z) - (z * t))
if (t_1 <= (-1d-276)) then
tmp = (x * 2.0d0) / (z * (y - t))
else if (t_1 <= 4d-97) then
tmp = ((x * (-2.0d0)) / z) / (t - y)
else
tmp = (2.0d0 / z) * (x / (y - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * 2.0) / ((y * z) - (z * t));
double tmp;
if (t_1 <= -1e-276) {
tmp = (x * 2.0) / (z * (y - t));
} else if (t_1 <= 4e-97) {
tmp = ((x * -2.0) / z) / (t - y);
} else {
tmp = (2.0 / z) * (x / (y - t));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 2.0) / ((y * z) - (z * t)) tmp = 0 if t_1 <= -1e-276: tmp = (x * 2.0) / (z * (y - t)) elif t_1 <= 4e-97: tmp = ((x * -2.0) / z) / (t - y) else: tmp = (2.0 / z) * (x / (y - t)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(z * t))) tmp = 0.0 if (t_1 <= -1e-276) tmp = Float64(Float64(x * 2.0) / Float64(z * Float64(y - t))); elseif (t_1 <= 4e-97) tmp = Float64(Float64(Float64(x * -2.0) / z) / Float64(t - y)); else tmp = Float64(Float64(2.0 / z) * Float64(x / Float64(y - t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 2.0) / ((y * z) - (z * t)); tmp = 0.0; if (t_1 <= -1e-276) tmp = (x * 2.0) / (z * (y - t)); elseif (t_1 <= 4e-97) tmp = ((x * -2.0) / z) / (t - y); else tmp = (2.0 / z) * (x / (y - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-276], N[(N[(x * 2.0), $MachinePrecision] / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-97], N[(N[(N[(x * -2.0), $MachinePrecision] / z), $MachinePrecision] / N[(t - y), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] * N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot 2}{y \cdot z - z \cdot t}\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{-276}:\\
\;\;\;\;\frac{x \cdot 2}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;t_1 \leq 4 \cdot 10^{-97}:\\
\;\;\;\;\frac{\frac{x \cdot -2}{z}}{t - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y - t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) < -1e-276Initial program 95.6%
distribute-rgt-out--97.8%
Simplified97.8%
if -1e-276 < (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) < 4.00000000000000014e-97Initial program 87.5%
*-commutative87.5%
distribute-rgt-out--87.5%
times-frac91.7%
Simplified91.7%
frac-2neg91.7%
associate-*r/99.0%
*-commutative99.0%
associate-*r/99.1%
distribute-lft-neg-in99.1%
distribute-rgt-neg-in99.1%
metadata-eval99.1%
neg-sub099.1%
sub-neg99.1%
+-commutative99.1%
associate--r+99.1%
neg-sub099.1%
remove-double-neg99.1%
Applied egg-rr99.1%
if 4.00000000000000014e-97 < (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) Initial program 78.7%
*-commutative78.7%
distribute-rgt-out--87.0%
times-frac99.7%
Simplified99.7%
Final simplification98.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (* x 2.0) -1e-78) (not (<= (* x 2.0) 5e-117))) (* (/ 2.0 z) (/ x (- y t))) (/ 2.0 (* (- y t) (/ z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x * 2.0) <= -1e-78) || !((x * 2.0) <= 5e-117)) {
tmp = (2.0 / z) * (x / (y - t));
} else {
tmp = 2.0 / ((y - t) * (z / x));
}
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
real(8) :: tmp
if (((x * 2.0d0) <= (-1d-78)) .or. (.not. ((x * 2.0d0) <= 5d-117))) then
tmp = (2.0d0 / z) * (x / (y - t))
else
tmp = 2.0d0 / ((y - t) * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x * 2.0) <= -1e-78) || !((x * 2.0) <= 5e-117)) {
tmp = (2.0 / z) * (x / (y - t));
} else {
tmp = 2.0 / ((y - t) * (z / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x * 2.0) <= -1e-78) or not ((x * 2.0) <= 5e-117): tmp = (2.0 / z) * (x / (y - t)) else: tmp = 2.0 / ((y - t) * (z / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x * 2.0) <= -1e-78) || !(Float64(x * 2.0) <= 5e-117)) tmp = Float64(Float64(2.0 / z) * Float64(x / Float64(y - t))); else tmp = Float64(2.0 / Float64(Float64(y - t) * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x * 2.0) <= -1e-78) || ~(((x * 2.0) <= 5e-117))) tmp = (2.0 / z) * (x / (y - t)); else tmp = 2.0 / ((y - t) * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x * 2.0), $MachinePrecision], -1e-78], N[Not[LessEqual[N[(x * 2.0), $MachinePrecision], 5e-117]], $MachinePrecision]], N[(N[(2.0 / z), $MachinePrecision] * N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(y - t), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 2 \leq -1 \cdot 10^{-78} \lor \neg \left(x \cdot 2 \leq 5 \cdot 10^{-117}\right):\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(y - t\right) \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if (*.f64 x 2) < -9.99999999999999999e-79 or 5e-117 < (*.f64 x 2) Initial program 87.2%
*-commutative87.2%
distribute-rgt-out--89.8%
times-frac99.0%
Simplified99.0%
if -9.99999999999999999e-79 < (*.f64 x 2) < 5e-117Initial program 89.9%
*-commutative89.9%
distribute-rgt-out--92.9%
times-frac81.6%
Simplified81.6%
associate-*r/97.2%
associate-/r/97.0%
associate-/l/96.6%
Applied egg-rr96.6%
Final simplification98.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (/ (/ x y) z))) (t_2 (* -2.0 (/ x (* z t)))))
(if (<= t -1.25e-91)
t_2
(if (<= t 9e-116)
t_1
(if (<= t 1.06e-72)
(* -2.0 (/ (/ x t) z))
(if (<= t 2.7e-55) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * ((x / y) / z);
double t_2 = -2.0 * (x / (z * t));
double tmp;
if (t <= -1.25e-91) {
tmp = t_2;
} else if (t <= 9e-116) {
tmp = t_1;
} else if (t <= 1.06e-72) {
tmp = -2.0 * ((x / t) / z);
} else if (t <= 2.7e-55) {
tmp = t_1;
} else {
tmp = t_2;
}
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
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 2.0d0 * ((x / y) / z)
t_2 = (-2.0d0) * (x / (z * t))
if (t <= (-1.25d-91)) then
tmp = t_2
else if (t <= 9d-116) then
tmp = t_1
else if (t <= 1.06d-72) then
tmp = (-2.0d0) * ((x / t) / z)
else if (t <= 2.7d-55) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * ((x / y) / z);
double t_2 = -2.0 * (x / (z * t));
double tmp;
if (t <= -1.25e-91) {
tmp = t_2;
} else if (t <= 9e-116) {
tmp = t_1;
} else if (t <= 1.06e-72) {
tmp = -2.0 * ((x / t) / z);
} else if (t <= 2.7e-55) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * ((x / y) / z) t_2 = -2.0 * (x / (z * t)) tmp = 0 if t <= -1.25e-91: tmp = t_2 elif t <= 9e-116: tmp = t_1 elif t <= 1.06e-72: tmp = -2.0 * ((x / t) / z) elif t <= 2.7e-55: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(Float64(x / y) / z)) t_2 = Float64(-2.0 * Float64(x / Float64(z * t))) tmp = 0.0 if (t <= -1.25e-91) tmp = t_2; elseif (t <= 9e-116) tmp = t_1; elseif (t <= 1.06e-72) tmp = Float64(-2.0 * Float64(Float64(x / t) / z)); elseif (t <= 2.7e-55) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * ((x / y) / z); t_2 = -2.0 * (x / (z * t)); tmp = 0.0; if (t <= -1.25e-91) tmp = t_2; elseif (t <= 9e-116) tmp = t_1; elseif (t <= 1.06e-72) tmp = -2.0 * ((x / t) / z); elseif (t <= 2.7e-55) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(N[(x / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-2.0 * N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.25e-91], t$95$2, If[LessEqual[t, 9e-116], t$95$1, If[LessEqual[t, 1.06e-72], N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.7e-55], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \frac{\frac{x}{y}}{z}\\
t_2 := -2 \cdot \frac{x}{z \cdot t}\\
\mathbf{if}\;t \leq -1.25 \cdot 10^{-91}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 9 \cdot 10^{-116}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.06 \cdot 10^{-72}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z}\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{-55}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -1.24999999999999999e-91 or 2.70000000000000004e-55 < t Initial program 90.4%
*-commutative90.4%
distribute-rgt-out--93.5%
times-frac89.9%
Simplified89.9%
Taylor expanded in y around 0 78.4%
*-commutative78.4%
Simplified78.4%
if -1.24999999999999999e-91 < t < 9.00000000000000023e-116 or 1.05999999999999994e-72 < t < 2.70000000000000004e-55Initial program 86.2%
*-commutative86.2%
distribute-rgt-out--87.5%
times-frac94.2%
Simplified94.2%
Taylor expanded in y around inf 80.6%
associate-/r*85.2%
Simplified85.2%
if 9.00000000000000023e-116 < t < 1.05999999999999994e-72Initial program 77.5%
*-commutative77.5%
distribute-rgt-out--85.2%
times-frac99.6%
Simplified99.6%
Taylor expanded in y around 0 62.1%
associate-/r*76.7%
Simplified76.7%
Final simplification80.6%
(FPCore (x y z t) :precision binary64 (if (<= y -1.7e-102) (* (/ 2.0 y) (/ x z)) (if (<= y 4.5e+55) (* -2.0 (/ x (* z t))) (* 2.0 (/ (/ x y) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.7e-102) {
tmp = (2.0 / y) * (x / z);
} else if (y <= 4.5e+55) {
tmp = -2.0 * (x / (z * t));
} else {
tmp = 2.0 * ((x / y) / z);
}
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
real(8) :: tmp
if (y <= (-1.7d-102)) then
tmp = (2.0d0 / y) * (x / z)
else if (y <= 4.5d+55) then
tmp = (-2.0d0) * (x / (z * t))
else
tmp = 2.0d0 * ((x / y) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.7e-102) {
tmp = (2.0 / y) * (x / z);
} else if (y <= 4.5e+55) {
tmp = -2.0 * (x / (z * t));
} else {
tmp = 2.0 * ((x / y) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.7e-102: tmp = (2.0 / y) * (x / z) elif y <= 4.5e+55: tmp = -2.0 * (x / (z * t)) else: tmp = 2.0 * ((x / y) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.7e-102) tmp = Float64(Float64(2.0 / y) * Float64(x / z)); elseif (y <= 4.5e+55) tmp = Float64(-2.0 * Float64(x / Float64(z * t))); else tmp = Float64(2.0 * Float64(Float64(x / y) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.7e-102) tmp = (2.0 / y) * (x / z); elseif (y <= 4.5e+55) tmp = -2.0 * (x / (z * t)); else tmp = 2.0 * ((x / y) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.7e-102], N[(N[(2.0 / y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e+55], N[(-2.0 * N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{-102}:\\
\;\;\;\;\frac{2}{y} \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+55}:\\
\;\;\;\;-2 \cdot \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{x}{y}}{z}\\
\end{array}
\end{array}
if y < -1.70000000000000006e-102Initial program 85.3%
*-commutative85.3%
distribute-rgt-out--88.9%
times-frac91.4%
Simplified91.4%
Taylor expanded in y around inf 69.2%
associate-/r*70.0%
Simplified70.0%
associate-*r/70.0%
associate-/l*68.7%
associate-/r/70.0%
*-commutative70.0%
Applied egg-rr70.0%
associate-*r/68.9%
associate-/l*69.9%
associate-/r/71.2%
Simplified71.2%
if -1.70000000000000006e-102 < y < 4.49999999999999998e55Initial program 90.8%
*-commutative90.8%
distribute-rgt-out--93.3%
times-frac93.4%
Simplified93.4%
Taylor expanded in y around 0 80.5%
*-commutative80.5%
Simplified80.5%
if 4.49999999999999998e55 < y Initial program 86.9%
*-commutative86.9%
distribute-rgt-out--89.0%
times-frac89.0%
Simplified89.0%
Taylor expanded in y around inf 76.3%
associate-/r*81.6%
Simplified81.6%
Final simplification77.8%
(FPCore (x y z t) :precision binary64 (if (<= y -1.05e-66) (* (/ 2.0 y) (/ x z)) (if (<= y 4.8e+26) (* (/ x z) (/ -2.0 t)) (* 2.0 (/ (/ x y) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.05e-66) {
tmp = (2.0 / y) * (x / z);
} else if (y <= 4.8e+26) {
tmp = (x / z) * (-2.0 / t);
} else {
tmp = 2.0 * ((x / y) / z);
}
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
real(8) :: tmp
if (y <= (-1.05d-66)) then
tmp = (2.0d0 / y) * (x / z)
else if (y <= 4.8d+26) then
tmp = (x / z) * ((-2.0d0) / t)
else
tmp = 2.0d0 * ((x / y) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.05e-66) {
tmp = (2.0 / y) * (x / z);
} else if (y <= 4.8e+26) {
tmp = (x / z) * (-2.0 / t);
} else {
tmp = 2.0 * ((x / y) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.05e-66: tmp = (2.0 / y) * (x / z) elif y <= 4.8e+26: tmp = (x / z) * (-2.0 / t) else: tmp = 2.0 * ((x / y) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.05e-66) tmp = Float64(Float64(2.0 / y) * Float64(x / z)); elseif (y <= 4.8e+26) tmp = Float64(Float64(x / z) * Float64(-2.0 / t)); else tmp = Float64(2.0 * Float64(Float64(x / y) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.05e-66) tmp = (2.0 / y) * (x / z); elseif (y <= 4.8e+26) tmp = (x / z) * (-2.0 / t); else tmp = 2.0 * ((x / y) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.05e-66], N[(N[(2.0 / y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e+26], N[(N[(x / z), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{-66}:\\
\;\;\;\;\frac{2}{y} \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+26}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{-2}{t}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{x}{y}}{z}\\
\end{array}
\end{array}
if y < -1.05e-66Initial program 86.6%
*-commutative86.6%
distribute-rgt-out--90.4%
times-frac90.8%
Simplified90.8%
Taylor expanded in y around inf 71.1%
associate-/r*70.6%
Simplified70.6%
associate-*r/70.6%
associate-/l*69.3%
associate-/r/70.6%
*-commutative70.6%
Applied egg-rr70.6%
associate-*r/70.7%
associate-/l*70.6%
associate-/r/71.9%
Simplified71.9%
if -1.05e-66 < y < 4.80000000000000009e26Initial program 89.6%
distribute-rgt-out--92.1%
Simplified92.1%
Taylor expanded in y around 0 79.4%
mul-1-neg79.4%
*-commutative79.4%
distribute-rgt-neg-out79.4%
Simplified79.4%
times-frac81.3%
metadata-eval81.3%
frac-2neg81.3%
Applied egg-rr81.3%
if 4.80000000000000009e26 < y Initial program 87.6%
*-commutative87.6%
distribute-rgt-out--89.6%
times-frac89.6%
Simplified89.6%
Taylor expanded in y around inf 75.7%
associate-/r*80.8%
Simplified80.8%
Final simplification78.4%
(FPCore (x y z t) :precision binary64 (if (<= y -2.45e-64) (* (/ 2.0 y) (/ x z)) (if (<= y 4.4e+32) (* (/ x z) (/ -2.0 t)) (/ (/ 2.0 z) (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.45e-64) {
tmp = (2.0 / y) * (x / z);
} else if (y <= 4.4e+32) {
tmp = (x / z) * (-2.0 / t);
} else {
tmp = (2.0 / z) / (y / x);
}
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
real(8) :: tmp
if (y <= (-2.45d-64)) then
tmp = (2.0d0 / y) * (x / z)
else if (y <= 4.4d+32) then
tmp = (x / z) * ((-2.0d0) / t)
else
tmp = (2.0d0 / z) / (y / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.45e-64) {
tmp = (2.0 / y) * (x / z);
} else if (y <= 4.4e+32) {
tmp = (x / z) * (-2.0 / t);
} else {
tmp = (2.0 / z) / (y / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.45e-64: tmp = (2.0 / y) * (x / z) elif y <= 4.4e+32: tmp = (x / z) * (-2.0 / t) else: tmp = (2.0 / z) / (y / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.45e-64) tmp = Float64(Float64(2.0 / y) * Float64(x / z)); elseif (y <= 4.4e+32) tmp = Float64(Float64(x / z) * Float64(-2.0 / t)); else tmp = Float64(Float64(2.0 / z) / Float64(y / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.45e-64) tmp = (2.0 / y) * (x / z); elseif (y <= 4.4e+32) tmp = (x / z) * (-2.0 / t); else tmp = (2.0 / z) / (y / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.45e-64], N[(N[(2.0 / y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.4e+32], N[(N[(x / z), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.45 \cdot 10^{-64}:\\
\;\;\;\;\frac{2}{y} \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+32}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{-2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{z}}{\frac{y}{x}}\\
\end{array}
\end{array}
if y < -2.4500000000000001e-64Initial program 86.6%
*-commutative86.6%
distribute-rgt-out--90.4%
times-frac90.8%
Simplified90.8%
Taylor expanded in y around inf 71.1%
associate-/r*70.6%
Simplified70.6%
associate-*r/70.6%
associate-/l*69.3%
associate-/r/70.6%
*-commutative70.6%
Applied egg-rr70.6%
associate-*r/70.7%
associate-/l*70.6%
associate-/r/71.9%
Simplified71.9%
if -2.4500000000000001e-64 < y < 4.40000000000000002e32Initial program 89.6%
distribute-rgt-out--92.1%
Simplified92.1%
Taylor expanded in y around 0 79.4%
mul-1-neg79.4%
*-commutative79.4%
distribute-rgt-neg-out79.4%
Simplified79.4%
times-frac81.3%
metadata-eval81.3%
frac-2neg81.3%
Applied egg-rr81.3%
if 4.40000000000000002e32 < y Initial program 87.6%
*-commutative87.6%
distribute-rgt-out--89.6%
times-frac89.6%
Simplified89.6%
Taylor expanded in y around inf 75.7%
associate-/r*80.8%
Simplified80.8%
associate-*r/80.8%
associate-/l*80.1%
div-inv80.1%
clear-num80.2%
associate-/r*80.8%
Applied egg-rr80.8%
Final simplification78.4%
(FPCore (x y z t) :precision binary64 (* (/ 2.0 z) (/ x (- y t))))
double code(double x, double y, double z, double t) {
return (2.0 / z) * (x / (y - t));
}
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 = (2.0d0 / z) * (x / (y - t))
end function
public static double code(double x, double y, double z, double t) {
return (2.0 / z) * (x / (y - t));
}
def code(x, y, z, t): return (2.0 / z) * (x / (y - t))
function code(x, y, z, t) return Float64(Float64(2.0 / z) * Float64(x / Float64(y - t))) end
function tmp = code(x, y, z, t) tmp = (2.0 / z) * (x / (y - t)); end
code[x_, y_, z_, t_] := N[(N[(2.0 / z), $MachinePrecision] * N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{z} \cdot \frac{x}{y - t}
\end{array}
Initial program 88.3%
*-commutative88.3%
distribute-rgt-out--91.1%
times-frac91.9%
Simplified91.9%
Final simplification91.9%
(FPCore (x y z t) :precision binary64 (* -2.0 (/ x (* z t))))
double code(double x, double y, double z, double t) {
return -2.0 * (x / (z * t));
}
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 = (-2.0d0) * (x / (z * t))
end function
public static double code(double x, double y, double z, double t) {
return -2.0 * (x / (z * t));
}
def code(x, y, z, t): return -2.0 * (x / (z * t))
function code(x, y, z, t) return Float64(-2.0 * Float64(x / Float64(z * t))) end
function tmp = code(x, y, z, t) tmp = -2.0 * (x / (z * t)); end
code[x_, y_, z_, t_] := N[(-2.0 * N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-2 \cdot \frac{x}{z \cdot t}
\end{array}
Initial program 88.3%
*-commutative88.3%
distribute-rgt-out--91.1%
times-frac91.9%
Simplified91.9%
Taylor expanded in y around 0 56.4%
*-commutative56.4%
Simplified56.4%
Final simplification56.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x (* (- y t) z)) 2.0))
(t_2 (/ (* x 2.0) (- (* y z) (* t z)))))
(if (< t_2 -2.559141628295061e-13)
t_1
(if (< t_2 1.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / ((y - t) * z)) * 2.0;
double t_2 = (x * 2.0) / ((y * z) - (t * z));
double tmp;
if (t_2 < -2.559141628295061e-13) {
tmp = t_1;
} else if (t_2 < 1.045027827330126e-269) {
tmp = ((x / z) * 2.0) / (y - t);
} else {
tmp = t_1;
}
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
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x / ((y - t) * z)) * 2.0d0
t_2 = (x * 2.0d0) / ((y * z) - (t * z))
if (t_2 < (-2.559141628295061d-13)) then
tmp = t_1
else if (t_2 < 1.045027827330126d-269) then
tmp = ((x / z) * 2.0d0) / (y - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / ((y - t) * z)) * 2.0;
double t_2 = (x * 2.0) / ((y * z) - (t * z));
double tmp;
if (t_2 < -2.559141628295061e-13) {
tmp = t_1;
} else if (t_2 < 1.045027827330126e-269) {
tmp = ((x / z) * 2.0) / (y - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / ((y - t) * z)) * 2.0 t_2 = (x * 2.0) / ((y * z) - (t * z)) tmp = 0 if t_2 < -2.559141628295061e-13: tmp = t_1 elif t_2 < 1.045027827330126e-269: tmp = ((x / z) * 2.0) / (y - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / Float64(Float64(y - t) * z)) * 2.0) t_2 = Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z))) tmp = 0.0 if (t_2 < -2.559141628295061e-13) tmp = t_1; elseif (t_2 < 1.045027827330126e-269) tmp = Float64(Float64(Float64(x / z) * 2.0) / Float64(y - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / ((y - t) * z)) * 2.0; t_2 = (x * 2.0) / ((y * z) - (t * z)); tmp = 0.0; if (t_2 < -2.559141628295061e-13) tmp = t_1; elseif (t_2 < 1.045027827330126e-269) tmp = ((x / z) * 2.0) / (y - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / N[(N[(y - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -2.559141628295061e-13], t$95$1, If[Less[t$95$2, 1.045027827330126e-269], N[(N[(N[(x / z), $MachinePrecision] * 2.0), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{\left(y - t\right) \cdot z} \cdot 2\\
t_2 := \frac{x \cdot 2}{y \cdot z - t \cdot z}\\
\mathbf{if}\;t_2 < -2.559141628295061 \cdot 10^{-13}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 < 1.045027827330126 \cdot 10^{-269}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot 2}{y - t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023297
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
:herbie-target
(if (< (/ (* x 2.0) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2.0) (if (< (/ (* x 2.0) (- (* y z) (* t z))) 1.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) (* (/ x (* (- y t) z)) 2.0)))
(/ (* x 2.0) (- (* y z) (* t z))))