
(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 11 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 (- INFINITY))
(/ (/ 2.0 z) (/ (- y t) x))
(if (<= t_1 5e+197)
(/ (* 2.0 x) (* z (- y t)))
(* 2.0 (/ (/ x z) (- y t)))))))
double code(double x, double y, double z, double t) {
double t_1 = (y * z) - (z * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (2.0 / z) / ((y - t) / x);
} else if (t_1 <= 5e+197) {
tmp = (2.0 * x) / (z * (y - t));
} else {
tmp = 2.0 * ((x / z) / (y - t));
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y * z) - (z * t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (2.0 / z) / ((y - t) / x);
} else if (t_1 <= 5e+197) {
tmp = (2.0 * x) / (z * (y - t));
} else {
tmp = 2.0 * ((x / z) / (y - t));
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * z) - (z * t) tmp = 0 if t_1 <= -math.inf: tmp = (2.0 / z) / ((y - t) / x) elif t_1 <= 5e+197: tmp = (2.0 * x) / (z * (y - t)) else: tmp = 2.0 * ((x / z) / (y - t)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * z) - Float64(z * t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(2.0 / z) / Float64(Float64(y - t) / x)); elseif (t_1 <= 5e+197) tmp = Float64(Float64(2.0 * x) / Float64(z * 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) t_1 = (y * z) - (z * t); tmp = 0.0; if (t_1 <= -Inf) tmp = (2.0 / z) / ((y - t) / x); elseif (t_1 <= 5e+197) tmp = (2.0 * x) / (z * (y - t)); else tmp = 2.0 * ((x / z) / (y - t)); 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, (-Infinity)], N[(N[(2.0 / z), $MachinePrecision] / N[(N[(y - t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+197], N[(N[(2.0 * x), $MachinePrecision] / N[(z * 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}
t_1 := y \cdot z - z \cdot t\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{\frac{2}{z}}{\frac{y - t}{x}}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+197}:\\
\;\;\;\;\frac{2 \cdot x}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\
\end{array}
\end{array}
if (-.f64 (*.f64 y z) (*.f64 t z)) < -inf.0Initial program 44.5%
*-commutative44.5%
associate-*r/44.5%
distribute-rgt-out--44.5%
associate-/r*99.7%
Simplified99.7%
associate-/r*44.5%
associate-*r/44.5%
frac-times99.7%
clear-num99.6%
un-div-inv99.8%
Applied egg-rr99.8%
if -inf.0 < (-.f64 (*.f64 y z) (*.f64 t z)) < 5.00000000000000009e197Initial program 97.6%
distribute-rgt-out--97.6%
Simplified97.6%
if 5.00000000000000009e197 < (-.f64 (*.f64 y z) (*.f64 t z)) Initial program 66.5%
*-commutative66.5%
associate-*r/66.5%
distribute-rgt-out--76.0%
associate-/r*99.9%
Simplified99.9%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (<= z -4.2e-201) (* 2.0 (/ (/ x z) (- y t))) (if (<= z 5e-38) (/ (* 2.0 x) (* z (- y t))) (* (/ 2.0 z) (/ x (- y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.2e-201) {
tmp = 2.0 * ((x / z) / (y - t));
} else if (z <= 5e-38) {
tmp = (2.0 * x) / (z * (y - t));
} 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) :: tmp
if (z <= (-4.2d-201)) then
tmp = 2.0d0 * ((x / z) / (y - t))
else if (z <= 5d-38) then
tmp = (2.0d0 * x) / (z * (y - t))
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 tmp;
if (z <= -4.2e-201) {
tmp = 2.0 * ((x / z) / (y - t));
} else if (z <= 5e-38) {
tmp = (2.0 * x) / (z * (y - t));
} else {
tmp = (2.0 / z) * (x / (y - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.2e-201: tmp = 2.0 * ((x / z) / (y - t)) elif z <= 5e-38: tmp = (2.0 * x) / (z * (y - t)) else: tmp = (2.0 / z) * (x / (y - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.2e-201) tmp = Float64(2.0 * Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 5e-38) tmp = Float64(Float64(2.0 * x) / Float64(z * Float64(y - t))); else tmp = Float64(Float64(2.0 / z) * Float64(x / Float64(y - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.2e-201) tmp = 2.0 * ((x / z) / (y - t)); elseif (z <= 5e-38) tmp = (2.0 * x) / (z * (y - t)); else tmp = (2.0 / z) * (x / (y - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.2e-201], N[(2.0 * N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e-38], N[(N[(2.0 * x), $MachinePrecision] / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] * N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-201}:\\
\;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-38}:\\
\;\;\;\;\frac{2 \cdot x}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y - t}\\
\end{array}
\end{array}
if z < -4.20000000000000024e-201Initial program 81.9%
*-commutative81.9%
associate-*r/81.8%
distribute-rgt-out--85.4%
associate-/r*96.4%
Simplified96.4%
if -4.20000000000000024e-201 < z < 5.00000000000000033e-38Initial program 97.0%
distribute-rgt-out--97.0%
Simplified97.0%
if 5.00000000000000033e-38 < z Initial program 83.1%
*-commutative83.1%
distribute-rgt-out--84.5%
times-frac98.4%
Simplified98.4%
Final simplification97.1%
(FPCore (x y z t) :precision binary64 (if (<= (* 2.0 x) -2e-81) (* (/ 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 ((2.0 * x) <= -2e-81) {
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 ((2.0d0 * x) <= (-2d-81)) 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 ((2.0 * x) <= -2e-81) {
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 (2.0 * x) <= -2e-81: 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(2.0 * x) <= -2e-81) 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 ((2.0 * x) <= -2e-81) 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[LessEqual[N[(2.0 * x), $MachinePrecision], -2e-81], 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}\;2 \cdot x \leq -2 \cdot 10^{-81}:\\
\;\;\;\;\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) < -1.9999999999999999e-81Initial program 81.6%
*-commutative81.6%
distribute-rgt-out--81.6%
times-frac98.5%
Simplified98.5%
if -1.9999999999999999e-81 < (*.f64 x 2) Initial program 89.4%
*-commutative89.4%
associate-*r/89.4%
distribute-rgt-out--92.6%
associate-/r*93.7%
Simplified93.7%
Final simplification95.5%
(FPCore (x y z t) :precision binary64 (if (<= t -4.6e-31) (* (/ (/ x z) t) -2.0) (if (<= t 3.25e-37) (* (/ 2.0 z) (/ x y)) (/ (* (/ 2.0 z) x) (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.6e-31) {
tmp = ((x / z) / t) * -2.0;
} else if (t <= 3.25e-37) {
tmp = (2.0 / z) * (x / 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 <= (-4.6d-31)) then
tmp = ((x / z) / t) * (-2.0d0)
else if (t <= 3.25d-37) then
tmp = (2.0d0 / z) * (x / 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 <= -4.6e-31) {
tmp = ((x / z) / t) * -2.0;
} else if (t <= 3.25e-37) {
tmp = (2.0 / z) * (x / y);
} else {
tmp = ((2.0 / z) * x) / -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.6e-31: tmp = ((x / z) / t) * -2.0 elif t <= 3.25e-37: tmp = (2.0 / z) * (x / y) else: tmp = ((2.0 / z) * x) / -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.6e-31) tmp = Float64(Float64(Float64(x / z) / t) * -2.0); elseif (t <= 3.25e-37) tmp = Float64(Float64(2.0 / z) * Float64(x / y)); else tmp = Float64(Float64(Float64(2.0 / z) * x) / Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.6e-31) tmp = ((x / z) / t) * -2.0; elseif (t <= 3.25e-37) tmp = (2.0 / z) * (x / y); else tmp = ((2.0 / z) * x) / -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.6e-31], N[(N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision] * -2.0), $MachinePrecision], If[LessEqual[t, 3.25e-37], N[(N[(2.0 / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / z), $MachinePrecision] * x), $MachinePrecision] / (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{-31}:\\
\;\;\;\;\frac{\frac{x}{z}}{t} \cdot -2\\
\mathbf{elif}\;t \leq 3.25 \cdot 10^{-37}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{z} \cdot x}{-t}\\
\end{array}
\end{array}
if t < -4.5999999999999997e-31Initial program 81.1%
*-commutative81.1%
associate-*r/81.1%
distribute-rgt-out--85.3%
associate-/r*92.7%
Simplified92.7%
Taylor expanded in y around 0 75.6%
*-commutative75.6%
associate-/r*83.8%
Simplified83.8%
Taylor expanded in x around 0 75.6%
*-commutative75.6%
associate-/r*84.2%
Simplified84.2%
if -4.5999999999999997e-31 < t < 3.2500000000000001e-37Initial program 92.6%
*-commutative92.6%
associate-*r/92.6%
distribute-rgt-out--92.6%
associate-/r*92.7%
Simplified92.7%
Taylor expanded in y around inf 74.3%
associate-*r/74.3%
*-commutative74.3%
times-frac77.8%
Simplified77.8%
if 3.2500000000000001e-37 < t Initial program 83.0%
*-commutative83.0%
associate-*r/83.0%
distribute-rgt-out--85.6%
associate-/r*95.0%
Simplified95.0%
Taylor expanded in y around 0 74.6%
associate-*r/74.6%
metadata-eval74.6%
distribute-lft-neg-in74.6%
distribute-rgt-neg-in74.6%
*-commutative74.6%
frac-times80.0%
associate-*r/84.7%
frac-2neg84.7%
add-sqr-sqrt45.8%
sqrt-unprod53.4%
sqr-neg53.4%
sqrt-unprod17.0%
add-sqr-sqrt27.5%
distribute-rgt-neg-out27.5%
add-sqr-sqrt10.5%
sqrt-unprod42.0%
sqr-neg42.0%
sqrt-unprod38.6%
add-sqr-sqrt84.7%
Applied egg-rr84.7%
Final simplification81.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -8e-32) (not (<= t 3.05e-37))) (* -2.0 (/ x (* z t))) (* 2.0 (/ (/ x z) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8e-32) || !(t <= 3.05e-37)) {
tmp = -2.0 * (x / (z * t));
} else {
tmp = 2.0 * ((x / z) / 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 <= (-8d-32)) .or. (.not. (t <= 3.05d-37))) then
tmp = (-2.0d0) * (x / (z * t))
else
tmp = 2.0d0 * ((x / z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8e-32) || !(t <= 3.05e-37)) {
tmp = -2.0 * (x / (z * t));
} else {
tmp = 2.0 * ((x / z) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -8e-32) or not (t <= 3.05e-37): tmp = -2.0 * (x / (z * t)) else: tmp = 2.0 * ((x / z) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -8e-32) || !(t <= 3.05e-37)) tmp = Float64(-2.0 * Float64(x / Float64(z * t))); else tmp = Float64(2.0 * Float64(Float64(x / z) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -8e-32) || ~((t <= 3.05e-37))) tmp = -2.0 * (x / (z * t)); else tmp = 2.0 * ((x / z) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -8e-32], N[Not[LessEqual[t, 3.05e-37]], $MachinePrecision]], N[(-2.0 * N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{-32} \lor \neg \left(t \leq 3.05 \cdot 10^{-37}\right):\\
\;\;\;\;-2 \cdot \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{x}{z}}{y}\\
\end{array}
\end{array}
if t < -8.00000000000000045e-32 or 3.0500000000000002e-37 < t Initial program 82.1%
*-commutative82.1%
associate-*r/82.1%
distribute-rgt-out--85.4%
associate-/r*93.9%
Simplified93.9%
Taylor expanded in y around 0 75.1%
if -8.00000000000000045e-32 < t < 3.0500000000000002e-37Initial program 92.6%
*-commutative92.6%
associate-*r/92.6%
distribute-rgt-out--92.6%
associate-/r*92.7%
Simplified92.7%
associate-*r/92.7%
*-commutative92.7%
associate-*r/92.6%
clear-num92.5%
frac-times91.9%
metadata-eval91.9%
Applied egg-rr91.9%
Taylor expanded in y around inf 74.3%
*-commutative74.3%
associate-/r*76.3%
Simplified76.3%
Final simplification75.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.9e-43) (not (<= t 7.4e-37))) (* -2.0 (/ x (* z t))) (* (/ 2.0 z) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.9e-43) || !(t <= 7.4e-37)) {
tmp = -2.0 * (x / (z * 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 <= (-2.9d-43)) .or. (.not. (t <= 7.4d-37))) then
tmp = (-2.0d0) * (x / (z * 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 <= -2.9e-43) || !(t <= 7.4e-37)) {
tmp = -2.0 * (x / (z * t));
} else {
tmp = (2.0 / z) * (x / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.9e-43) or not (t <= 7.4e-37): tmp = -2.0 * (x / (z * t)) else: tmp = (2.0 / z) * (x / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.9e-43) || !(t <= 7.4e-37)) tmp = Float64(-2.0 * Float64(x / Float64(z * 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 <= -2.9e-43) || ~((t <= 7.4e-37))) tmp = -2.0 * (x / (z * t)); else tmp = (2.0 / z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.9e-43], N[Not[LessEqual[t, 7.4e-37]], $MachinePrecision]], N[(-2.0 * N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{-43} \lor \neg \left(t \leq 7.4 \cdot 10^{-37}\right):\\
\;\;\;\;-2 \cdot \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if t < -2.9000000000000001e-43 or 7.4e-37 < t Initial program 82.1%
*-commutative82.1%
associate-*r/82.1%
distribute-rgt-out--85.4%
associate-/r*93.9%
Simplified93.9%
Taylor expanded in y around 0 75.1%
if -2.9000000000000001e-43 < t < 7.4e-37Initial program 92.6%
*-commutative92.6%
associate-*r/92.6%
distribute-rgt-out--92.6%
associate-/r*92.7%
Simplified92.7%
Taylor expanded in y around inf 74.3%
associate-*r/74.3%
*-commutative74.3%
times-frac77.8%
Simplified77.8%
Final simplification76.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.2e-30) (not (<= t 6e-37))) (* x (/ (/ -2.0 z) t)) (* (/ 2.0 z) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.2e-30) || !(t <= 6e-37)) {
tmp = x * ((-2.0 / z) / 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 <= (-6.2d-30)) .or. (.not. (t <= 6d-37))) then
tmp = x * (((-2.0d0) / z) / 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 <= -6.2e-30) || !(t <= 6e-37)) {
tmp = x * ((-2.0 / z) / t);
} else {
tmp = (2.0 / z) * (x / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.2e-30) or not (t <= 6e-37): tmp = x * ((-2.0 / z) / t) else: tmp = (2.0 / z) * (x / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.2e-30) || !(t <= 6e-37)) tmp = Float64(x * Float64(Float64(-2.0 / z) / 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 <= -6.2e-30) || ~((t <= 6e-37))) tmp = x * ((-2.0 / z) / t); else tmp = (2.0 / z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.2e-30], N[Not[LessEqual[t, 6e-37]], $MachinePrecision]], N[(x * N[(N[(-2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{-30} \lor \neg \left(t \leq 6 \cdot 10^{-37}\right):\\
\;\;\;\;x \cdot \frac{\frac{-2}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if t < -6.19999999999999982e-30 or 6e-37 < t Initial program 82.1%
*-commutative82.1%
associate-*r/82.1%
distribute-rgt-out--85.4%
associate-/r*93.9%
Simplified93.9%
Taylor expanded in y around 0 75.1%
*-commutative75.1%
associate-/r*81.9%
Simplified81.9%
Taylor expanded in x around 0 75.1%
*-commutative75.1%
associate-/r*84.4%
Simplified84.4%
*-commutative84.4%
clear-num83.1%
un-div-inv83.1%
div-inv83.1%
clear-num83.3%
Applied egg-rr83.3%
associate-*r/74.9%
associate-*l/79.0%
associate-/l/80.3%
associate-/r/76.6%
Applied egg-rr76.6%
if -6.19999999999999982e-30 < t < 6e-37Initial program 92.6%
*-commutative92.6%
associate-*r/92.6%
distribute-rgt-out--92.6%
associate-/r*92.7%
Simplified92.7%
Taylor expanded in y around inf 74.3%
associate-*r/74.3%
*-commutative74.3%
times-frac77.8%
Simplified77.8%
Final simplification77.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -8e-44) (not (<= t 3.8e-37))) (* -2.0 (/ (/ x t) z)) (* (/ 2.0 z) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8e-44) || !(t <= 3.8e-37)) {
tmp = -2.0 * ((x / t) / z);
} 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 <= (-8d-44)) .or. (.not. (t <= 3.8d-37))) then
tmp = (-2.0d0) * ((x / t) / z)
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 <= -8e-44) || !(t <= 3.8e-37)) {
tmp = -2.0 * ((x / t) / z);
} else {
tmp = (2.0 / z) * (x / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -8e-44) or not (t <= 3.8e-37): tmp = -2.0 * ((x / t) / z) else: tmp = (2.0 / z) * (x / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -8e-44) || !(t <= 3.8e-37)) tmp = Float64(-2.0 * Float64(Float64(x / t) / z)); 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 <= -8e-44) || ~((t <= 3.8e-37))) tmp = -2.0 * ((x / t) / z); else tmp = (2.0 / z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -8e-44], N[Not[LessEqual[t, 3.8e-37]], $MachinePrecision]], N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{-44} \lor \neg \left(t \leq 3.8 \cdot 10^{-37}\right):\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if t < -7.99999999999999962e-44 or 3.8000000000000004e-37 < t Initial program 82.1%
*-commutative82.1%
associate-*r/82.1%
distribute-rgt-out--85.4%
associate-/r*93.9%
Simplified93.9%
Taylor expanded in y around 0 75.1%
*-commutative75.1%
associate-/r*81.9%
Simplified81.9%
if -7.99999999999999962e-44 < t < 3.8000000000000004e-37Initial program 92.6%
*-commutative92.6%
associate-*r/92.6%
distribute-rgt-out--92.6%
associate-/r*92.7%
Simplified92.7%
Taylor expanded in y around inf 74.3%
associate-*r/74.3%
*-commutative74.3%
times-frac77.8%
Simplified77.8%
Final simplification80.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.6e-31) (not (<= t 6.2e-37))) (* (/ (/ x z) t) -2.0) (* (/ 2.0 z) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.6e-31) || !(t <= 6.2e-37)) {
tmp = ((x / z) / t) * -2.0;
} 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 <= (-6.6d-31)) .or. (.not. (t <= 6.2d-37))) then
tmp = ((x / z) / t) * (-2.0d0)
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 <= -6.6e-31) || !(t <= 6.2e-37)) {
tmp = ((x / z) / t) * -2.0;
} else {
tmp = (2.0 / z) * (x / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.6e-31) or not (t <= 6.2e-37): tmp = ((x / z) / t) * -2.0 else: tmp = (2.0 / z) * (x / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.6e-31) || !(t <= 6.2e-37)) tmp = Float64(Float64(Float64(x / z) / t) * -2.0); 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 <= -6.6e-31) || ~((t <= 6.2e-37))) tmp = ((x / z) / t) * -2.0; else tmp = (2.0 / z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.6e-31], N[Not[LessEqual[t, 6.2e-37]], $MachinePrecision]], N[(N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision] * -2.0), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.6 \cdot 10^{-31} \lor \neg \left(t \leq 6.2 \cdot 10^{-37}\right):\\
\;\;\;\;\frac{\frac{x}{z}}{t} \cdot -2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if t < -6.5999999999999998e-31 or 6.19999999999999987e-37 < t Initial program 82.1%
*-commutative82.1%
associate-*r/82.1%
distribute-rgt-out--85.4%
associate-/r*93.9%
Simplified93.9%
Taylor expanded in y around 0 75.1%
*-commutative75.1%
associate-/r*81.9%
Simplified81.9%
Taylor expanded in x around 0 75.1%
*-commutative75.1%
associate-/r*84.4%
Simplified84.4%
if -6.5999999999999998e-31 < t < 6.19999999999999987e-37Initial program 92.6%
*-commutative92.6%
associate-*r/92.6%
distribute-rgt-out--92.6%
associate-/r*92.7%
Simplified92.7%
Taylor expanded in y around inf 74.3%
associate-*r/74.3%
*-commutative74.3%
times-frac77.8%
Simplified77.8%
Final simplification81.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 86.4%
*-commutative86.4%
associate-*r/86.4%
distribute-rgt-out--88.4%
associate-/r*93.4%
Simplified93.4%
Final simplification93.4%
(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 86.4%
*-commutative86.4%
associate-*r/86.4%
distribute-rgt-out--88.4%
associate-/r*93.4%
Simplified93.4%
Taylor expanded in y around 0 57.3%
Final simplification57.3%
(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 2023271
(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))))