
(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 9 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 (or (<= t_1 -100000.0) (not (<= t_1 2e-150)))
(/ (/ 2.0 z) (/ (- y t) x))
(* 2.0 (/ (/ x z) (- 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 <= -100000.0) || !(t_1 <= 2e-150)) {
tmp = (2.0 / z) / ((y - t) / x);
} 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) :: t_1
real(8) :: tmp
t_1 = (x * 2.0d0) / ((y * z) - (z * t))
if ((t_1 <= (-100000.0d0)) .or. (.not. (t_1 <= 2d-150))) then
tmp = (2.0d0 / z) / ((y - t) / x)
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 t_1 = (x * 2.0) / ((y * z) - (z * t));
double tmp;
if ((t_1 <= -100000.0) || !(t_1 <= 2e-150)) {
tmp = (2.0 / z) / ((y - t) / x);
} else {
tmp = 2.0 * ((x / z) / (y - t));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 2.0) / ((y * z) - (z * t)) tmp = 0 if (t_1 <= -100000.0) or not (t_1 <= 2e-150): tmp = (2.0 / z) / ((y - t) / x) else: tmp = 2.0 * ((x / z) / (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 <= -100000.0) || !(t_1 <= 2e-150)) tmp = Float64(Float64(2.0 / z) / Float64(Float64(y - t) / x)); else tmp = Float64(2.0 * Float64(Float64(x / z) / 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 <= -100000.0) || ~((t_1 <= 2e-150))) tmp = (2.0 / z) / ((y - t) / x); else tmp = 2.0 * ((x / z) / (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[Or[LessEqual[t$95$1, -100000.0], N[Not[LessEqual[t$95$1, 2e-150]], $MachinePrecision]], N[(N[(2.0 / z), $MachinePrecision] / N[(N[(y - t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x / z), $MachinePrecision] / 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 -100000 \lor \neg \left(t_1 \leq 2 \cdot 10^{-150}\right):\\
\;\;\;\;\frac{\frac{2}{z}}{\frac{y - t}{x}}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) < -1e5 or 2.00000000000000001e-150 < (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) Initial program 88.3%
*-commutative88.3%
associate-*r/88.3%
distribute-rgt-out--92.9%
associate-/r*86.6%
Simplified86.6%
associate-/r*92.9%
associate-*r/92.9%
frac-times96.7%
clear-num96.7%
un-div-inv97.1%
Applied egg-rr97.1%
if -1e5 < (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) < 2.00000000000000001e-150Initial program 87.1%
*-commutative87.1%
associate-*r/87.1%
distribute-rgt-out--87.1%
associate-/r*98.1%
Simplified98.1%
Final simplification97.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (* x 2.0) -4e+51) (not (<= (* x 2.0) 1e-58))) (* (/ 2.0 z) (/ x (- y t))) (* 2.0 (/ (/ x z) (- y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x * 2.0) <= -4e+51) || !((x * 2.0) <= 1e-58)) {
tmp = (2.0 / z) * (x / (y - t));
} 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 (((x * 2.0d0) <= (-4d+51)) .or. (.not. ((x * 2.0d0) <= 1d-58))) then
tmp = (2.0d0 / z) * (x / (y - t))
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 (((x * 2.0) <= -4e+51) || !((x * 2.0) <= 1e-58)) {
tmp = (2.0 / z) * (x / (y - t));
} else {
tmp = 2.0 * ((x / z) / (y - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x * 2.0) <= -4e+51) or not ((x * 2.0) <= 1e-58): tmp = (2.0 / z) * (x / (y - t)) else: tmp = 2.0 * ((x / z) / (y - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x * 2.0) <= -4e+51) || !(Float64(x * 2.0) <= 1e-58)) tmp = Float64(Float64(2.0 / z) * Float64(x / Float64(y - t))); 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 (((x * 2.0) <= -4e+51) || ~(((x * 2.0) <= 1e-58))) tmp = (2.0 / z) * (x / (y - t)); else tmp = 2.0 * ((x / z) / (y - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x * 2.0), $MachinePrecision], -4e+51], N[Not[LessEqual[N[(x * 2.0), $MachinePrecision], 1e-58]], $MachinePrecision]], N[(N[(2.0 / z), $MachinePrecision] * N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 2 \leq -4 \cdot 10^{+51} \lor \neg \left(x \cdot 2 \leq 10^{-58}\right):\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y - t}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\
\end{array}
\end{array}
if (*.f64 x 2) < -4e51 or 1e-58 < (*.f64 x 2) Initial program 84.1%
*-commutative84.1%
distribute-rgt-out--86.5%
times-frac97.4%
Simplified97.4%
if -4e51 < (*.f64 x 2) < 1e-58Initial program 91.8%
*-commutative91.8%
associate-*r/91.8%
distribute-rgt-out--94.4%
associate-/r*97.6%
Simplified97.6%
Final simplification97.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.32e-101) (not (<= t 2.8e-29))) (* (/ -2.0 z) (/ x t)) (* (/ 2.0 z) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.32e-101) || !(t <= 2.8e-29)) {
tmp = (-2.0 / z) * (x / t);
} else {
tmp = (2.0 / z) * (x / y);
}
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 <= (-1.32d-101)) .or. (.not. (t <= 2.8d-29))) then
tmp = ((-2.0d0) / z) * (x / t)
else
tmp = (2.0d0 / z) * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.32e-101) || !(t <= 2.8e-29)) {
tmp = (-2.0 / z) * (x / t);
} else {
tmp = (2.0 / z) * (x / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.32e-101) or not (t <= 2.8e-29): tmp = (-2.0 / z) * (x / t) else: tmp = (2.0 / z) * (x / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.32e-101) || !(t <= 2.8e-29)) tmp = Float64(Float64(-2.0 / z) * Float64(x / t)); else tmp = Float64(Float64(2.0 / z) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.32e-101) || ~((t <= 2.8e-29))) tmp = (-2.0 / z) * (x / t); else tmp = (2.0 / z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.32e-101], N[Not[LessEqual[t, 2.8e-29]], $MachinePrecision]], N[(N[(-2.0 / z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.32 \cdot 10^{-101} \lor \neg \left(t \leq 2.8 \cdot 10^{-29}\right):\\
\;\;\;\;\frac{-2}{z} \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if t < -1.32e-101 or 2.8000000000000002e-29 < t Initial program 88.7%
*-commutative88.7%
associate-*r/88.7%
distribute-rgt-out--90.8%
associate-/r*90.4%
Simplified90.4%
associate-/r*90.8%
associate-*r/90.8%
frac-times93.0%
clear-num93.0%
un-div-inv93.1%
Applied egg-rr93.1%
Taylor expanded in y around 0 74.7%
associate-*r/74.7%
*-commutative74.7%
times-frac75.7%
Simplified75.7%
if -1.32e-101 < t < 2.8000000000000002e-29Initial program 86.4%
*-commutative86.4%
associate-*r/86.3%
distribute-rgt-out--89.5%
associate-/r*94.2%
Simplified94.2%
Taylor expanded in y around inf 74.7%
associate-*r/74.7%
*-commutative74.7%
times-frac80.0%
Simplified80.0%
Final simplification77.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.16e-100) (not (<= t 5.6e-31))) (/ -2.0 (* z (/ t x))) (* (/ 2.0 z) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.16e-100) || !(t <= 5.6e-31)) {
tmp = -2.0 / (z * (t / x));
} else {
tmp = (2.0 / z) * (x / y);
}
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 <= (-1.16d-100)) .or. (.not. (t <= 5.6d-31))) then
tmp = (-2.0d0) / (z * (t / x))
else
tmp = (2.0d0 / z) * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.16e-100) || !(t <= 5.6e-31)) {
tmp = -2.0 / (z * (t / x));
} else {
tmp = (2.0 / z) * (x / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.16e-100) or not (t <= 5.6e-31): tmp = -2.0 / (z * (t / x)) else: tmp = (2.0 / z) * (x / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.16e-100) || !(t <= 5.6e-31)) tmp = Float64(-2.0 / Float64(z * Float64(t / x))); else tmp = Float64(Float64(2.0 / z) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.16e-100) || ~((t <= 5.6e-31))) tmp = -2.0 / (z * (t / x)); else tmp = (2.0 / z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.16e-100], N[Not[LessEqual[t, 5.6e-31]], $MachinePrecision]], N[(-2.0 / N[(z * N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.16 \cdot 10^{-100} \lor \neg \left(t \leq 5.6 \cdot 10^{-31}\right):\\
\;\;\;\;\frac{-2}{z \cdot \frac{t}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if t < -1.16e-100 or 5.5999999999999998e-31 < t Initial program 88.7%
*-commutative88.7%
associate-*r/88.7%
distribute-rgt-out--90.8%
associate-/r*90.4%
Simplified90.4%
associate-/r*90.8%
associate-*r/90.8%
frac-times93.0%
clear-num93.0%
un-div-inv93.1%
Applied egg-rr93.1%
Taylor expanded in y around 0 74.7%
associate-*r/74.7%
*-commutative74.7%
times-frac75.7%
Simplified75.7%
*-commutative75.7%
clear-num75.7%
frac-times75.8%
metadata-eval75.8%
Applied egg-rr75.8%
if -1.16e-100 < t < 5.5999999999999998e-31Initial program 86.4%
*-commutative86.4%
associate-*r/86.3%
distribute-rgt-out--89.5%
associate-/r*94.2%
Simplified94.2%
Taylor expanded in y around inf 74.7%
associate-*r/74.7%
*-commutative74.7%
times-frac80.0%
Simplified80.0%
Final simplification77.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -8.8e-101) (not (<= t 7e-111))) (/ (/ -2.0 t) (/ z x)) (* (/ 2.0 z) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8.8e-101) || !(t <= 7e-111)) {
tmp = (-2.0 / t) / (z / x);
} else {
tmp = (2.0 / z) * (x / y);
}
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 <= (-8.8d-101)) .or. (.not. (t <= 7d-111))) then
tmp = ((-2.0d0) / t) / (z / x)
else
tmp = (2.0d0 / z) * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8.8e-101) || !(t <= 7e-111)) {
tmp = (-2.0 / t) / (z / x);
} else {
tmp = (2.0 / z) * (x / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -8.8e-101) or not (t <= 7e-111): tmp = (-2.0 / t) / (z / x) else: tmp = (2.0 / z) * (x / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -8.8e-101) || !(t <= 7e-111)) tmp = Float64(Float64(-2.0 / t) / Float64(z / x)); else tmp = Float64(Float64(2.0 / z) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -8.8e-101) || ~((t <= 7e-111))) tmp = (-2.0 / t) / (z / x); else tmp = (2.0 / z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -8.8e-101], N[Not[LessEqual[t, 7e-111]], $MachinePrecision]], N[(N[(-2.0 / t), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.8 \cdot 10^{-101} \lor \neg \left(t \leq 7 \cdot 10^{-111}\right):\\
\;\;\;\;\frac{\frac{-2}{t}}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if t < -8.7999999999999996e-101 or 7.0000000000000001e-111 < t Initial program 89.3%
*-commutative89.3%
associate-*r/89.2%
distribute-rgt-out--91.1%
associate-/r*90.9%
Simplified90.9%
associate-*r/90.9%
*-commutative90.9%
associate-*r/90.8%
clear-num90.7%
associate-*l/91.6%
*-un-lft-identity91.6%
Applied egg-rr91.6%
Taylor expanded in y around 0 76.8%
if -8.7999999999999996e-101 < t < 7.0000000000000001e-111Initial program 84.8%
*-commutative84.8%
associate-*r/84.8%
distribute-rgt-out--88.5%
associate-/r*93.9%
Simplified93.9%
Taylor expanded in y around inf 77.7%
associate-*r/77.8%
*-commutative77.8%
times-frac83.9%
Simplified83.9%
Final simplification79.2%
(FPCore (x y z t) :precision binary64 (if (<= t -1.2e-100) (/ -2.0 (/ t (/ x z))) (if (<= t 4.6e-27) (* (/ 2.0 z) (/ x y)) (/ -2.0 (* z (/ t x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.2e-100) {
tmp = -2.0 / (t / (x / z));
} else if (t <= 4.6e-27) {
tmp = (2.0 / z) * (x / y);
} else {
tmp = -2.0 / (z * (t / 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 (t <= (-1.2d-100)) then
tmp = (-2.0d0) / (t / (x / z))
else if (t <= 4.6d-27) then
tmp = (2.0d0 / z) * (x / y)
else
tmp = (-2.0d0) / (z * (t / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.2e-100) {
tmp = -2.0 / (t / (x / z));
} else if (t <= 4.6e-27) {
tmp = (2.0 / z) * (x / y);
} else {
tmp = -2.0 / (z * (t / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.2e-100: tmp = -2.0 / (t / (x / z)) elif t <= 4.6e-27: tmp = (2.0 / z) * (x / y) else: tmp = -2.0 / (z * (t / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.2e-100) tmp = Float64(-2.0 / Float64(t / Float64(x / z))); elseif (t <= 4.6e-27) tmp = Float64(Float64(2.0 / z) * Float64(x / y)); else tmp = Float64(-2.0 / Float64(z * Float64(t / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.2e-100) tmp = -2.0 / (t / (x / z)); elseif (t <= 4.6e-27) tmp = (2.0 / z) * (x / y); else tmp = -2.0 / (z * (t / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.2e-100], N[(-2.0 / N[(t / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.6e-27], N[(N[(2.0 / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 / N[(z * N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{-100}:\\
\;\;\;\;\frac{-2}{\frac{t}{\frac{x}{z}}}\\
\mathbf{elif}\;t \leq 4.6 \cdot 10^{-27}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{z \cdot \frac{t}{x}}\\
\end{array}
\end{array}
if t < -1.2000000000000001e-100Initial program 87.1%
*-commutative87.1%
associate-*r/87.1%
distribute-rgt-out--89.6%
associate-/r*88.3%
Simplified88.3%
associate-/r*89.6%
associate-*r/89.6%
frac-times90.8%
clear-num90.8%
un-div-inv90.9%
Applied egg-rr90.9%
Taylor expanded in y around 0 71.7%
associate-*r/71.7%
*-commutative71.7%
times-frac71.7%
Simplified71.7%
frac-times71.7%
*-commutative71.7%
associate-/l*70.9%
associate-/l*74.0%
Applied egg-rr74.0%
if -1.2000000000000001e-100 < t < 4.5999999999999999e-27Initial program 86.4%
*-commutative86.4%
associate-*r/86.3%
distribute-rgt-out--89.5%
associate-/r*94.2%
Simplified94.2%
Taylor expanded in y around inf 74.7%
associate-*r/74.7%
*-commutative74.7%
times-frac80.0%
Simplified80.0%
if 4.5999999999999999e-27 < t Initial program 90.6%
*-commutative90.6%
associate-*r/90.6%
distribute-rgt-out--92.2%
associate-/r*93.0%
Simplified93.0%
associate-/r*92.2%
associate-*r/92.2%
frac-times95.6%
clear-num95.6%
un-div-inv95.6%
Applied egg-rr95.6%
Taylor expanded in y around 0 78.2%
associate-*r/78.2%
*-commutative78.2%
times-frac80.5%
Simplified80.5%
*-commutative80.5%
clear-num80.4%
frac-times80.5%
metadata-eval80.5%
Applied egg-rr80.5%
Final simplification78.2%
(FPCore (x y z t) :precision binary64 (if (<= t -9.9e-101) (/ (* x (/ -2.0 z)) t) (if (<= t 2.2e-24) (* (/ 2.0 z) (/ x y)) (/ -2.0 (* z (/ t x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9.9e-101) {
tmp = (x * (-2.0 / z)) / t;
} else if (t <= 2.2e-24) {
tmp = (2.0 / z) * (x / y);
} else {
tmp = -2.0 / (z * (t / 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 (t <= (-9.9d-101)) then
tmp = (x * ((-2.0d0) / z)) / t
else if (t <= 2.2d-24) then
tmp = (2.0d0 / z) * (x / y)
else
tmp = (-2.0d0) / (z * (t / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9.9e-101) {
tmp = (x * (-2.0 / z)) / t;
} else if (t <= 2.2e-24) {
tmp = (2.0 / z) * (x / y);
} else {
tmp = -2.0 / (z * (t / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -9.9e-101: tmp = (x * (-2.0 / z)) / t elif t <= 2.2e-24: tmp = (2.0 / z) * (x / y) else: tmp = -2.0 / (z * (t / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -9.9e-101) tmp = Float64(Float64(x * Float64(-2.0 / z)) / t); elseif (t <= 2.2e-24) tmp = Float64(Float64(2.0 / z) * Float64(x / y)); else tmp = Float64(-2.0 / Float64(z * Float64(t / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -9.9e-101) tmp = (x * (-2.0 / z)) / t; elseif (t <= 2.2e-24) tmp = (2.0 / z) * (x / y); else tmp = -2.0 / (z * (t / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -9.9e-101], N[(N[(x * N[(-2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 2.2e-24], N[(N[(2.0 / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 / N[(z * N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.9 \cdot 10^{-101}:\\
\;\;\;\;\frac{x \cdot \frac{-2}{z}}{t}\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{-24}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{z \cdot \frac{t}{x}}\\
\end{array}
\end{array}
if t < -9.90000000000000015e-101Initial program 87.1%
*-commutative87.1%
distribute-rgt-out--89.6%
times-frac90.8%
Simplified90.8%
Taylor expanded in y around 0 71.7%
associate-*r/71.7%
neg-mul-171.7%
Simplified71.7%
associate-*r/74.6%
distribute-rgt-neg-in74.6%
*-commutative74.6%
distribute-rgt-neg-in74.6%
distribute-neg-frac74.6%
metadata-eval74.6%
Applied egg-rr74.6%
if -9.90000000000000015e-101 < t < 2.20000000000000002e-24Initial program 86.4%
*-commutative86.4%
associate-*r/86.3%
distribute-rgt-out--89.5%
associate-/r*94.2%
Simplified94.2%
Taylor expanded in y around inf 74.7%
associate-*r/74.7%
*-commutative74.7%
times-frac80.0%
Simplified80.0%
if 2.20000000000000002e-24 < t Initial program 90.6%
*-commutative90.6%
associate-*r/90.6%
distribute-rgt-out--92.2%
associate-/r*93.0%
Simplified93.0%
associate-/r*92.2%
associate-*r/92.2%
frac-times95.6%
clear-num95.6%
un-div-inv95.6%
Applied egg-rr95.6%
Taylor expanded in y around 0 78.2%
associate-*r/78.2%
*-commutative78.2%
times-frac80.5%
Simplified80.5%
*-commutative80.5%
clear-num80.4%
frac-times80.5%
metadata-eval80.5%
Applied egg-rr80.5%
Final simplification78.4%
(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 87.8%
*-commutative87.8%
associate-*r/87.7%
distribute-rgt-out--90.2%
associate-/r*91.9%
Simplified91.9%
Final simplification91.9%
(FPCore (x y z t) :precision binary64 (* (/ -2.0 z) (/ x t)))
double code(double x, double y, double z, double t) {
return (-2.0 / z) * (x / 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 / t)
end function
public static double code(double x, double y, double z, double t) {
return (-2.0 / z) * (x / t);
}
def code(x, y, z, t): return (-2.0 / z) * (x / t)
function code(x, y, z, t) return Float64(Float64(-2.0 / z) * Float64(x / t)) end
function tmp = code(x, y, z, t) tmp = (-2.0 / z) * (x / t); end
code[x_, y_, z_, t_] := N[(N[(-2.0 / z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-2}{z} \cdot \frac{x}{t}
\end{array}
Initial program 87.8%
*-commutative87.8%
associate-*r/87.7%
distribute-rgt-out--90.2%
associate-/r*91.9%
Simplified91.9%
associate-/r*90.2%
associate-*r/90.3%
frac-times93.4%
clear-num93.1%
un-div-inv93.3%
Applied egg-rr93.3%
Taylor expanded in y around 0 56.0%
associate-*r/56.0%
*-commutative56.0%
times-frac56.2%
Simplified56.2%
Final simplification56.2%
(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 2023268
(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))))