
(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 13 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}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= (* x_m 2.0) 5e+103)
(/ (* -2.0 (/ x_m z)) (- t y))
(* (/ x_m (- y t)) (/ 2.0 z)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((x_m * 2.0) <= 5e+103) {
tmp = (-2.0 * (x_m / z)) / (t - y);
} else {
tmp = (x_m / (y - t)) * (2.0 / z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x_m * 2.0d0) <= 5d+103) then
tmp = ((-2.0d0) * (x_m / z)) / (t - y)
else
tmp = (x_m / (y - t)) * (2.0d0 / z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((x_m * 2.0) <= 5e+103) {
tmp = (-2.0 * (x_m / z)) / (t - y);
} else {
tmp = (x_m / (y - t)) * (2.0 / z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if (x_m * 2.0) <= 5e+103: tmp = (-2.0 * (x_m / z)) / (t - y) else: tmp = (x_m / (y - t)) * (2.0 / z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (Float64(x_m * 2.0) <= 5e+103) tmp = Float64(Float64(-2.0 * Float64(x_m / z)) / Float64(t - y)); else tmp = Float64(Float64(x_m / Float64(y - t)) * Float64(2.0 / z)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if ((x_m * 2.0) <= 5e+103) tmp = (-2.0 * (x_m / z)) / (t - y); else tmp = (x_m / (y - t)) * (2.0 / z); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[N[(x$95$m * 2.0), $MachinePrecision], 5e+103], N[(N[(-2.0 * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] / N[(t - y), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot 2 \leq 5 \cdot 10^{+103}:\\
\;\;\;\;\frac{-2 \cdot \frac{x\_m}{z}}{t - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y - t} \cdot \frac{2}{z}\\
\end{array}
\end{array}
if (*.f64 x #s(literal 2 binary64)) < 5e103Initial program 86.8%
distribute-rgt-out--92.5%
Simplified92.5%
Taylor expanded in x around 0 92.5%
associate-*r/92.5%
metadata-eval92.5%
distribute-lft-neg-in92.5%
*-commutative92.5%
distribute-neg-frac92.5%
associate-/r*95.4%
*-commutative95.4%
associate-*r/95.4%
distribute-neg-frac295.4%
neg-sub095.4%
sub-neg95.4%
+-commutative95.4%
associate--r+95.4%
neg-sub095.4%
remove-double-neg95.4%
Simplified95.4%
if 5e103 < (*.f64 x #s(literal 2 binary64)) Initial program 90.7%
distribute-rgt-out--90.7%
Simplified90.7%
*-commutative90.7%
times-frac99.6%
Applied egg-rr99.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= y -5e+73) (not (<= y 3.5e-52)))
(* x_m (/ 2.0 (* z y)))
(* -2.0 (/ (/ x_m z) t)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((y <= -5e+73) || !(y <= 3.5e-52)) {
tmp = x_m * (2.0 / (z * y));
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-5d+73)) .or. (.not. (y <= 3.5d-52))) then
tmp = x_m * (2.0d0 / (z * y))
else
tmp = (-2.0d0) * ((x_m / z) / t)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((y <= -5e+73) || !(y <= 3.5e-52)) {
tmp = x_m * (2.0 / (z * y));
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if (y <= -5e+73) or not (y <= 3.5e-52): tmp = x_m * (2.0 / (z * y)) else: tmp = -2.0 * ((x_m / z) / t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if ((y <= -5e+73) || !(y <= 3.5e-52)) tmp = Float64(x_m * Float64(2.0 / Float64(z * y))); else tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if ((y <= -5e+73) || ~((y <= 3.5e-52))) tmp = x_m * (2.0 / (z * y)); else tmp = -2.0 * ((x_m / z) / t); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[y, -5e+73], N[Not[LessEqual[y, 3.5e-52]], $MachinePrecision]], N[(x$95$m * N[(2.0 / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+73} \lor \neg \left(y \leq 3.5 \cdot 10^{-52}\right):\\
\;\;\;\;x\_m \cdot \frac{2}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if y < -4.99999999999999976e73 or 3.5e-52 < y Initial program 81.0%
distribute-rgt-out--89.6%
Simplified89.6%
distribute-rgt-out--81.0%
associate-/l*81.0%
*-commutative81.0%
distribute-rgt-out--89.6%
Applied egg-rr89.6%
Taylor expanded in y around inf 75.6%
*-commutative75.6%
Simplified75.6%
if -4.99999999999999976e73 < y < 3.5e-52Initial program 92.3%
distribute-rgt-out--94.4%
Simplified94.4%
Taylor expanded in y around 0 79.5%
*-commutative79.5%
associate-/r*80.7%
Simplified80.7%
Final simplification78.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= y -4e+77)
(/ (* 2.0 (/ x_m z)) y)
(if (<= y 2e-52) (/ (/ (* x_m -2.0) z) t) (/ (/ x_m y) (* z 0.5))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -4e+77) {
tmp = (2.0 * (x_m / z)) / y;
} else if (y <= 2e-52) {
tmp = ((x_m * -2.0) / z) / t;
} else {
tmp = (x_m / y) / (z * 0.5);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-4d+77)) then
tmp = (2.0d0 * (x_m / z)) / y
else if (y <= 2d-52) then
tmp = ((x_m * (-2.0d0)) / z) / t
else
tmp = (x_m / y) / (z * 0.5d0)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -4e+77) {
tmp = (2.0 * (x_m / z)) / y;
} else if (y <= 2e-52) {
tmp = ((x_m * -2.0) / z) / t;
} else {
tmp = (x_m / y) / (z * 0.5);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if y <= -4e+77: tmp = (2.0 * (x_m / z)) / y elif y <= 2e-52: tmp = ((x_m * -2.0) / z) / t else: tmp = (x_m / y) / (z * 0.5) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= -4e+77) tmp = Float64(Float64(2.0 * Float64(x_m / z)) / y); elseif (y <= 2e-52) tmp = Float64(Float64(Float64(x_m * -2.0) / z) / t); else tmp = Float64(Float64(x_m / y) / Float64(z * 0.5)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (y <= -4e+77) tmp = (2.0 * (x_m / z)) / y; elseif (y <= 2e-52) tmp = ((x_m * -2.0) / z) / t; else tmp = (x_m / y) / (z * 0.5); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -4e+77], N[(N[(2.0 * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 2e-52], N[(N[(N[(x$95$m * -2.0), $MachinePrecision] / z), $MachinePrecision] / t), $MachinePrecision], N[(N[(x$95$m / y), $MachinePrecision] / N[(z * 0.5), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+77}:\\
\;\;\;\;\frac{2 \cdot \frac{x\_m}{z}}{y}\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-52}:\\
\;\;\;\;\frac{\frac{x\_m \cdot -2}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{z \cdot 0.5}\\
\end{array}
\end{array}
if y < -3.99999999999999993e77Initial program 77.2%
distribute-rgt-out--88.3%
Simplified88.3%
*-commutative88.3%
times-frac86.8%
Applied egg-rr86.8%
Taylor expanded in y around inf 71.8%
associate-*l/82.0%
associate-*r/82.1%
*-commutative82.1%
associate-/l*82.1%
Applied egg-rr82.1%
if -3.99999999999999993e77 < y < 2e-52Initial program 92.3%
distribute-rgt-out--94.4%
Simplified94.4%
Taylor expanded in y around 0 79.5%
*-commutative79.5%
Simplified79.5%
*-commutative79.5%
associate-*l/79.5%
metadata-eval79.5%
distribute-rgt-neg-in79.5%
associate-/r*80.7%
distribute-rgt-neg-in80.7%
metadata-eval80.7%
Applied egg-rr80.7%
if 2e-52 < y Initial program 83.3%
distribute-rgt-out--90.4%
Simplified90.4%
*-commutative90.4%
times-frac96.0%
Applied egg-rr96.0%
Taylor expanded in y around inf 80.2%
clear-num80.2%
un-div-inv80.2%
div-inv80.2%
metadata-eval80.2%
Applied egg-rr80.2%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= y -5.3e+73)
(/ (* 2.0 (/ x_m z)) y)
(if (<= y 1.25e-52) (* -2.0 (/ (/ x_m z) t)) (/ (/ x_m y) (* z 0.5))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -5.3e+73) {
tmp = (2.0 * (x_m / z)) / y;
} else if (y <= 1.25e-52) {
tmp = -2.0 * ((x_m / z) / t);
} else {
tmp = (x_m / y) / (z * 0.5);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-5.3d+73)) then
tmp = (2.0d0 * (x_m / z)) / y
else if (y <= 1.25d-52) then
tmp = (-2.0d0) * ((x_m / z) / t)
else
tmp = (x_m / y) / (z * 0.5d0)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -5.3e+73) {
tmp = (2.0 * (x_m / z)) / y;
} else if (y <= 1.25e-52) {
tmp = -2.0 * ((x_m / z) / t);
} else {
tmp = (x_m / y) / (z * 0.5);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if y <= -5.3e+73: tmp = (2.0 * (x_m / z)) / y elif y <= 1.25e-52: tmp = -2.0 * ((x_m / z) / t) else: tmp = (x_m / y) / (z * 0.5) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= -5.3e+73) tmp = Float64(Float64(2.0 * Float64(x_m / z)) / y); elseif (y <= 1.25e-52) tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); else tmp = Float64(Float64(x_m / y) / Float64(z * 0.5)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (y <= -5.3e+73) tmp = (2.0 * (x_m / z)) / y; elseif (y <= 1.25e-52) tmp = -2.0 * ((x_m / z) / t); else tmp = (x_m / y) / (z * 0.5); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -5.3e+73], N[(N[(2.0 * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 1.25e-52], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / y), $MachinePrecision] / N[(z * 0.5), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -5.3 \cdot 10^{+73}:\\
\;\;\;\;\frac{2 \cdot \frac{x\_m}{z}}{y}\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{-52}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{z \cdot 0.5}\\
\end{array}
\end{array}
if y < -5.29999999999999996e73Initial program 77.2%
distribute-rgt-out--88.3%
Simplified88.3%
*-commutative88.3%
times-frac86.8%
Applied egg-rr86.8%
Taylor expanded in y around inf 71.8%
associate-*l/82.0%
associate-*r/82.1%
*-commutative82.1%
associate-/l*82.1%
Applied egg-rr82.1%
if -5.29999999999999996e73 < y < 1.25e-52Initial program 92.3%
distribute-rgt-out--94.4%
Simplified94.4%
Taylor expanded in y around 0 79.5%
*-commutative79.5%
associate-/r*80.7%
Simplified80.7%
if 1.25e-52 < y Initial program 83.3%
distribute-rgt-out--90.4%
Simplified90.4%
*-commutative90.4%
times-frac96.0%
Applied egg-rr96.0%
Taylor expanded in y around inf 80.2%
clear-num80.2%
un-div-inv80.2%
div-inv80.2%
metadata-eval80.2%
Applied egg-rr80.2%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= y -3.6e+78)
(/ (* 2.0 (/ x_m z)) y)
(if (<= y 1.55e-52) (* -2.0 (/ (/ x_m z) t)) (* (/ 2.0 z) (/ x_m y))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -3.6e+78) {
tmp = (2.0 * (x_m / z)) / y;
} else if (y <= 1.55e-52) {
tmp = -2.0 * ((x_m / z) / t);
} else {
tmp = (2.0 / z) * (x_m / y);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-3.6d+78)) then
tmp = (2.0d0 * (x_m / z)) / y
else if (y <= 1.55d-52) then
tmp = (-2.0d0) * ((x_m / z) / t)
else
tmp = (2.0d0 / z) * (x_m / y)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -3.6e+78) {
tmp = (2.0 * (x_m / z)) / y;
} else if (y <= 1.55e-52) {
tmp = -2.0 * ((x_m / z) / t);
} else {
tmp = (2.0 / z) * (x_m / y);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if y <= -3.6e+78: tmp = (2.0 * (x_m / z)) / y elif y <= 1.55e-52: tmp = -2.0 * ((x_m / z) / t) else: tmp = (2.0 / z) * (x_m / y) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= -3.6e+78) tmp = Float64(Float64(2.0 * Float64(x_m / z)) / y); elseif (y <= 1.55e-52) tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); else tmp = Float64(Float64(2.0 / z) * Float64(x_m / y)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (y <= -3.6e+78) tmp = (2.0 * (x_m / z)) / y; elseif (y <= 1.55e-52) tmp = -2.0 * ((x_m / z) / t); else tmp = (2.0 / z) * (x_m / y); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -3.6e+78], N[(N[(2.0 * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 1.55e-52], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -3.6 \cdot 10^{+78}:\\
\;\;\;\;\frac{2 \cdot \frac{x\_m}{z}}{y}\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{-52}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\end{array}
\end{array}
if y < -3.6000000000000002e78Initial program 77.2%
distribute-rgt-out--88.3%
Simplified88.3%
*-commutative88.3%
times-frac86.8%
Applied egg-rr86.8%
Taylor expanded in y around inf 71.8%
associate-*l/82.0%
associate-*r/82.1%
*-commutative82.1%
associate-/l*82.1%
Applied egg-rr82.1%
if -3.6000000000000002e78 < y < 1.5499999999999999e-52Initial program 92.3%
distribute-rgt-out--94.4%
Simplified94.4%
Taylor expanded in y around 0 79.5%
*-commutative79.5%
associate-/r*80.7%
Simplified80.7%
if 1.5499999999999999e-52 < y Initial program 83.3%
distribute-rgt-out--90.4%
Simplified90.4%
*-commutative90.4%
times-frac96.0%
Applied egg-rr96.0%
Taylor expanded in y around inf 80.2%
Final simplification80.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= y -7.8e+73)
(* (/ x_m z) (/ 2.0 y))
(if (<= y 4.4e-52) (* -2.0 (/ (/ x_m z) t)) (* (/ 2.0 z) (/ x_m y))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -7.8e+73) {
tmp = (x_m / z) * (2.0 / y);
} else if (y <= 4.4e-52) {
tmp = -2.0 * ((x_m / z) / t);
} else {
tmp = (2.0 / z) * (x_m / y);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-7.8d+73)) then
tmp = (x_m / z) * (2.0d0 / y)
else if (y <= 4.4d-52) then
tmp = (-2.0d0) * ((x_m / z) / t)
else
tmp = (2.0d0 / z) * (x_m / y)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -7.8e+73) {
tmp = (x_m / z) * (2.0 / y);
} else if (y <= 4.4e-52) {
tmp = -2.0 * ((x_m / z) / t);
} else {
tmp = (2.0 / z) * (x_m / y);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if y <= -7.8e+73: tmp = (x_m / z) * (2.0 / y) elif y <= 4.4e-52: tmp = -2.0 * ((x_m / z) / t) else: tmp = (2.0 / z) * (x_m / y) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= -7.8e+73) tmp = Float64(Float64(x_m / z) * Float64(2.0 / y)); elseif (y <= 4.4e-52) tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); else tmp = Float64(Float64(2.0 / z) * Float64(x_m / y)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (y <= -7.8e+73) tmp = (x_m / z) * (2.0 / y); elseif (y <= 4.4e-52) tmp = -2.0 * ((x_m / z) / t); else tmp = (2.0 / z) * (x_m / y); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -7.8e+73], N[(N[(x$95$m / z), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.4e-52], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{+73}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{2}{y}\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{-52}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\end{array}
\end{array}
if y < -7.8000000000000002e73Initial program 77.2%
distribute-rgt-out--88.3%
Simplified88.3%
Taylor expanded in y around inf 77.0%
*-commutative77.0%
Simplified77.0%
times-frac82.0%
Applied egg-rr82.0%
if -7.8000000000000002e73 < y < 4.40000000000000018e-52Initial program 92.3%
distribute-rgt-out--94.4%
Simplified94.4%
Taylor expanded in y around 0 79.5%
*-commutative79.5%
associate-/r*80.7%
Simplified80.7%
if 4.40000000000000018e-52 < y Initial program 83.3%
distribute-rgt-out--90.4%
Simplified90.4%
*-commutative90.4%
times-frac96.0%
Applied egg-rr96.0%
Taylor expanded in y around inf 80.2%
Final simplification80.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= y -5e+73)
(* x_m (/ 2.0 (* z y)))
(if (<= y 6.5e-52) (* -2.0 (/ (/ x_m z) t)) (* (/ 2.0 z) (/ x_m y))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -5e+73) {
tmp = x_m * (2.0 / (z * y));
} else if (y <= 6.5e-52) {
tmp = -2.0 * ((x_m / z) / t);
} else {
tmp = (2.0 / z) * (x_m / y);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-5d+73)) then
tmp = x_m * (2.0d0 / (z * y))
else if (y <= 6.5d-52) then
tmp = (-2.0d0) * ((x_m / z) / t)
else
tmp = (2.0d0 / z) * (x_m / y)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -5e+73) {
tmp = x_m * (2.0 / (z * y));
} else if (y <= 6.5e-52) {
tmp = -2.0 * ((x_m / z) / t);
} else {
tmp = (2.0 / z) * (x_m / y);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if y <= -5e+73: tmp = x_m * (2.0 / (z * y)) elif y <= 6.5e-52: tmp = -2.0 * ((x_m / z) / t) else: tmp = (2.0 / z) * (x_m / y) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= -5e+73) tmp = Float64(x_m * Float64(2.0 / Float64(z * y))); elseif (y <= 6.5e-52) tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); else tmp = Float64(Float64(2.0 / z) * Float64(x_m / y)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (y <= -5e+73) tmp = x_m * (2.0 / (z * y)); elseif (y <= 6.5e-52) tmp = -2.0 * ((x_m / z) / t); else tmp = (2.0 / z) * (x_m / y); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -5e+73], N[(x$95$m * N[(2.0 / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.5e-52], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+73}:\\
\;\;\;\;x\_m \cdot \frac{2}{z \cdot y}\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{-52}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\end{array}
\end{array}
if y < -4.99999999999999976e73Initial program 77.2%
distribute-rgt-out--88.3%
Simplified88.3%
distribute-rgt-out--77.2%
associate-/l*77.1%
*-commutative77.1%
distribute-rgt-out--88.2%
Applied egg-rr88.2%
Taylor expanded in y around inf 77.0%
*-commutative77.0%
Simplified77.0%
if -4.99999999999999976e73 < y < 6.5e-52Initial program 92.3%
distribute-rgt-out--94.4%
Simplified94.4%
Taylor expanded in y around 0 79.5%
*-commutative79.5%
associate-/r*80.7%
Simplified80.7%
if 6.5e-52 < y Initial program 83.3%
distribute-rgt-out--90.4%
Simplified90.4%
*-commutative90.4%
times-frac96.0%
Applied egg-rr96.0%
Taylor expanded in y around inf 80.2%
Final simplification80.0%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= (* x_m 2.0) 5e+78)
(* (/ x_m z) (/ 2.0 (- y t)))
(* (/ x_m (- y t)) (/ 2.0 z)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((x_m * 2.0) <= 5e+78) {
tmp = (x_m / z) * (2.0 / (y - t));
} else {
tmp = (x_m / (y - t)) * (2.0 / z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x_m * 2.0d0) <= 5d+78) then
tmp = (x_m / z) * (2.0d0 / (y - t))
else
tmp = (x_m / (y - t)) * (2.0d0 / z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((x_m * 2.0) <= 5e+78) {
tmp = (x_m / z) * (2.0 / (y - t));
} else {
tmp = (x_m / (y - t)) * (2.0 / z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if (x_m * 2.0) <= 5e+78: tmp = (x_m / z) * (2.0 / (y - t)) else: tmp = (x_m / (y - t)) * (2.0 / z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (Float64(x_m * 2.0) <= 5e+78) tmp = Float64(Float64(x_m / z) * Float64(2.0 / Float64(y - t))); else tmp = Float64(Float64(x_m / Float64(y - t)) * Float64(2.0 / z)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if ((x_m * 2.0) <= 5e+78) tmp = (x_m / z) * (2.0 / (y - t)); else tmp = (x_m / (y - t)) * (2.0 / z); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[N[(x$95$m * 2.0), $MachinePrecision], 5e+78], N[(N[(x$95$m / z), $MachinePrecision] * N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot 2 \leq 5 \cdot 10^{+78}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{2}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y - t} \cdot \frac{2}{z}\\
\end{array}
\end{array}
if (*.f64 x #s(literal 2 binary64)) < 4.99999999999999984e78Initial program 86.9%
distribute-rgt-out--92.8%
Simplified92.8%
times-frac95.2%
Applied egg-rr95.2%
if 4.99999999999999984e78 < (*.f64 x #s(literal 2 binary64)) Initial program 89.5%
distribute-rgt-out--89.5%
Simplified89.5%
*-commutative89.5%
times-frac99.6%
Applied egg-rr99.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= z 1.15e-42)
(* x_m (/ 2.0 (* z (- y t))))
(* (/ x_m z) (/ 2.0 (- y t))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= 1.15e-42) {
tmp = x_m * (2.0 / (z * (y - t)));
} else {
tmp = (x_m / z) * (2.0 / (y - t));
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 1.15d-42) then
tmp = x_m * (2.0d0 / (z * (y - t)))
else
tmp = (x_m / z) * (2.0d0 / (y - t))
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= 1.15e-42) {
tmp = x_m * (2.0 / (z * (y - t)));
} else {
tmp = (x_m / z) * (2.0 / (y - t));
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if z <= 1.15e-42: tmp = x_m * (2.0 / (z * (y - t))) else: tmp = (x_m / z) * (2.0 / (y - t)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= 1.15e-42) tmp = Float64(x_m * Float64(2.0 / Float64(z * Float64(y - t)))); else tmp = Float64(Float64(x_m / z) * Float64(2.0 / Float64(y - t))); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (z <= 1.15e-42) tmp = x_m * (2.0 / (z * (y - t))); else tmp = (x_m / z) * (2.0 / (y - t)); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, 1.15e-42], N[(x$95$m * N[(2.0 / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1.15 \cdot 10^{-42}:\\
\;\;\;\;x\_m \cdot \frac{2}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{2}{y - t}\\
\end{array}
\end{array}
if z < 1.15000000000000002e-42Initial program 89.3%
distribute-rgt-out--93.2%
Simplified93.2%
distribute-rgt-out--89.3%
associate-/l*89.3%
*-commutative89.3%
distribute-rgt-out--93.2%
Applied egg-rr93.2%
if 1.15000000000000002e-42 < z Initial program 82.7%
distribute-rgt-out--90.3%
Simplified90.3%
times-frac98.5%
Applied egg-rr98.5%
Final simplification94.8%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= z 1.05e-218) (* x_m (/ -2.0 (* z t))) (* -2.0 (/ (/ x_m z) t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= 1.05e-218) {
tmp = x_m * (-2.0 / (z * t));
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 1.05d-218) then
tmp = x_m * ((-2.0d0) / (z * t))
else
tmp = (-2.0d0) * ((x_m / z) / t)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= 1.05e-218) {
tmp = x_m * (-2.0 / (z * t));
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if z <= 1.05e-218: tmp = x_m * (-2.0 / (z * t)) else: tmp = -2.0 * ((x_m / z) / t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= 1.05e-218) tmp = Float64(x_m * Float64(-2.0 / Float64(z * t))); else tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (z <= 1.05e-218) tmp = x_m * (-2.0 / (z * t)); else tmp = -2.0 * ((x_m / z) / t); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, 1.05e-218], N[(x$95$m * N[(-2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1.05 \cdot 10^{-218}:\\
\;\;\;\;x\_m \cdot \frac{-2}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if z < 1.04999999999999997e-218Initial program 88.1%
distribute-rgt-out--92.0%
Simplified92.0%
distribute-rgt-out--88.1%
associate-/l*88.0%
*-commutative88.0%
distribute-rgt-out--92.0%
Applied egg-rr92.0%
Taylor expanded in y around 0 62.4%
*-commutative62.4%
Simplified62.4%
if 1.04999999999999997e-218 < z Initial program 86.1%
distribute-rgt-out--92.7%
Simplified92.7%
Taylor expanded in y around 0 60.7%
*-commutative60.7%
associate-/r*63.9%
Simplified63.9%
Final simplification63.0%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= z 1.55e-218) (* -2.0 (/ x_m (* z t))) (* -2.0 (/ (/ x_m z) t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= 1.55e-218) {
tmp = -2.0 * (x_m / (z * t));
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 1.55d-218) then
tmp = (-2.0d0) * (x_m / (z * t))
else
tmp = (-2.0d0) * ((x_m / z) / t)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= 1.55e-218) {
tmp = -2.0 * (x_m / (z * t));
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if z <= 1.55e-218: tmp = -2.0 * (x_m / (z * t)) else: tmp = -2.0 * ((x_m / z) / t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= 1.55e-218) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); else tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (z <= 1.55e-218) tmp = -2.0 * (x_m / (z * t)); else tmp = -2.0 * ((x_m / z) / t); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, 1.55e-218], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1.55 \cdot 10^{-218}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if z < 1.54999999999999999e-218Initial program 88.1%
distribute-rgt-out--92.0%
Simplified92.0%
Taylor expanded in y around 0 62.4%
*-commutative62.4%
Simplified62.4%
if 1.54999999999999999e-218 < z Initial program 86.1%
distribute-rgt-out--92.7%
Simplified92.7%
Taylor expanded in y around 0 60.7%
*-commutative60.7%
associate-/r*63.9%
Simplified63.9%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* x_m (/ 2.0 (* z (- y t))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (x_m * (2.0 / (z * (y - t))));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x_s * (x_m * (2.0d0 / (z * (y - t))))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (x_m * (2.0 / (z * (y - t))));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * (x_m * (2.0 / (z * (y - t))))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(x_m * Float64(2.0 / Float64(z * Float64(y - t))))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z, t) tmp = x_s * (x_m * (2.0 / (z * (y - t)))); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m * N[(2.0 / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(x\_m \cdot \frac{2}{z \cdot \left(y - t\right)}\right)
\end{array}
Initial program 87.3%
distribute-rgt-out--92.3%
Simplified92.3%
distribute-rgt-out--87.3%
associate-/l*87.2%
*-commutative87.2%
distribute-rgt-out--92.3%
Applied egg-rr92.3%
Final simplification92.3%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* -2.0 (/ x_m (* z t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (-2.0 * (x_m / (z * t)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x_s * ((-2.0d0) * (x_m / (z * t)))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (-2.0 * (x_m / (z * t)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * (-2.0 * (x_m / (z * t)))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(-2.0 * Float64(x_m / Float64(z * t)))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z, t) tmp = x_s * (-2.0 * (x_m / (z * t))); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(-2 \cdot \frac{x\_m}{z \cdot t}\right)
\end{array}
Initial program 87.3%
distribute-rgt-out--92.3%
Simplified92.3%
Taylor expanded in y around 0 61.7%
*-commutative61.7%
Simplified61.7%
(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 2024132
(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))))