
(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}
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= z_m 8e+32)
(/ (* x 2.0) (* z_m (- y t)))
(* (/ x (- y t)) (/ 2.0 z_m)))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 8e+32) {
tmp = (x * 2.0) / (z_m * (y - t));
} else {
tmp = (x / (y - t)) * (2.0 / z_m);
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 8d+32) then
tmp = (x * 2.0d0) / (z_m * (y - t))
else
tmp = (x / (y - t)) * (2.0d0 / z_m)
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 8e+32) {
tmp = (x * 2.0) / (z_m * (y - t));
} else {
tmp = (x / (y - t)) * (2.0 / z_m);
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if z_m <= 8e+32: tmp = (x * 2.0) / (z_m * (y - t)) else: tmp = (x / (y - t)) * (2.0 / z_m) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (z_m <= 8e+32) tmp = Float64(Float64(x * 2.0) / Float64(z_m * Float64(y - t))); else tmp = Float64(Float64(x / Float64(y - t)) * Float64(2.0 / z_m)); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (z_m <= 8e+32) tmp = (x * 2.0) / (z_m * (y - t)); else tmp = (x / (y - t)) * (2.0 / z_m); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[z$95$m, 8e+32], N[(N[(x * 2.0), $MachinePrecision] / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 8 \cdot 10^{+32}:\\
\;\;\;\;\frac{x \cdot 2}{z\_m \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y - t} \cdot \frac{2}{z\_m}\\
\end{array}
\end{array}
if z < 8.00000000000000043e32Initial program 94.9%
distribute-rgt-out--94.9%
Simplified94.9%
if 8.00000000000000043e32 < z Initial program 73.1%
distribute-rgt-out--75.6%
Simplified75.6%
*-commutative75.6%
times-frac99.7%
Applied egg-rr99.7%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (or (<= y -2.3e-41) (not (<= y 2.1e-53)))
(* (/ 2.0 z_m) (/ x y))
(* (/ -2.0 z_m) (/ x t)))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if ((y <= -2.3e-41) || !(y <= 2.1e-53)) {
tmp = (2.0 / z_m) * (x / y);
} else {
tmp = (-2.0 / z_m) * (x / t);
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-2.3d-41)) .or. (.not. (y <= 2.1d-53))) then
tmp = (2.0d0 / z_m) * (x / y)
else
tmp = ((-2.0d0) / z_m) * (x / t)
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if ((y <= -2.3e-41) || !(y <= 2.1e-53)) {
tmp = (2.0 / z_m) * (x / y);
} else {
tmp = (-2.0 / z_m) * (x / t);
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if (y <= -2.3e-41) or not (y <= 2.1e-53): tmp = (2.0 / z_m) * (x / y) else: tmp = (-2.0 / z_m) * (x / t) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if ((y <= -2.3e-41) || !(y <= 2.1e-53)) tmp = Float64(Float64(2.0 / z_m) * Float64(x / y)); else tmp = Float64(Float64(-2.0 / z_m) * Float64(x / t)); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if ((y <= -2.3e-41) || ~((y <= 2.1e-53))) tmp = (2.0 / z_m) * (x / y); else tmp = (-2.0 / z_m) * (x / t); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[Or[LessEqual[y, -2.3e-41], N[Not[LessEqual[y, 2.1e-53]], $MachinePrecision]], N[(N[(2.0 / z$95$m), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 / z$95$m), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{-41} \lor \neg \left(y \leq 2.1 \cdot 10^{-53}\right):\\
\;\;\;\;\frac{2}{z\_m} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{z\_m} \cdot \frac{x}{t}\\
\end{array}
\end{array}
if y < -2.3000000000000001e-41 or 2.09999999999999977e-53 < y Initial program 88.8%
distribute-rgt-out--89.7%
Simplified89.7%
*-commutative89.7%
times-frac93.0%
Applied egg-rr93.0%
Taylor expanded in y around inf 76.8%
if -2.3000000000000001e-41 < y < 2.09999999999999977e-53Initial program 92.7%
distribute-rgt-out--92.8%
Simplified92.8%
Taylor expanded in y around 0 75.5%
associate-*r*75.5%
neg-mul-175.5%
*-commutative75.5%
Simplified75.5%
frac-2neg75.5%
*-commutative75.5%
distribute-lft-neg-in75.5%
metadata-eval75.5%
distribute-rgt-neg-out75.5%
remove-double-neg75.5%
times-frac79.6%
Applied egg-rr79.6%
Final simplification77.9%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= y -1.9e-39)
(/ (/ x (* y 0.5)) z_m)
(if (<= y 1.9e-53) (* (/ -2.0 z_m) (/ x t)) (/ 2.0 (* y (/ z_m x)))))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (y <= -1.9e-39) {
tmp = (x / (y * 0.5)) / z_m;
} else if (y <= 1.9e-53) {
tmp = (-2.0 / z_m) * (x / t);
} else {
tmp = 2.0 / (y * (z_m / x));
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.9d-39)) then
tmp = (x / (y * 0.5d0)) / z_m
else if (y <= 1.9d-53) then
tmp = ((-2.0d0) / z_m) * (x / t)
else
tmp = 2.0d0 / (y * (z_m / x))
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (y <= -1.9e-39) {
tmp = (x / (y * 0.5)) / z_m;
} else if (y <= 1.9e-53) {
tmp = (-2.0 / z_m) * (x / t);
} else {
tmp = 2.0 / (y * (z_m / x));
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if y <= -1.9e-39: tmp = (x / (y * 0.5)) / z_m elif y <= 1.9e-53: tmp = (-2.0 / z_m) * (x / t) else: tmp = 2.0 / (y * (z_m / x)) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (y <= -1.9e-39) tmp = Float64(Float64(x / Float64(y * 0.5)) / z_m); elseif (y <= 1.9e-53) tmp = Float64(Float64(-2.0 / z_m) * Float64(x / t)); else tmp = Float64(2.0 / Float64(y * Float64(z_m / x))); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (y <= -1.9e-39) tmp = (x / (y * 0.5)) / z_m; elseif (y <= 1.9e-53) tmp = (-2.0 / z_m) * (x / t); else tmp = 2.0 / (y * (z_m / x)); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[y, -1.9e-39], N[(N[(x / N[(y * 0.5), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], If[LessEqual[y, 1.9e-53], N[(N[(-2.0 / z$95$m), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(y * N[(z$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{x}{y \cdot 0.5}}{z\_m}\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{-53}:\\
\;\;\;\;\frac{-2}{z\_m} \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{y \cdot \frac{z\_m}{x}}\\
\end{array}
\end{array}
if y < -1.9000000000000001e-39Initial program 86.9%
distribute-rgt-out--88.3%
Simplified88.3%
Taylor expanded in y around inf 75.7%
associate-*r/75.7%
*-commutative75.7%
*-commutative75.7%
times-frac73.2%
Simplified73.2%
associate-*l/77.9%
clear-num77.9%
un-div-inv78.0%
div-inv78.0%
metadata-eval78.0%
Applied egg-rr78.0%
if -1.9000000000000001e-39 < y < 1.8999999999999999e-53Initial program 92.7%
distribute-rgt-out--92.8%
Simplified92.8%
Taylor expanded in y around 0 75.5%
associate-*r*75.5%
neg-mul-175.5%
*-commutative75.5%
Simplified75.5%
frac-2neg75.5%
*-commutative75.5%
distribute-lft-neg-in75.5%
metadata-eval75.5%
distribute-rgt-neg-out75.5%
remove-double-neg75.5%
times-frac79.6%
Applied egg-rr79.6%
if 1.8999999999999999e-53 < y Initial program 90.9%
distribute-rgt-out--91.2%
Simplified91.2%
Taylor expanded in y around inf 76.5%
associate-*r/76.5%
*-commutative76.5%
*-commutative76.5%
times-frac78.2%
Simplified78.2%
clear-num79.4%
frac-times80.6%
metadata-eval80.6%
Applied egg-rr80.6%
Final simplification79.4%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= y -1.95e-39)
(* (/ 2.0 z_m) (/ x y))
(if (<= y 1.15e-52) (* (/ -2.0 z_m) (/ x t)) (/ 2.0 (* y (/ z_m x)))))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (y <= -1.95e-39) {
tmp = (2.0 / z_m) * (x / y);
} else if (y <= 1.15e-52) {
tmp = (-2.0 / z_m) * (x / t);
} else {
tmp = 2.0 / (y * (z_m / x));
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.95d-39)) then
tmp = (2.0d0 / z_m) * (x / y)
else if (y <= 1.15d-52) then
tmp = ((-2.0d0) / z_m) * (x / t)
else
tmp = 2.0d0 / (y * (z_m / x))
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (y <= -1.95e-39) {
tmp = (2.0 / z_m) * (x / y);
} else if (y <= 1.15e-52) {
tmp = (-2.0 / z_m) * (x / t);
} else {
tmp = 2.0 / (y * (z_m / x));
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if y <= -1.95e-39: tmp = (2.0 / z_m) * (x / y) elif y <= 1.15e-52: tmp = (-2.0 / z_m) * (x / t) else: tmp = 2.0 / (y * (z_m / x)) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (y <= -1.95e-39) tmp = Float64(Float64(2.0 / z_m) * Float64(x / y)); elseif (y <= 1.15e-52) tmp = Float64(Float64(-2.0 / z_m) * Float64(x / t)); else tmp = Float64(2.0 / Float64(y * Float64(z_m / x))); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (y <= -1.95e-39) tmp = (2.0 / z_m) * (x / y); elseif (y <= 1.15e-52) tmp = (-2.0 / z_m) * (x / t); else tmp = 2.0 / (y * (z_m / x)); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[y, -1.95e-39], N[(N[(2.0 / z$95$m), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.15e-52], N[(N[(-2.0 / z$95$m), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(y * N[(z$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-39}:\\
\;\;\;\;\frac{2}{z\_m} \cdot \frac{x}{y}\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-52}:\\
\;\;\;\;\frac{-2}{z\_m} \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{y \cdot \frac{z\_m}{x}}\\
\end{array}
\end{array}
if y < -1.95000000000000015e-39Initial program 86.9%
distribute-rgt-out--88.3%
Simplified88.3%
*-commutative88.3%
times-frac93.8%
Applied egg-rr93.8%
Taylor expanded in y around inf 77.8%
if -1.95000000000000015e-39 < y < 1.14999999999999997e-52Initial program 92.7%
distribute-rgt-out--92.8%
Simplified92.8%
Taylor expanded in y around 0 75.5%
associate-*r*75.5%
neg-mul-175.5%
*-commutative75.5%
Simplified75.5%
frac-2neg75.5%
*-commutative75.5%
distribute-lft-neg-in75.5%
metadata-eval75.5%
distribute-rgt-neg-out75.5%
remove-double-neg75.5%
times-frac79.6%
Applied egg-rr79.6%
if 1.14999999999999997e-52 < y Initial program 90.9%
distribute-rgt-out--91.2%
Simplified91.2%
Taylor expanded in y around inf 76.5%
associate-*r/76.5%
*-commutative76.5%
*-commutative76.5%
times-frac78.2%
Simplified78.2%
clear-num79.4%
frac-times80.6%
metadata-eval80.6%
Applied egg-rr80.6%
Final simplification79.4%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= y -8.5e-39)
(* (/ 2.0 z_m) (/ x y))
(if (<= y 6.2e-54) (* (/ -2.0 z_m) (/ x t)) (* (/ x z_m) (/ 2.0 y))))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (y <= -8.5e-39) {
tmp = (2.0 / z_m) * (x / y);
} else if (y <= 6.2e-54) {
tmp = (-2.0 / z_m) * (x / t);
} else {
tmp = (x / z_m) * (2.0 / y);
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-8.5d-39)) then
tmp = (2.0d0 / z_m) * (x / y)
else if (y <= 6.2d-54) then
tmp = ((-2.0d0) / z_m) * (x / t)
else
tmp = (x / z_m) * (2.0d0 / y)
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (y <= -8.5e-39) {
tmp = (2.0 / z_m) * (x / y);
} else if (y <= 6.2e-54) {
tmp = (-2.0 / z_m) * (x / t);
} else {
tmp = (x / z_m) * (2.0 / y);
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if y <= -8.5e-39: tmp = (2.0 / z_m) * (x / y) elif y <= 6.2e-54: tmp = (-2.0 / z_m) * (x / t) else: tmp = (x / z_m) * (2.0 / y) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (y <= -8.5e-39) tmp = Float64(Float64(2.0 / z_m) * Float64(x / y)); elseif (y <= 6.2e-54) tmp = Float64(Float64(-2.0 / z_m) * Float64(x / t)); else tmp = Float64(Float64(x / z_m) * Float64(2.0 / y)); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (y <= -8.5e-39) tmp = (2.0 / z_m) * (x / y); elseif (y <= 6.2e-54) tmp = (-2.0 / z_m) * (x / t); else tmp = (x / z_m) * (2.0 / y); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[y, -8.5e-39], N[(N[(2.0 / z$95$m), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.2e-54], N[(N[(-2.0 / z$95$m), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{-39}:\\
\;\;\;\;\frac{2}{z\_m} \cdot \frac{x}{y}\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-54}:\\
\;\;\;\;\frac{-2}{z\_m} \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z\_m} \cdot \frac{2}{y}\\
\end{array}
\end{array}
if y < -8.5000000000000005e-39Initial program 86.9%
distribute-rgt-out--88.3%
Simplified88.3%
*-commutative88.3%
times-frac93.8%
Applied egg-rr93.8%
Taylor expanded in y around inf 77.8%
if -8.5000000000000005e-39 < y < 6.20000000000000008e-54Initial program 92.7%
distribute-rgt-out--92.8%
Simplified92.8%
Taylor expanded in y around 0 75.5%
associate-*r*75.5%
neg-mul-175.5%
*-commutative75.5%
Simplified75.5%
frac-2neg75.5%
*-commutative75.5%
distribute-lft-neg-in75.5%
metadata-eval75.5%
distribute-rgt-neg-out75.5%
remove-double-neg75.5%
times-frac79.6%
Applied egg-rr79.6%
if 6.20000000000000008e-54 < y Initial program 90.9%
distribute-rgt-out--91.2%
Simplified91.2%
Taylor expanded in y around inf 76.5%
associate-*r/76.5%
*-commutative76.5%
*-commutative76.5%
times-frac78.2%
Simplified78.2%
Final simplification78.6%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= z_m 2e+20)
(* x (/ 2.0 (* z_m (- y t))))
(* (/ x (- y t)) (/ 2.0 z_m)))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 2e+20) {
tmp = x * (2.0 / (z_m * (y - t)));
} else {
tmp = (x / (y - t)) * (2.0 / z_m);
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 2d+20) then
tmp = x * (2.0d0 / (z_m * (y - t)))
else
tmp = (x / (y - t)) * (2.0d0 / z_m)
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 2e+20) {
tmp = x * (2.0 / (z_m * (y - t)));
} else {
tmp = (x / (y - t)) * (2.0 / z_m);
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if z_m <= 2e+20: tmp = x * (2.0 / (z_m * (y - t))) else: tmp = (x / (y - t)) * (2.0 / z_m) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (z_m <= 2e+20) tmp = Float64(x * Float64(2.0 / Float64(z_m * Float64(y - t)))); else tmp = Float64(Float64(x / Float64(y - t)) * Float64(2.0 / z_m)); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (z_m <= 2e+20) tmp = x * (2.0 / (z_m * (y - t))); else tmp = (x / (y - t)) * (2.0 / z_m); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[z$95$m, 2e+20], N[(x * N[(2.0 / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 2 \cdot 10^{+20}:\\
\;\;\;\;x \cdot \frac{2}{z\_m \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y - t} \cdot \frac{2}{z\_m}\\
\end{array}
\end{array}
if z < 2e20Initial program 94.8%
distribute-rgt-out--94.8%
Simplified94.8%
distribute-rgt-out--94.8%
associate-/l*94.0%
*-commutative94.0%
distribute-rgt-out--94.0%
Applied egg-rr94.0%
if 2e20 < z Initial program 75.4%
distribute-rgt-out--77.7%
Simplified77.7%
*-commutative77.7%
times-frac99.6%
Applied egg-rr99.6%
Final simplification95.3%
z\_m = (fabs.f64 z) z\_s = (copysign.f64 #s(literal 1 binary64) z) (FPCore (z_s x y z_m t) :precision binary64 (* z_s (if (<= t -5e+231) (/ (/ (* x -2.0) t) z_m) (* x (/ 2.0 (* z_m (- y t)))))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (t <= -5e+231) {
tmp = ((x * -2.0) / t) / z_m;
} else {
tmp = x * (2.0 / (z_m * (y - t)));
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d+231)) then
tmp = ((x * (-2.0d0)) / t) / z_m
else
tmp = x * (2.0d0 / (z_m * (y - t)))
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (t <= -5e+231) {
tmp = ((x * -2.0) / t) / z_m;
} else {
tmp = x * (2.0 / (z_m * (y - t)));
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if t <= -5e+231: tmp = ((x * -2.0) / t) / z_m else: tmp = x * (2.0 / (z_m * (y - t))) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (t <= -5e+231) tmp = Float64(Float64(Float64(x * -2.0) / t) / z_m); else tmp = Float64(x * Float64(2.0 / Float64(z_m * Float64(y - t)))); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (t <= -5e+231) tmp = ((x * -2.0) / t) / z_m; else tmp = x * (2.0 / (z_m * (y - t))); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[t, -5e+231], N[(N[(N[(x * -2.0), $MachinePrecision] / t), $MachinePrecision] / z$95$m), $MachinePrecision], N[(x * N[(2.0 / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{+231}:\\
\;\;\;\;\frac{\frac{x \cdot -2}{t}}{z\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{2}{z\_m \cdot \left(y - t\right)}\\
\end{array}
\end{array}
if t < -5.00000000000000028e231Initial program 57.6%
distribute-rgt-out--63.6%
Simplified63.6%
Taylor expanded in y around 0 57.8%
*-commutative57.8%
Simplified57.8%
*-commutative57.8%
associate-*l/57.8%
metadata-eval57.8%
distribute-rgt-neg-in57.8%
*-commutative57.8%
associate-/r*93.8%
distribute-rgt-neg-in93.8%
metadata-eval93.8%
Applied egg-rr93.8%
if -5.00000000000000028e231 < t Initial program 92.9%
distribute-rgt-out--93.0%
Simplified93.0%
distribute-rgt-out--92.9%
associate-/l*92.2%
*-commutative92.2%
distribute-rgt-out--92.3%
Applied egg-rr92.3%
Final simplification92.4%
z\_m = (fabs.f64 z) z\_s = (copysign.f64 #s(literal 1 binary64) z) (FPCore (z_s x y z_m t) :precision binary64 (* z_s (if (<= z_m 4.5e-95) (* (/ -2.0 z_m) (/ x t)) (* -2.0 (/ (/ x z_m) t)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 4.5e-95) {
tmp = (-2.0 / z_m) * (x / t);
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 4.5d-95) then
tmp = ((-2.0d0) / z_m) * (x / t)
else
tmp = (-2.0d0) * ((x / z_m) / t)
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 4.5e-95) {
tmp = (-2.0 / z_m) * (x / t);
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if z_m <= 4.5e-95: tmp = (-2.0 / z_m) * (x / t) else: tmp = -2.0 * ((x / z_m) / t) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (z_m <= 4.5e-95) tmp = Float64(Float64(-2.0 / z_m) * Float64(x / t)); else tmp = Float64(-2.0 * Float64(Float64(x / z_m) / t)); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (z_m <= 4.5e-95) tmp = (-2.0 / z_m) * (x / t); else tmp = -2.0 * ((x / z_m) / t); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[z$95$m, 4.5e-95], N[(N[(-2.0 / z$95$m), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x / z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 4.5 \cdot 10^{-95}:\\
\;\;\;\;\frac{-2}{z\_m} \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{z\_m}}{t}\\
\end{array}
\end{array}
if z < 4.5e-95Initial program 94.0%
distribute-rgt-out--94.0%
Simplified94.0%
Taylor expanded in y around 0 47.2%
associate-*r*47.2%
neg-mul-147.2%
*-commutative47.2%
Simplified47.2%
frac-2neg47.2%
*-commutative47.2%
distribute-lft-neg-in47.2%
metadata-eval47.2%
distribute-rgt-neg-out47.2%
remove-double-neg47.2%
times-frac48.7%
Applied egg-rr48.7%
if 4.5e-95 < z Initial program 83.0%
distribute-rgt-out--84.5%
Simplified84.5%
Taylor expanded in y around 0 47.6%
*-commutative47.6%
associate-/r*54.4%
Simplified54.4%
z\_m = (fabs.f64 z) z\_s = (copysign.f64 #s(literal 1 binary64) z) (FPCore (z_s x y z_m t) :precision binary64 (* z_s (if (<= z_m 1.1e+40) (* -2.0 (/ x (* z_m t))) (* -2.0 (/ (/ x z_m) t)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.1e+40) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 1.1d+40) then
tmp = (-2.0d0) * (x / (z_m * t))
else
tmp = (-2.0d0) * ((x / z_m) / t)
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.1e+40) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if z_m <= 1.1e+40: tmp = -2.0 * (x / (z_m * t)) else: tmp = -2.0 * ((x / z_m) / t) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (z_m <= 1.1e+40) tmp = Float64(-2.0 * Float64(x / Float64(z_m * t))); else tmp = Float64(-2.0 * Float64(Float64(x / z_m) / t)); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (z_m <= 1.1e+40) tmp = -2.0 * (x / (z_m * t)); else tmp = -2.0 * ((x / z_m) / t); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[z$95$m, 1.1e+40], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x / z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 1.1 \cdot 10^{+40}:\\
\;\;\;\;-2 \cdot \frac{x}{z\_m \cdot t}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{z\_m}}{t}\\
\end{array}
\end{array}
if z < 1.0999999999999999e40Initial program 94.9%
distribute-rgt-out--94.9%
Simplified94.9%
Taylor expanded in y around 0 49.6%
*-commutative49.6%
Simplified49.6%
if 1.0999999999999999e40 < z Initial program 72.1%
distribute-rgt-out--74.7%
Simplified74.7%
Taylor expanded in y around 0 38.3%
*-commutative38.3%
associate-/r*49.5%
Simplified49.5%
z\_m = (fabs.f64 z) z\_s = (copysign.f64 #s(literal 1 binary64) z) (FPCore (z_s x y z_m t) :precision binary64 (* z_s (* -2.0 (/ x (* z_m t)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
return z_s * (-2.0 * (x / (z_m * t)));
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = z_s * ((-2.0d0) * (x / (z_m * t)))
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
return z_s * (-2.0 * (x / (z_m * t)));
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): return z_s * (-2.0 * (x / (z_m * t)))
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) return Float64(z_s * Float64(-2.0 * Float64(x / Float64(z_m * t)))) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp = code(z_s, x, y, z_m, t) tmp = z_s * (-2.0 * (x / (z_m * t))); end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(-2 \cdot \frac{x}{z\_m \cdot t}\right)
\end{array}
Initial program 90.4%
distribute-rgt-out--90.9%
Simplified90.9%
Taylor expanded in y around 0 47.3%
*-commutative47.3%
Simplified47.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 2024116
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
:alt
(! :herbie-platform default (if (< (/ (* x 2) (- (* y z) (* t z))) -2559141628295061/10000000000000000000000000000) (* (/ x (* (- y t) z)) 2) (if (< (/ (* x 2) (- (* y z) (* t z))) 522513913665063/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (* (/ x z) 2) (- y t)) (* (/ x (* (- y t) z)) 2))))
(/ (* x 2.0) (- (* y z) (* t z))))