
(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 10 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 (- (* y z) (* z t))))
(if (<= t_1 -2e+197)
(* (/ 2.0 z) (/ x (- y t)))
(if (<= t_1 4e+84)
(/ (* 2.0 x) (* z (- y t)))
(/ (/ 2.0 (- y t)) (/ z x))))))
double code(double x, double y, double z, double t) {
double t_1 = (y * z) - (z * t);
double tmp;
if (t_1 <= -2e+197) {
tmp = (2.0 / z) * (x / (y - t));
} else if (t_1 <= 4e+84) {
tmp = (2.0 * x) / (z * (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) :: t_1
real(8) :: tmp
t_1 = (y * z) - (z * t)
if (t_1 <= (-2d+197)) then
tmp = (2.0d0 / z) * (x / (y - t))
else if (t_1 <= 4d+84) then
tmp = (2.0d0 * x) / (z * (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 t_1 = (y * z) - (z * t);
double tmp;
if (t_1 <= -2e+197) {
tmp = (2.0 / z) * (x / (y - t));
} else if (t_1 <= 4e+84) {
tmp = (2.0 * x) / (z * (y - t));
} else {
tmp = (2.0 / (y - t)) / (z / x);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * z) - (z * t) tmp = 0 if t_1 <= -2e+197: tmp = (2.0 / z) * (x / (y - t)) elif t_1 <= 4e+84: tmp = (2.0 * x) / (z * (y - t)) else: tmp = (2.0 / (y - t)) / (z / x) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * z) - Float64(z * t)) tmp = 0.0 if (t_1 <= -2e+197) tmp = Float64(Float64(2.0 / z) * Float64(x / Float64(y - t))); elseif (t_1 <= 4e+84) tmp = Float64(Float64(2.0 * x) / Float64(z * Float64(y - t))); else tmp = Float64(Float64(2.0 / Float64(y - t)) / Float64(z / x)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * z) - (z * t); tmp = 0.0; if (t_1 <= -2e+197) tmp = (2.0 / z) * (x / (y - t)); elseif (t_1 <= 4e+84) tmp = (2.0 * x) / (z * (y - t)); else tmp = (2.0 / (y - t)) / (z / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * z), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+197], N[(N[(2.0 / z), $MachinePrecision] * N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+84], N[(N[(2.0 * x), $MachinePrecision] / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot z - z \cdot t\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+197}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y - t}\\
\mathbf{elif}\;t_1 \leq 4 \cdot 10^{+84}:\\
\;\;\;\;\frac{2 \cdot x}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{y - t}}{\frac{z}{x}}\\
\end{array}
\end{array}
if (-.f64 (*.f64 y z) (*.f64 t z)) < -1.9999999999999999e197Initial program 79.1%
*-commutative79.1%
distribute-rgt-out--79.1%
times-frac99.8%
Simplified99.8%
if -1.9999999999999999e197 < (-.f64 (*.f64 y z) (*.f64 t z)) < 4.00000000000000023e84Initial program 97.6%
distribute-rgt-out--98.4%
Simplified98.4%
if 4.00000000000000023e84 < (-.f64 (*.f64 y z) (*.f64 t z)) Initial program 78.8%
*-commutative78.8%
associate-*r/78.8%
distribute-rgt-out--85.7%
associate-/r*99.6%
Simplified99.6%
associate-*r/99.7%
*-commutative99.7%
associate-*r/99.7%
clear-num99.7%
associate-*l/99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.2e+40) (not (<= z 1.28e+104))) (* 2.0 (/ (/ x z) (- y t))) (* x (/ (/ 2.0 (- y t)) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e+40) || !(z <= 1.28e+104)) {
tmp = 2.0 * ((x / z) / (y - t));
} else {
tmp = x * ((2.0 / (y - t)) / 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 ((z <= (-5.2d+40)) .or. (.not. (z <= 1.28d+104))) then
tmp = 2.0d0 * ((x / z) / (y - t))
else
tmp = x * ((2.0d0 / (y - t)) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e+40) || !(z <= 1.28e+104)) {
tmp = 2.0 * ((x / z) / (y - t));
} else {
tmp = x * ((2.0 / (y - t)) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.2e+40) or not (z <= 1.28e+104): tmp = 2.0 * ((x / z) / (y - t)) else: tmp = x * ((2.0 / (y - t)) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.2e+40) || !(z <= 1.28e+104)) tmp = Float64(2.0 * Float64(Float64(x / z) / Float64(y - t))); else tmp = Float64(x * Float64(Float64(2.0 / Float64(y - t)) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.2e+40) || ~((z <= 1.28e+104))) tmp = 2.0 * ((x / z) / (y - t)); else tmp = x * ((2.0 / (y - t)) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.2e+40], N[Not[LessEqual[z, 1.28e+104]], $MachinePrecision]], N[(2.0 * N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+40} \lor \neg \left(z \leq 1.28 \cdot 10^{+104}\right):\\
\;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{2}{y - t}}{z}\\
\end{array}
\end{array}
if z < -5.2000000000000001e40 or 1.27999999999999997e104 < z Initial program 77.6%
*-commutative77.6%
associate-*r/77.6%
distribute-rgt-out--83.0%
associate-/r*98.7%
Simplified98.7%
if -5.2000000000000001e40 < z < 1.27999999999999997e104Initial program 96.6%
*-commutative96.6%
associate-*r/97.2%
distribute-rgt-out--97.9%
associate-/r*86.3%
Simplified86.3%
Taylor expanded in x around 0 97.9%
*-commutative97.9%
associate-*l/97.3%
times-frac86.3%
associate-*l/89.7%
associate-*r/97.9%
Simplified97.9%
Final simplification98.2%
(FPCore (x y z t) :precision binary64 (if (<= z -1.22e-192) (* (/ 2.0 z) (/ x (- y t))) (if (<= z 2e+104) (* x (/ (/ 2.0 (- y t)) z)) (* 2.0 (/ (/ x z) (- y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.22e-192) {
tmp = (2.0 / z) * (x / (y - t));
} else if (z <= 2e+104) {
tmp = x * ((2.0 / (y - t)) / z);
} else {
tmp = 2.0 * ((x / z) / (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) :: tmp
if (z <= (-1.22d-192)) then
tmp = (2.0d0 / z) * (x / (y - t))
else if (z <= 2d+104) then
tmp = x * ((2.0d0 / (y - t)) / z)
else
tmp = 2.0d0 * ((x / z) / (y - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.22e-192) {
tmp = (2.0 / z) * (x / (y - t));
} else if (z <= 2e+104) {
tmp = x * ((2.0 / (y - t)) / z);
} else {
tmp = 2.0 * ((x / z) / (y - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.22e-192: tmp = (2.0 / z) * (x / (y - t)) elif z <= 2e+104: tmp = x * ((2.0 / (y - t)) / z) else: tmp = 2.0 * ((x / z) / (y - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.22e-192) tmp = Float64(Float64(2.0 / z) * Float64(x / Float64(y - t))); elseif (z <= 2e+104) tmp = Float64(x * Float64(Float64(2.0 / Float64(y - t)) / z)); else tmp = Float64(2.0 * Float64(Float64(x / z) / Float64(y - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.22e-192) tmp = (2.0 / z) * (x / (y - t)); elseif (z <= 2e+104) tmp = x * ((2.0 / (y - t)) / z); else tmp = 2.0 * ((x / z) / (y - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.22e-192], N[(N[(2.0 / z), $MachinePrecision] * N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e+104], N[(x * N[(N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.22 \cdot 10^{-192}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y - t}\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+104}:\\
\;\;\;\;x \cdot \frac{\frac{2}{y - t}}{z}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\
\end{array}
\end{array}
if z < -1.22000000000000002e-192Initial program 86.9%
*-commutative86.9%
distribute-rgt-out--90.1%
times-frac99.0%
Simplified99.0%
if -1.22000000000000002e-192 < z < 2e104Initial program 96.5%
*-commutative96.5%
associate-*r/97.3%
distribute-rgt-out--98.1%
associate-/r*86.7%
Simplified86.7%
Taylor expanded in x around 0 98.1%
*-commutative98.1%
associate-*l/97.4%
times-frac86.6%
associate-*l/87.2%
associate-*r/98.0%
Simplified98.0%
if 2e104 < z Initial program 73.2%
*-commutative73.2%
associate-*r/73.2%
distribute-rgt-out--79.0%
associate-/r*97.2%
Simplified97.2%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.8e-38) (not (<= t 2e-83))) (* -2.0 (/ x (* z t))) (* x (/ 2.0 (* y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.8e-38) || !(t <= 2e-83)) {
tmp = -2.0 * (x / (z * t));
} else {
tmp = x * (2.0 / (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 ((t <= (-7.8d-38)) .or. (.not. (t <= 2d-83))) then
tmp = (-2.0d0) * (x / (z * t))
else
tmp = x * (2.0d0 / (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.8e-38) || !(t <= 2e-83)) {
tmp = -2.0 * (x / (z * t));
} else {
tmp = x * (2.0 / (y * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7.8e-38) or not (t <= 2e-83): tmp = -2.0 * (x / (z * t)) else: tmp = x * (2.0 / (y * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.8e-38) || !(t <= 2e-83)) tmp = Float64(-2.0 * Float64(x / Float64(z * t))); else tmp = Float64(x * Float64(2.0 / Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -7.8e-38) || ~((t <= 2e-83))) tmp = -2.0 * (x / (z * t)); else tmp = x * (2.0 / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7.8e-38], N[Not[LessEqual[t, 2e-83]], $MachinePrecision]], N[(-2.0 * N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(2.0 / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.8 \cdot 10^{-38} \lor \neg \left(t \leq 2 \cdot 10^{-83}\right):\\
\;\;\;\;-2 \cdot \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{2}{y \cdot z}\\
\end{array}
\end{array}
if t < -7.7999999999999998e-38 or 2.0000000000000001e-83 < t Initial program 85.8%
*-commutative85.8%
associate-*r/86.4%
distribute-rgt-out--89.6%
associate-/r*91.4%
Simplified91.4%
Taylor expanded in y around 0 76.7%
if -7.7999999999999998e-38 < t < 2.0000000000000001e-83Initial program 95.7%
*-commutative95.7%
associate-*r/95.7%
distribute-rgt-out--96.8%
associate-/r*90.2%
Simplified90.2%
Taylor expanded in x around 0 96.8%
*-commutative96.8%
associate-*l/96.8%
times-frac90.1%
associate-*l/92.7%
associate-*r/96.7%
Simplified96.7%
Taylor expanded in y around inf 85.1%
Final simplification79.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.8e-35) (not (<= t 4.1e-83))) (* -2.0 (/ x (* z t))) (* x (/ (/ 2.0 y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.8e-35) || !(t <= 4.1e-83)) {
tmp = -2.0 * (x / (z * t));
} else {
tmp = x * ((2.0 / 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 ((t <= (-2.8d-35)) .or. (.not. (t <= 4.1d-83))) then
tmp = (-2.0d0) * (x / (z * t))
else
tmp = x * ((2.0d0 / y) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.8e-35) || !(t <= 4.1e-83)) {
tmp = -2.0 * (x / (z * t));
} else {
tmp = x * ((2.0 / y) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.8e-35) or not (t <= 4.1e-83): tmp = -2.0 * (x / (z * t)) else: tmp = x * ((2.0 / y) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.8e-35) || !(t <= 4.1e-83)) tmp = Float64(-2.0 * Float64(x / Float64(z * t))); else tmp = Float64(x * Float64(Float64(2.0 / y) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.8e-35) || ~((t <= 4.1e-83))) tmp = -2.0 * (x / (z * t)); else tmp = x * ((2.0 / y) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.8e-35], N[Not[LessEqual[t, 4.1e-83]], $MachinePrecision]], N[(-2.0 * N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(2.0 / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{-35} \lor \neg \left(t \leq 4.1 \cdot 10^{-83}\right):\\
\;\;\;\;-2 \cdot \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{2}{y}}{z}\\
\end{array}
\end{array}
if t < -2.8e-35 or 4.1e-83 < t Initial program 85.8%
*-commutative85.8%
associate-*r/86.4%
distribute-rgt-out--89.6%
associate-/r*91.4%
Simplified91.4%
Taylor expanded in y around 0 76.7%
if -2.8e-35 < t < 4.1e-83Initial program 95.7%
*-commutative95.7%
associate-*r/95.7%
distribute-rgt-out--96.8%
associate-/r*90.2%
Simplified90.2%
Taylor expanded in x around 0 96.8%
*-commutative96.8%
associate-*l/96.8%
times-frac90.1%
associate-*l/92.7%
associate-*r/96.7%
Simplified96.7%
Taylor expanded in y around inf 85.1%
associate-/r*85.1%
Simplified85.1%
Final simplification79.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.6e-39) (not (<= t 4.1e-83))) (/ -2.0 (* z (/ t x))) (* x (/ (/ 2.0 y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.6e-39) || !(t <= 4.1e-83)) {
tmp = -2.0 / (z * (t / x));
} else {
tmp = x * ((2.0 / 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 ((t <= (-5.6d-39)) .or. (.not. (t <= 4.1d-83))) then
tmp = (-2.0d0) / (z * (t / x))
else
tmp = x * ((2.0d0 / y) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.6e-39) || !(t <= 4.1e-83)) {
tmp = -2.0 / (z * (t / x));
} else {
tmp = x * ((2.0 / y) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.6e-39) or not (t <= 4.1e-83): tmp = -2.0 / (z * (t / x)) else: tmp = x * ((2.0 / y) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.6e-39) || !(t <= 4.1e-83)) tmp = Float64(-2.0 / Float64(z * Float64(t / x))); else tmp = Float64(x * Float64(Float64(2.0 / y) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.6e-39) || ~((t <= 4.1e-83))) tmp = -2.0 / (z * (t / x)); else tmp = x * ((2.0 / y) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.6e-39], N[Not[LessEqual[t, 4.1e-83]], $MachinePrecision]], N[(-2.0 / N[(z * N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(2.0 / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{-39} \lor \neg \left(t \leq 4.1 \cdot 10^{-83}\right):\\
\;\;\;\;\frac{-2}{z \cdot \frac{t}{x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{2}{y}}{z}\\
\end{array}
\end{array}
if t < -5.6000000000000003e-39 or 4.1e-83 < t Initial program 85.8%
*-commutative85.8%
associate-*r/86.4%
distribute-rgt-out--89.6%
associate-/r*91.4%
Simplified91.4%
Taylor expanded in y around 0 76.7%
clear-num75.4%
un-div-inv75.4%
*-un-lft-identity75.4%
*-commutative75.4%
times-frac78.8%
add-sqr-sqrt39.0%
sqrt-unprod44.7%
sqr-neg44.7%
sqrt-unprod16.5%
add-sqr-sqrt27.5%
associate-/r/27.5%
clear-num27.4%
div-inv27.5%
clear-num27.5%
add-sqr-sqrt16.5%
sqrt-unprod44.7%
sqr-neg44.7%
sqrt-unprod39.0%
add-sqr-sqrt78.8%
Applied egg-rr78.8%
if -5.6000000000000003e-39 < t < 4.1e-83Initial program 95.7%
*-commutative95.7%
associate-*r/95.7%
distribute-rgt-out--96.8%
associate-/r*90.2%
Simplified90.2%
Taylor expanded in x around 0 96.8%
*-commutative96.8%
associate-*l/96.8%
times-frac90.1%
associate-*l/92.7%
associate-*r/96.7%
Simplified96.7%
Taylor expanded in y around inf 85.1%
associate-/r*85.1%
Simplified85.1%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.2e-33) (not (<= t 3.7e-83))) (/ -2.0 (* z (/ t x))) (/ (* 2.0 x) (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.2e-33) || !(t <= 3.7e-83)) {
tmp = -2.0 / (z * (t / x));
} 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 ((t <= (-2.2d-33)) .or. (.not. (t <= 3.7d-83))) then
tmp = (-2.0d0) / (z * (t / x))
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 ((t <= -2.2e-33) || !(t <= 3.7e-83)) {
tmp = -2.0 / (z * (t / x));
} else {
tmp = (2.0 * x) / (y * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.2e-33) or not (t <= 3.7e-83): tmp = -2.0 / (z * (t / x)) else: tmp = (2.0 * x) / (y * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.2e-33) || !(t <= 3.7e-83)) tmp = Float64(-2.0 / Float64(z * Float64(t / x))); else tmp = Float64(Float64(2.0 * x) / Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.2e-33) || ~((t <= 3.7e-83))) tmp = -2.0 / (z * (t / x)); else tmp = (2.0 * x) / (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.2e-33], N[Not[LessEqual[t, 3.7e-83]], $MachinePrecision]], N[(-2.0 / N[(z * N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * x), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{-33} \lor \neg \left(t \leq 3.7 \cdot 10^{-83}\right):\\
\;\;\;\;\frac{-2}{z \cdot \frac{t}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot x}{y \cdot z}\\
\end{array}
\end{array}
if t < -2.20000000000000005e-33 or 3.69999999999999995e-83 < t Initial program 85.8%
*-commutative85.8%
associate-*r/86.4%
distribute-rgt-out--89.6%
associate-/r*91.4%
Simplified91.4%
Taylor expanded in y around 0 76.7%
clear-num75.4%
un-div-inv75.4%
*-un-lft-identity75.4%
*-commutative75.4%
times-frac78.8%
add-sqr-sqrt39.0%
sqrt-unprod44.7%
sqr-neg44.7%
sqrt-unprod16.5%
add-sqr-sqrt27.5%
associate-/r/27.5%
clear-num27.4%
div-inv27.5%
clear-num27.5%
add-sqr-sqrt16.5%
sqrt-unprod44.7%
sqr-neg44.7%
sqrt-unprod39.0%
add-sqr-sqrt78.8%
Applied egg-rr78.8%
if -2.20000000000000005e-33 < t < 3.69999999999999995e-83Initial program 95.7%
distribute-rgt-out--96.8%
Simplified96.8%
Taylor expanded in y around inf 85.1%
*-commutative85.1%
Simplified85.1%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (<= t -9.8e-26) (* (/ x z) (/ -2.0 t)) (if (<= t 3.3e-83) (* x (/ (/ 2.0 y) z)) (* -2.0 (/ x (* z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9.8e-26) {
tmp = (x / z) * (-2.0 / t);
} else if (t <= 3.3e-83) {
tmp = x * ((2.0 / y) / z);
} else {
tmp = -2.0 * (x / (z * 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) :: tmp
if (t <= (-9.8d-26)) then
tmp = (x / z) * ((-2.0d0) / t)
else if (t <= 3.3d-83) then
tmp = x * ((2.0d0 / y) / z)
else
tmp = (-2.0d0) * (x / (z * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9.8e-26) {
tmp = (x / z) * (-2.0 / t);
} else if (t <= 3.3e-83) {
tmp = x * ((2.0 / y) / z);
} else {
tmp = -2.0 * (x / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -9.8e-26: tmp = (x / z) * (-2.0 / t) elif t <= 3.3e-83: tmp = x * ((2.0 / y) / z) else: tmp = -2.0 * (x / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -9.8e-26) tmp = Float64(Float64(x / z) * Float64(-2.0 / t)); elseif (t <= 3.3e-83) tmp = Float64(x * Float64(Float64(2.0 / y) / z)); else tmp = Float64(-2.0 * Float64(x / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -9.8e-26) tmp = (x / z) * (-2.0 / t); elseif (t <= 3.3e-83) tmp = x * ((2.0 / y) / z); else tmp = -2.0 * (x / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -9.8e-26], N[(N[(x / z), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.3e-83], N[(x * N[(N[(2.0 / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.8 \cdot 10^{-26}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{-2}{t}\\
\mathbf{elif}\;t \leq 3.3 \cdot 10^{-83}:\\
\;\;\;\;x \cdot \frac{\frac{2}{y}}{z}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if t < -9.7999999999999998e-26Initial program 84.3%
*-commutative84.3%
associate-*r/84.3%
distribute-rgt-out--88.8%
associate-/r*94.2%
Simplified94.2%
Taylor expanded in y around 0 76.4%
associate-*r/76.5%
*-commutative76.5%
*-commutative76.5%
times-frac77.6%
Simplified77.6%
if -9.7999999999999998e-26 < t < 3.2999999999999999e-83Initial program 95.7%
*-commutative95.7%
associate-*r/95.7%
distribute-rgt-out--96.8%
associate-/r*90.2%
Simplified90.2%
Taylor expanded in x around 0 96.8%
*-commutative96.8%
associate-*l/96.8%
times-frac90.1%
associate-*l/92.7%
associate-*r/96.7%
Simplified96.7%
Taylor expanded in y around inf 85.1%
associate-/r*85.1%
Simplified85.1%
if 3.2999999999999999e-83 < t Initial program 86.9%
*-commutative86.9%
associate-*r/88.0%
distribute-rgt-out--90.2%
associate-/r*89.3%
Simplified89.3%
Taylor expanded in y around 0 76.9%
Final simplification80.2%
(FPCore (x y z t) :precision binary64 (* 2.0 (/ (/ x z) (- y t))))
double code(double x, double y, double z, double t) {
return 2.0 * ((x / z) / (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 * ((x / z) / (y - t))
end function
public static double code(double x, double y, double z, double t) {
return 2.0 * ((x / z) / (y - t));
}
def code(x, y, z, t): return 2.0 * ((x / z) / (y - t))
function code(x, y, z, t) return Float64(2.0 * Float64(Float64(x / z) / Float64(y - t))) end
function tmp = code(x, y, z, t) tmp = 2.0 * ((x / z) / (y - t)); end
code[x_, y_, z_, t_] := N[(2.0 * N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \frac{\frac{x}{z}}{y - t}
\end{array}
Initial program 89.6%
*-commutative89.6%
associate-*r/89.9%
distribute-rgt-out--92.4%
associate-/r*90.9%
Simplified90.9%
Final simplification90.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 89.6%
*-commutative89.6%
associate-*r/89.9%
distribute-rgt-out--92.4%
associate-/r*90.9%
Simplified90.9%
Taylor expanded in y around 0 54.5%
Final simplification54.5%
(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 2023320
(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))))