
(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 (if (or (<= (* x 2.0) -2e+40) (not (<= (* x 2.0) 5e+40))) (* (/ 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) <= -2e+40) || !((x * 2.0) <= 5e+40)) {
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) <= (-2d+40)) .or. (.not. ((x * 2.0d0) <= 5d+40))) 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) <= -2e+40) || !((x * 2.0) <= 5e+40)) {
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) <= -2e+40) or not ((x * 2.0) <= 5e+40): 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) <= -2e+40) || !(Float64(x * 2.0) <= 5e+40)) 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) <= -2e+40) || ~(((x * 2.0) <= 5e+40))) 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], -2e+40], N[Not[LessEqual[N[(x * 2.0), $MachinePrecision], 5e+40]], $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 -2 \cdot 10^{+40} \lor \neg \left(x \cdot 2 \leq 5 \cdot 10^{+40}\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) < -2.00000000000000006e40 or 5.00000000000000003e40 < (*.f64 x 2) Initial program 87.7%
*-commutative87.7%
distribute-rgt-out--88.1%
times-frac97.0%
Simplified97.0%
if -2.00000000000000006e40 < (*.f64 x 2) < 5.00000000000000003e40Initial program 94.1%
*-commutative94.1%
associate-*r/94.1%
distribute-rgt-out--95.4%
associate-/r*98.5%
Simplified98.5%
Final simplification97.9%
(FPCore (x y z t) :precision binary64 (if (<= t -1.4e-17) (/ (* x (/ -2.0 z)) t) (if (<= t 5e-30) (/ (* 2.0 (/ x z)) y) (* (/ 2.0 z) (/ (- x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.4e-17) {
tmp = (x * (-2.0 / z)) / t;
} else if (t <= 5e-30) {
tmp = (2.0 * (x / z)) / y;
} else {
tmp = (2.0 / z) * (-x / 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 <= (-1.4d-17)) then
tmp = (x * ((-2.0d0) / z)) / t
else if (t <= 5d-30) then
tmp = (2.0d0 * (x / z)) / y
else
tmp = (2.0d0 / z) * (-x / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.4e-17) {
tmp = (x * (-2.0 / z)) / t;
} else if (t <= 5e-30) {
tmp = (2.0 * (x / z)) / y;
} else {
tmp = (2.0 / z) * (-x / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.4e-17: tmp = (x * (-2.0 / z)) / t elif t <= 5e-30: tmp = (2.0 * (x / z)) / y else: tmp = (2.0 / z) * (-x / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.4e-17) tmp = Float64(Float64(x * Float64(-2.0 / z)) / t); elseif (t <= 5e-30) tmp = Float64(Float64(2.0 * Float64(x / z)) / y); else tmp = Float64(Float64(2.0 / z) * Float64(Float64(-x) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.4e-17) tmp = (x * (-2.0 / z)) / t; elseif (t <= 5e-30) tmp = (2.0 * (x / z)) / y; else tmp = (2.0 / z) * (-x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.4e-17], N[(N[(x * N[(-2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 5e-30], N[(N[(2.0 * N[(x / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] * N[((-x) / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-17}:\\
\;\;\;\;\frac{x \cdot \frac{-2}{z}}{t}\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-30}:\\
\;\;\;\;\frac{2 \cdot \frac{x}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{-x}{t}\\
\end{array}
\end{array}
if t < -1.3999999999999999e-17Initial program 88.9%
*-commutative88.9%
associate-*r/88.9%
distribute-rgt-out--89.7%
associate-/r*92.3%
Simplified92.3%
Taylor expanded in y around 0 75.7%
associate-*r/75.7%
*-commutative75.7%
*-commutative75.7%
associate-/r*77.0%
metadata-eval77.0%
distribute-rgt-neg-in77.0%
distribute-neg-frac77.0%
associate-*r/77.0%
distribute-rgt-neg-in77.0%
distribute-neg-frac77.0%
metadata-eval77.0%
Simplified77.0%
if -1.3999999999999999e-17 < t < 4.99999999999999972e-30Initial program 92.1%
*-commutative92.1%
distribute-rgt-out--92.2%
times-frac92.9%
Simplified92.9%
Taylor expanded in y around inf 79.8%
frac-times80.7%
*-commutative80.7%
times-frac83.1%
associate-*r/83.1%
Applied egg-rr83.1%
if 4.99999999999999972e-30 < t Initial program 92.7%
*-commutative92.7%
distribute-rgt-out--95.6%
times-frac91.4%
Simplified91.4%
Taylor expanded in y around 0 76.3%
associate-*r/76.3%
neg-mul-176.3%
Simplified76.3%
Final simplification79.7%
(FPCore (x y z t) :precision binary64 (if (<= t -1.45e-17) (* x (/ -2.0 (* z t))) (if (<= t 1.6e-26) (* x (/ 2.0 (* z y))) (* -2.0 (/ (/ x t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.45e-17) {
tmp = x * (-2.0 / (z * t));
} else if (t <= 1.6e-26) {
tmp = x * (2.0 / (z * y));
} else {
tmp = -2.0 * ((x / 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 (t <= (-1.45d-17)) then
tmp = x * ((-2.0d0) / (z * t))
else if (t <= 1.6d-26) then
tmp = x * (2.0d0 / (z * y))
else
tmp = (-2.0d0) * ((x / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.45e-17) {
tmp = x * (-2.0 / (z * t));
} else if (t <= 1.6e-26) {
tmp = x * (2.0 / (z * y));
} else {
tmp = -2.0 * ((x / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.45e-17: tmp = x * (-2.0 / (z * t)) elif t <= 1.6e-26: tmp = x * (2.0 / (z * y)) else: tmp = -2.0 * ((x / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.45e-17) tmp = Float64(x * Float64(-2.0 / Float64(z * t))); elseif (t <= 1.6e-26) tmp = Float64(x * Float64(2.0 / Float64(z * y))); else tmp = Float64(-2.0 * Float64(Float64(x / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.45e-17) tmp = x * (-2.0 / (z * t)); elseif (t <= 1.6e-26) tmp = x * (2.0 / (z * y)); else tmp = -2.0 * ((x / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.45e-17], N[(x * N[(-2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.6e-26], N[(x * N[(2.0 / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{-17}:\\
\;\;\;\;x \cdot \frac{-2}{z \cdot t}\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{-26}:\\
\;\;\;\;x \cdot \frac{2}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if t < -1.4500000000000001e-17Initial program 88.9%
*-commutative88.9%
associate-*r/88.9%
distribute-rgt-out--89.7%
associate-/r*92.3%
Simplified92.3%
Taylor expanded in x around 0 89.7%
associate-*r/89.7%
associate-*l/89.7%
*-commutative89.7%
associate-/r*90.8%
Simplified90.8%
Taylor expanded in y around 0 75.7%
if -1.4500000000000001e-17 < t < 1.6000000000000001e-26Initial program 92.1%
*-commutative92.1%
associate-*r/92.1%
distribute-rgt-out--92.2%
associate-/r*95.9%
Simplified95.9%
associate-*r/95.9%
*-commutative95.9%
associate-*r/95.9%
clear-num95.9%
associate-*l/95.9%
*-un-lft-identity95.9%
Applied egg-rr95.9%
Taylor expanded in y around inf 80.7%
*-commutative80.7%
associate-*l/80.7%
associate-*r/80.6%
*-commutative80.6%
Simplified80.6%
if 1.6000000000000001e-26 < t Initial program 92.7%
*-commutative92.7%
associate-*r/92.6%
distribute-rgt-out--95.5%
associate-/r*91.5%
Simplified91.5%
associate-*r/91.5%
*-commutative91.5%
associate-*r/91.4%
clear-num91.4%
associate-*l/91.5%
*-un-lft-identity91.5%
Applied egg-rr91.5%
Taylor expanded in y around 0 76.2%
associate-/r*76.3%
Simplified76.3%
Final simplification78.3%
(FPCore (x y z t) :precision binary64 (if (<= t -1.5e-17) (* x (/ -2.0 (* z t))) (if (<= t 8e-27) (/ 2.0 (* y (/ z x))) (* -2.0 (/ (/ x t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.5e-17) {
tmp = x * (-2.0 / (z * t));
} else if (t <= 8e-27) {
tmp = 2.0 / (y * (z / x));
} else {
tmp = -2.0 * ((x / 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 (t <= (-1.5d-17)) then
tmp = x * ((-2.0d0) / (z * t))
else if (t <= 8d-27) then
tmp = 2.0d0 / (y * (z / x))
else
tmp = (-2.0d0) * ((x / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.5e-17) {
tmp = x * (-2.0 / (z * t));
} else if (t <= 8e-27) {
tmp = 2.0 / (y * (z / x));
} else {
tmp = -2.0 * ((x / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.5e-17: tmp = x * (-2.0 / (z * t)) elif t <= 8e-27: tmp = 2.0 / (y * (z / x)) else: tmp = -2.0 * ((x / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.5e-17) tmp = Float64(x * Float64(-2.0 / Float64(z * t))); elseif (t <= 8e-27) tmp = Float64(2.0 / Float64(y * Float64(z / x))); else tmp = Float64(-2.0 * Float64(Float64(x / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.5e-17) tmp = x * (-2.0 / (z * t)); elseif (t <= 8e-27) tmp = 2.0 / (y * (z / x)); else tmp = -2.0 * ((x / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.5e-17], N[(x * N[(-2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8e-27], N[(2.0 / N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{-17}:\\
\;\;\;\;x \cdot \frac{-2}{z \cdot t}\\
\mathbf{elif}\;t \leq 8 \cdot 10^{-27}:\\
\;\;\;\;\frac{2}{y \cdot \frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if t < -1.50000000000000003e-17Initial program 88.9%
*-commutative88.9%
associate-*r/88.9%
distribute-rgt-out--89.7%
associate-/r*92.3%
Simplified92.3%
Taylor expanded in x around 0 89.7%
associate-*r/89.7%
associate-*l/89.7%
*-commutative89.7%
associate-/r*90.8%
Simplified90.8%
Taylor expanded in y around 0 75.7%
if -1.50000000000000003e-17 < t < 8.0000000000000003e-27Initial program 92.1%
*-commutative92.1%
associate-*r/92.1%
distribute-rgt-out--92.2%
associate-/r*95.9%
Simplified95.9%
associate-*r/95.9%
*-commutative95.9%
associate-*r/95.9%
clear-num95.9%
frac-times96.0%
metadata-eval96.0%
Applied egg-rr96.0%
Taylor expanded in y around inf 80.5%
associate-*r/83.1%
Simplified83.1%
if 8.0000000000000003e-27 < t Initial program 92.7%
*-commutative92.7%
associate-*r/92.6%
distribute-rgt-out--95.5%
associate-/r*91.5%
Simplified91.5%
associate-*r/91.5%
*-commutative91.5%
associate-*r/91.4%
clear-num91.4%
associate-*l/91.5%
*-un-lft-identity91.5%
Applied egg-rr91.5%
Taylor expanded in y around 0 76.2%
associate-/r*76.3%
Simplified76.3%
Final simplification79.4%
(FPCore (x y z t) :precision binary64 (if (<= t -1.5e-17) (/ (* x (/ -2.0 z)) t) (if (<= t 2.75e-27) (/ 2.0 (* y (/ z x))) (* -2.0 (/ (/ x t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.5e-17) {
tmp = (x * (-2.0 / z)) / t;
} else if (t <= 2.75e-27) {
tmp = 2.0 / (y * (z / x));
} else {
tmp = -2.0 * ((x / 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 (t <= (-1.5d-17)) then
tmp = (x * ((-2.0d0) / z)) / t
else if (t <= 2.75d-27) then
tmp = 2.0d0 / (y * (z / x))
else
tmp = (-2.0d0) * ((x / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.5e-17) {
tmp = (x * (-2.0 / z)) / t;
} else if (t <= 2.75e-27) {
tmp = 2.0 / (y * (z / x));
} else {
tmp = -2.0 * ((x / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.5e-17: tmp = (x * (-2.0 / z)) / t elif t <= 2.75e-27: tmp = 2.0 / (y * (z / x)) else: tmp = -2.0 * ((x / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.5e-17) tmp = Float64(Float64(x * Float64(-2.0 / z)) / t); elseif (t <= 2.75e-27) tmp = Float64(2.0 / Float64(y * Float64(z / x))); else tmp = Float64(-2.0 * Float64(Float64(x / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.5e-17) tmp = (x * (-2.0 / z)) / t; elseif (t <= 2.75e-27) tmp = 2.0 / (y * (z / x)); else tmp = -2.0 * ((x / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.5e-17], N[(N[(x * N[(-2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 2.75e-27], N[(2.0 / N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{-17}:\\
\;\;\;\;\frac{x \cdot \frac{-2}{z}}{t}\\
\mathbf{elif}\;t \leq 2.75 \cdot 10^{-27}:\\
\;\;\;\;\frac{2}{y \cdot \frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if t < -1.50000000000000003e-17Initial program 88.9%
*-commutative88.9%
associate-*r/88.9%
distribute-rgt-out--89.7%
associate-/r*92.3%
Simplified92.3%
Taylor expanded in y around 0 75.7%
associate-*r/75.7%
*-commutative75.7%
*-commutative75.7%
associate-/r*77.0%
metadata-eval77.0%
distribute-rgt-neg-in77.0%
distribute-neg-frac77.0%
associate-*r/77.0%
distribute-rgt-neg-in77.0%
distribute-neg-frac77.0%
metadata-eval77.0%
Simplified77.0%
if -1.50000000000000003e-17 < t < 2.7500000000000001e-27Initial program 92.1%
*-commutative92.1%
associate-*r/92.1%
distribute-rgt-out--92.2%
associate-/r*95.9%
Simplified95.9%
associate-*r/95.9%
*-commutative95.9%
associate-*r/95.9%
clear-num95.9%
frac-times96.0%
metadata-eval96.0%
Applied egg-rr96.0%
Taylor expanded in y around inf 80.5%
associate-*r/83.1%
Simplified83.1%
if 2.7500000000000001e-27 < t Initial program 92.7%
*-commutative92.7%
associate-*r/92.6%
distribute-rgt-out--95.5%
associate-/r*91.5%
Simplified91.5%
associate-*r/91.5%
*-commutative91.5%
associate-*r/91.4%
clear-num91.4%
associate-*l/91.5%
*-un-lft-identity91.5%
Applied egg-rr91.5%
Taylor expanded in y around 0 76.2%
associate-/r*76.3%
Simplified76.3%
Final simplification79.7%
(FPCore (x y z t) :precision binary64 (if (<= t -1.5e-17) (/ (* x (/ -2.0 z)) t) (if (<= t 2.25e-26) (/ (* 2.0 (/ x z)) y) (* -2.0 (/ (/ x t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.5e-17) {
tmp = (x * (-2.0 / z)) / t;
} else if (t <= 2.25e-26) {
tmp = (2.0 * (x / z)) / y;
} else {
tmp = -2.0 * ((x / 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 (t <= (-1.5d-17)) then
tmp = (x * ((-2.0d0) / z)) / t
else if (t <= 2.25d-26) then
tmp = (2.0d0 * (x / z)) / y
else
tmp = (-2.0d0) * ((x / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.5e-17) {
tmp = (x * (-2.0 / z)) / t;
} else if (t <= 2.25e-26) {
tmp = (2.0 * (x / z)) / y;
} else {
tmp = -2.0 * ((x / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.5e-17: tmp = (x * (-2.0 / z)) / t elif t <= 2.25e-26: tmp = (2.0 * (x / z)) / y else: tmp = -2.0 * ((x / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.5e-17) tmp = Float64(Float64(x * Float64(-2.0 / z)) / t); elseif (t <= 2.25e-26) tmp = Float64(Float64(2.0 * Float64(x / z)) / y); else tmp = Float64(-2.0 * Float64(Float64(x / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.5e-17) tmp = (x * (-2.0 / z)) / t; elseif (t <= 2.25e-26) tmp = (2.0 * (x / z)) / y; else tmp = -2.0 * ((x / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.5e-17], N[(N[(x * N[(-2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 2.25e-26], N[(N[(2.0 * N[(x / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{-17}:\\
\;\;\;\;\frac{x \cdot \frac{-2}{z}}{t}\\
\mathbf{elif}\;t \leq 2.25 \cdot 10^{-26}:\\
\;\;\;\;\frac{2 \cdot \frac{x}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if t < -1.50000000000000003e-17Initial program 88.9%
*-commutative88.9%
associate-*r/88.9%
distribute-rgt-out--89.7%
associate-/r*92.3%
Simplified92.3%
Taylor expanded in y around 0 75.7%
associate-*r/75.7%
*-commutative75.7%
*-commutative75.7%
associate-/r*77.0%
metadata-eval77.0%
distribute-rgt-neg-in77.0%
distribute-neg-frac77.0%
associate-*r/77.0%
distribute-rgt-neg-in77.0%
distribute-neg-frac77.0%
metadata-eval77.0%
Simplified77.0%
if -1.50000000000000003e-17 < t < 2.2499999999999999e-26Initial program 92.1%
*-commutative92.1%
distribute-rgt-out--92.2%
times-frac92.9%
Simplified92.9%
Taylor expanded in y around inf 79.8%
frac-times80.7%
*-commutative80.7%
times-frac83.1%
associate-*r/83.1%
Applied egg-rr83.1%
if 2.2499999999999999e-26 < t Initial program 92.7%
*-commutative92.7%
associate-*r/92.6%
distribute-rgt-out--95.5%
associate-/r*91.5%
Simplified91.5%
associate-*r/91.5%
*-commutative91.5%
associate-*r/91.4%
clear-num91.4%
associate-*l/91.5%
*-un-lft-identity91.5%
Applied egg-rr91.5%
Taylor expanded in y around 0 76.2%
associate-/r*76.3%
Simplified76.3%
Final simplification79.7%
(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 91.5%
*-commutative91.5%
associate-*r/91.5%
distribute-rgt-out--92.5%
associate-/r*93.8%
Simplified93.8%
Final simplification93.8%
(FPCore (x y z t) :precision binary64 (* -2.0 (/ (/ x t) z)))
double code(double x, double y, double z, double t) {
return -2.0 * ((x / 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 = (-2.0d0) * ((x / t) / z)
end function
public static double code(double x, double y, double z, double t) {
return -2.0 * ((x / t) / z);
}
def code(x, y, z, t): return -2.0 * ((x / t) / z)
function code(x, y, z, t) return Float64(-2.0 * Float64(Float64(x / t) / z)) end
function tmp = code(x, y, z, t) tmp = -2.0 * ((x / t) / z); end
code[x_, y_, z_, t_] := N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-2 \cdot \frac{\frac{x}{t}}{z}
\end{array}
Initial program 91.5%
*-commutative91.5%
associate-*r/91.5%
distribute-rgt-out--92.5%
associate-/r*93.8%
Simplified93.8%
associate-*r/93.9%
*-commutative93.9%
associate-*r/93.8%
clear-num93.8%
associate-*l/93.8%
*-un-lft-identity93.8%
Applied egg-rr93.8%
Taylor expanded in y around 0 51.8%
associate-/r*52.6%
Simplified52.6%
Final simplification52.6%
(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 2023310
(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))))