
(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)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(let* ((t_1 (sqrt (* x_m 2.0))))
(*
z_s
(*
x_s
(if (<= z_m 1.12e-96)
(/ (* x_m 2.0) (* z_m (- y t)))
(* (/ t_1 (- y t)) (/ t_1 z_m)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double t_1 = sqrt((x_m * 2.0));
double tmp;
if (z_m <= 1.12e-96) {
tmp = (x_m * 2.0) / (z_m * (y - t));
} else {
tmp = (t_1 / (y - t)) * (t_1 / z_m);
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x_m * 2.0d0))
if (z_m <= 1.12d-96) then
tmp = (x_m * 2.0d0) / (z_m * (y - t))
else
tmp = (t_1 / (y - t)) * (t_1 / z_m)
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double t_1 = Math.sqrt((x_m * 2.0));
double tmp;
if (z_m <= 1.12e-96) {
tmp = (x_m * 2.0) / (z_m * (y - t));
} else {
tmp = (t_1 / (y - t)) * (t_1 / z_m);
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): t_1 = math.sqrt((x_m * 2.0)) tmp = 0 if z_m <= 1.12e-96: tmp = (x_m * 2.0) / (z_m * (y - t)) else: tmp = (t_1 / (y - t)) * (t_1 / z_m) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) t_1 = sqrt(Float64(x_m * 2.0)) tmp = 0.0 if (z_m <= 1.12e-96) tmp = Float64(Float64(x_m * 2.0) / Float64(z_m * Float64(y - t))); else tmp = Float64(Float64(t_1 / Float64(y - t)) * Float64(t_1 / z_m)); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) t_1 = sqrt((x_m * 2.0)); tmp = 0.0; if (z_m <= 1.12e-96) tmp = (x_m * 2.0) / (z_m * (y - t)); else tmp = (t_1 / (y - t)) * (t_1 / z_m); end tmp_2 = z_s * (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]
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$95$s_, x$95$m_, y_, z$95$m_, t_] := Block[{t$95$1 = N[Sqrt[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision]}, N[(z$95$s * N[(x$95$s * If[LessEqual[z$95$m, 1.12e-96], N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
\begin{array}{l}
t_1 := \sqrt{x\_m \cdot 2}\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 1.12 \cdot 10^{-96}:\\
\;\;\;\;\frac{x\_m \cdot 2}{z\_m \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{y - t} \cdot \frac{t\_1}{z\_m}\\
\end{array}\right)
\end{array}
\end{array}
if z < 1.1200000000000001e-96Initial program 88.8%
distribute-rgt-out--91.3%
Simplified91.3%
if 1.1200000000000001e-96 < z Initial program 87.3%
distribute-rgt-out--92.7%
Simplified92.7%
add-sqr-sqrt43.5%
*-commutative43.5%
times-frac44.6%
Applied egg-rr44.6%
Final simplification75.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (or (<= y -4e-21) (not (<= y 3e+39)))
(* (/ 2.0 z_m) (/ x_m y))
(* -2.0 (/ (/ x_m z_m) t))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((y <= -4e-21) || !(y <= 3e+39)) {
tmp = (2.0 / z_m) * (x_m / y);
} else {
tmp = -2.0 * ((x_m / z_m) / t);
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-4d-21)) .or. (.not. (y <= 3d+39))) then
tmp = (2.0d0 / z_m) * (x_m / y)
else
tmp = (-2.0d0) * ((x_m / z_m) / t)
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((y <= -4e-21) || !(y <= 3e+39)) {
tmp = (2.0 / z_m) * (x_m / y);
} else {
tmp = -2.0 * ((x_m / z_m) / t);
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if (y <= -4e-21) or not (y <= 3e+39): tmp = (2.0 / z_m) * (x_m / y) else: tmp = -2.0 * ((x_m / z_m) / t) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if ((y <= -4e-21) || !(y <= 3e+39)) tmp = Float64(Float64(2.0 / z_m) * Float64(x_m / y)); else tmp = Float64(-2.0 * Float64(Float64(x_m / z_m) / t)); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if ((y <= -4e-21) || ~((y <= 3e+39))) tmp = (2.0 / z_m) * (x_m / y); else tmp = -2.0 * ((x_m / z_m) / t); end tmp_2 = z_s * (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]
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$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[Or[LessEqual[y, -4e-21], N[Not[LessEqual[y, 3e+39]], $MachinePrecision]], N[(N[(2.0 / z$95$m), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-21} \lor \neg \left(y \leq 3 \cdot 10^{+39}\right):\\
\;\;\;\;\frac{2}{z\_m} \cdot \frac{x\_m}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z\_m}}{t}\\
\end{array}\right)
\end{array}
if y < -3.99999999999999963e-21 or 3e39 < y Initial program 85.3%
distribute-rgt-out--90.9%
Simplified90.9%
Taylor expanded in y around inf 80.3%
associate-*r/80.3%
*-commutative80.3%
Simplified80.3%
times-frac75.5%
*-commutative75.5%
Applied egg-rr75.5%
if -3.99999999999999963e-21 < y < 3e39Initial program 90.9%
distribute-rgt-out--92.6%
Simplified92.6%
Taylor expanded in y around 0 81.2%
associate-/l/82.0%
Simplified82.0%
Final simplification78.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (or (<= y -8.5e-26) (not (<= y 4.6e+38)))
(* (/ x_m z_m) (/ 2.0 y))
(* -2.0 (/ (/ x_m z_m) t))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((y <= -8.5e-26) || !(y <= 4.6e+38)) {
tmp = (x_m / z_m) * (2.0 / y);
} else {
tmp = -2.0 * ((x_m / z_m) / t);
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-8.5d-26)) .or. (.not. (y <= 4.6d+38))) then
tmp = (x_m / z_m) * (2.0d0 / y)
else
tmp = (-2.0d0) * ((x_m / z_m) / t)
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((y <= -8.5e-26) || !(y <= 4.6e+38)) {
tmp = (x_m / z_m) * (2.0 / y);
} else {
tmp = -2.0 * ((x_m / z_m) / t);
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if (y <= -8.5e-26) or not (y <= 4.6e+38): tmp = (x_m / z_m) * (2.0 / y) else: tmp = -2.0 * ((x_m / z_m) / t) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if ((y <= -8.5e-26) || !(y <= 4.6e+38)) tmp = Float64(Float64(x_m / z_m) * Float64(2.0 / y)); else tmp = Float64(-2.0 * Float64(Float64(x_m / z_m) / t)); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if ((y <= -8.5e-26) || ~((y <= 4.6e+38))) tmp = (x_m / z_m) * (2.0 / y); else tmp = -2.0 * ((x_m / z_m) / t); end tmp_2 = z_s * (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]
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$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[Or[LessEqual[y, -8.5e-26], N[Not[LessEqual[y, 4.6e+38]], $MachinePrecision]], N[(N[(x$95$m / z$95$m), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{-26} \lor \neg \left(y \leq 4.6 \cdot 10^{+38}\right):\\
\;\;\;\;\frac{x\_m}{z\_m} \cdot \frac{2}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z\_m}}{t}\\
\end{array}\right)
\end{array}
if y < -8.50000000000000004e-26 or 4.6000000000000002e38 < y Initial program 85.3%
distribute-rgt-out--90.9%
Simplified90.9%
Taylor expanded in y around inf 80.3%
associate-*r/80.3%
*-commutative80.3%
*-commutative80.3%
times-frac79.3%
Simplified79.3%
if -8.50000000000000004e-26 < y < 4.6000000000000002e38Initial program 90.9%
distribute-rgt-out--92.6%
Simplified92.6%
Taylor expanded in y around 0 81.2%
associate-/l/82.0%
Simplified82.0%
Final simplification80.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (or (<= y -1.1e-22) (not (<= y 1.2e+41)))
(* (/ x_m z_m) (/ 2.0 y))
(/ -2.0 (* t (/ z_m x_m)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((y <= -1.1e-22) || !(y <= 1.2e+41)) {
tmp = (x_m / z_m) * (2.0 / y);
} else {
tmp = -2.0 / (t * (z_m / x_m));
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.1d-22)) .or. (.not. (y <= 1.2d+41))) then
tmp = (x_m / z_m) * (2.0d0 / y)
else
tmp = (-2.0d0) / (t * (z_m / x_m))
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((y <= -1.1e-22) || !(y <= 1.2e+41)) {
tmp = (x_m / z_m) * (2.0 / y);
} else {
tmp = -2.0 / (t * (z_m / x_m));
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if (y <= -1.1e-22) or not (y <= 1.2e+41): tmp = (x_m / z_m) * (2.0 / y) else: tmp = -2.0 / (t * (z_m / x_m)) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if ((y <= -1.1e-22) || !(y <= 1.2e+41)) tmp = Float64(Float64(x_m / z_m) * Float64(2.0 / y)); else tmp = Float64(-2.0 / Float64(t * Float64(z_m / x_m))); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if ((y <= -1.1e-22) || ~((y <= 1.2e+41))) tmp = (x_m / z_m) * (2.0 / y); else tmp = -2.0 / (t * (z_m / x_m)); end tmp_2 = z_s * (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]
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$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[Or[LessEqual[y, -1.1e-22], N[Not[LessEqual[y, 1.2e+41]], $MachinePrecision]], N[(N[(x$95$m / z$95$m), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 / N[(t * N[(z$95$m / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-22} \lor \neg \left(y \leq 1.2 \cdot 10^{+41}\right):\\
\;\;\;\;\frac{x\_m}{z\_m} \cdot \frac{2}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{t \cdot \frac{z\_m}{x\_m}}\\
\end{array}\right)
\end{array}
if y < -1.1e-22 or 1.2000000000000001e41 < y Initial program 85.3%
distribute-rgt-out--90.9%
Simplified90.9%
Taylor expanded in y around inf 80.3%
associate-*r/80.3%
*-commutative80.3%
*-commutative80.3%
times-frac79.3%
Simplified79.3%
if -1.1e-22 < y < 1.2000000000000001e41Initial program 90.9%
distribute-rgt-out--92.6%
Simplified92.6%
Taylor expanded in y around 0 81.2%
associate-/l/82.0%
Simplified82.0%
clear-num81.6%
un-div-inv81.6%
div-inv81.6%
clear-num82.3%
Applied egg-rr82.3%
Final simplification80.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (or (<= y -3.2e-22) (not (<= y 4.5e+39)))
(/ (* x_m 2.0) (* z_m y))
(/ -2.0 (* t (/ z_m x_m)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((y <= -3.2e-22) || !(y <= 4.5e+39)) {
tmp = (x_m * 2.0) / (z_m * y);
} else {
tmp = -2.0 / (t * (z_m / x_m));
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-3.2d-22)) .or. (.not. (y <= 4.5d+39))) then
tmp = (x_m * 2.0d0) / (z_m * y)
else
tmp = (-2.0d0) / (t * (z_m / x_m))
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((y <= -3.2e-22) || !(y <= 4.5e+39)) {
tmp = (x_m * 2.0) / (z_m * y);
} else {
tmp = -2.0 / (t * (z_m / x_m));
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if (y <= -3.2e-22) or not (y <= 4.5e+39): tmp = (x_m * 2.0) / (z_m * y) else: tmp = -2.0 / (t * (z_m / x_m)) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if ((y <= -3.2e-22) || !(y <= 4.5e+39)) tmp = Float64(Float64(x_m * 2.0) / Float64(z_m * y)); else tmp = Float64(-2.0 / Float64(t * Float64(z_m / x_m))); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if ((y <= -3.2e-22) || ~((y <= 4.5e+39))) tmp = (x_m * 2.0) / (z_m * y); else tmp = -2.0 / (t * (z_m / x_m)); end tmp_2 = z_s * (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]
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$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[Or[LessEqual[y, -3.2e-22], N[Not[LessEqual[y, 4.5e+39]], $MachinePrecision]], N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision], N[(-2.0 / N[(t * N[(z$95$m / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{-22} \lor \neg \left(y \leq 4.5 \cdot 10^{+39}\right):\\
\;\;\;\;\frac{x\_m \cdot 2}{z\_m \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{t \cdot \frac{z\_m}{x\_m}}\\
\end{array}\right)
\end{array}
if y < -3.19999999999999987e-22 or 4.49999999999999996e39 < y Initial program 85.3%
distribute-rgt-out--90.9%
Simplified90.9%
Taylor expanded in y around inf 80.3%
associate-*r/80.3%
*-commutative80.3%
Simplified80.3%
if -3.19999999999999987e-22 < y < 4.49999999999999996e39Initial program 90.9%
distribute-rgt-out--92.6%
Simplified92.6%
Taylor expanded in y around 0 81.2%
associate-/l/82.0%
Simplified82.0%
clear-num81.6%
un-div-inv81.6%
div-inv81.6%
clear-num82.3%
Applied egg-rr82.3%
Final simplification81.3%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= y -3.8e-21)
(* (/ x_m z_m) (/ 2.0 y))
(if (<= y 3.1e+38)
(/ -2.0 (* t (/ z_m x_m)))
(/ 2.0 (* y (/ z_m x_m))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -3.8e-21) {
tmp = (x_m / z_m) * (2.0 / y);
} else if (y <= 3.1e+38) {
tmp = -2.0 / (t * (z_m / x_m));
} else {
tmp = 2.0 / (y * (z_m / x_m));
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-3.8d-21)) then
tmp = (x_m / z_m) * (2.0d0 / y)
else if (y <= 3.1d+38) then
tmp = (-2.0d0) / (t * (z_m / x_m))
else
tmp = 2.0d0 / (y * (z_m / x_m))
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -3.8e-21) {
tmp = (x_m / z_m) * (2.0 / y);
} else if (y <= 3.1e+38) {
tmp = -2.0 / (t * (z_m / x_m));
} else {
tmp = 2.0 / (y * (z_m / x_m));
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if y <= -3.8e-21: tmp = (x_m / z_m) * (2.0 / y) elif y <= 3.1e+38: tmp = -2.0 / (t * (z_m / x_m)) else: tmp = 2.0 / (y * (z_m / x_m)) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (y <= -3.8e-21) tmp = Float64(Float64(x_m / z_m) * Float64(2.0 / y)); elseif (y <= 3.1e+38) tmp = Float64(-2.0 / Float64(t * Float64(z_m / x_m))); else tmp = Float64(2.0 / Float64(y * Float64(z_m / x_m))); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if (y <= -3.8e-21) tmp = (x_m / z_m) * (2.0 / y); elseif (y <= 3.1e+38) tmp = -2.0 / (t * (z_m / x_m)); else tmp = 2.0 / (y * (z_m / x_m)); end tmp_2 = z_s * (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]
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$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[y, -3.8e-21], N[(N[(x$95$m / z$95$m), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e+38], N[(-2.0 / N[(t * N[(z$95$m / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(y * N[(z$95$m / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{-21}:\\
\;\;\;\;\frac{x\_m}{z\_m} \cdot \frac{2}{y}\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+38}:\\
\;\;\;\;\frac{-2}{t \cdot \frac{z\_m}{x\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{y \cdot \frac{z\_m}{x\_m}}\\
\end{array}\right)
\end{array}
if y < -3.7999999999999998e-21Initial program 82.8%
distribute-rgt-out--89.6%
Simplified89.6%
Taylor expanded in y around inf 74.6%
associate-*r/74.6%
*-commutative74.6%
*-commutative74.6%
times-frac74.5%
Simplified74.5%
if -3.7999999999999998e-21 < y < 3.10000000000000018e38Initial program 90.9%
distribute-rgt-out--92.6%
Simplified92.6%
Taylor expanded in y around 0 81.2%
associate-/l/82.0%
Simplified82.0%
clear-num81.6%
un-div-inv81.6%
div-inv81.6%
clear-num82.3%
Applied egg-rr82.3%
if 3.10000000000000018e38 < y Initial program 88.6%
distribute-rgt-out--92.7%
Simplified92.7%
add-sqr-sqrt40.6%
*-commutative40.6%
times-frac41.6%
Applied egg-rr41.6%
frac-times40.6%
add-sqr-sqrt92.7%
*-commutative92.7%
frac-times96.0%
clear-num96.0%
frac-times96.0%
metadata-eval96.0%
Applied egg-rr96.0%
Taylor expanded in y around inf 87.7%
associate-*r/85.8%
Simplified85.8%
Final simplification80.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= y -2.6e-22)
(/ (* x_m (/ 2.0 z_m)) y)
(if (<= y 3.8e+39)
(/ -2.0 (* t (/ z_m x_m)))
(/ (* x_m 2.0) (* z_m y)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -2.6e-22) {
tmp = (x_m * (2.0 / z_m)) / y;
} else if (y <= 3.8e+39) {
tmp = -2.0 / (t * (z_m / x_m));
} else {
tmp = (x_m * 2.0) / (z_m * y);
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-2.6d-22)) then
tmp = (x_m * (2.0d0 / z_m)) / y
else if (y <= 3.8d+39) then
tmp = (-2.0d0) / (t * (z_m / x_m))
else
tmp = (x_m * 2.0d0) / (z_m * y)
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -2.6e-22) {
tmp = (x_m * (2.0 / z_m)) / y;
} else if (y <= 3.8e+39) {
tmp = -2.0 / (t * (z_m / x_m));
} else {
tmp = (x_m * 2.0) / (z_m * y);
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if y <= -2.6e-22: tmp = (x_m * (2.0 / z_m)) / y elif y <= 3.8e+39: tmp = -2.0 / (t * (z_m / x_m)) else: tmp = (x_m * 2.0) / (z_m * y) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (y <= -2.6e-22) tmp = Float64(Float64(x_m * Float64(2.0 / z_m)) / y); elseif (y <= 3.8e+39) tmp = Float64(-2.0 / Float64(t * Float64(z_m / x_m))); else tmp = Float64(Float64(x_m * 2.0) / Float64(z_m * y)); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if (y <= -2.6e-22) tmp = (x_m * (2.0 / z_m)) / y; elseif (y <= 3.8e+39) tmp = -2.0 / (t * (z_m / x_m)); else tmp = (x_m * 2.0) / (z_m * y); end tmp_2 = z_s * (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]
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$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[y, -2.6e-22], N[(N[(x$95$m * N[(2.0 / z$95$m), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 3.8e+39], N[(-2.0 / N[(t * N[(z$95$m / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{-22}:\\
\;\;\;\;\frac{x\_m \cdot \frac{2}{z\_m}}{y}\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+39}:\\
\;\;\;\;\frac{-2}{t \cdot \frac{z\_m}{x\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot 2}{z\_m \cdot y}\\
\end{array}\right)
\end{array}
if y < -2.6e-22Initial program 82.8%
distribute-rgt-out--89.6%
Simplified89.6%
Taylor expanded in y around inf 74.6%
associate-*r/74.6%
*-commutative74.6%
associate-/l/74.6%
associate-*r/74.6%
Simplified74.6%
if -2.6e-22 < y < 3.7999999999999998e39Initial program 90.9%
distribute-rgt-out--92.6%
Simplified92.6%
Taylor expanded in y around 0 81.2%
associate-/l/82.0%
Simplified82.0%
clear-num81.6%
un-div-inv81.6%
div-inv81.6%
clear-num82.3%
Applied egg-rr82.3%
if 3.7999999999999998e39 < y Initial program 88.6%
distribute-rgt-out--92.7%
Simplified92.7%
Taylor expanded in y around inf 87.9%
associate-*r/87.9%
*-commutative87.9%
Simplified87.9%
Final simplification81.3%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= y -2e-22)
(/ (* x_m (/ 2.0 z_m)) y)
(if (<= y 3.5e+40)
(/ (/ -2.0 t) (/ z_m x_m))
(/ (* x_m 2.0) (* z_m y)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -2e-22) {
tmp = (x_m * (2.0 / z_m)) / y;
} else if (y <= 3.5e+40) {
tmp = (-2.0 / t) / (z_m / x_m);
} else {
tmp = (x_m * 2.0) / (z_m * y);
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-2d-22)) then
tmp = (x_m * (2.0d0 / z_m)) / y
else if (y <= 3.5d+40) then
tmp = ((-2.0d0) / t) / (z_m / x_m)
else
tmp = (x_m * 2.0d0) / (z_m * y)
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -2e-22) {
tmp = (x_m * (2.0 / z_m)) / y;
} else if (y <= 3.5e+40) {
tmp = (-2.0 / t) / (z_m / x_m);
} else {
tmp = (x_m * 2.0) / (z_m * y);
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if y <= -2e-22: tmp = (x_m * (2.0 / z_m)) / y elif y <= 3.5e+40: tmp = (-2.0 / t) / (z_m / x_m) else: tmp = (x_m * 2.0) / (z_m * y) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (y <= -2e-22) tmp = Float64(Float64(x_m * Float64(2.0 / z_m)) / y); elseif (y <= 3.5e+40) tmp = Float64(Float64(-2.0 / t) / Float64(z_m / x_m)); else tmp = Float64(Float64(x_m * 2.0) / Float64(z_m * y)); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if (y <= -2e-22) tmp = (x_m * (2.0 / z_m)) / y; elseif (y <= 3.5e+40) tmp = (-2.0 / t) / (z_m / x_m); else tmp = (x_m * 2.0) / (z_m * y); end tmp_2 = z_s * (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]
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$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[y, -2e-22], N[(N[(x$95$m * N[(2.0 / z$95$m), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 3.5e+40], N[(N[(-2.0 / t), $MachinePrecision] / N[(z$95$m / x$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-22}:\\
\;\;\;\;\frac{x\_m \cdot \frac{2}{z\_m}}{y}\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+40}:\\
\;\;\;\;\frac{\frac{-2}{t}}{\frac{z\_m}{x\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot 2}{z\_m \cdot y}\\
\end{array}\right)
\end{array}
if y < -2.0000000000000001e-22Initial program 82.8%
distribute-rgt-out--89.6%
Simplified89.6%
Taylor expanded in y around inf 74.6%
associate-*r/74.6%
*-commutative74.6%
associate-/l/74.6%
associate-*r/74.6%
Simplified74.6%
if -2.0000000000000001e-22 < y < 3.4999999999999999e40Initial program 90.9%
distribute-rgt-out--92.6%
Simplified92.6%
add-sqr-sqrt47.1%
*-commutative47.1%
times-frac48.2%
Applied egg-rr48.2%
Taylor expanded in y around 0 80.6%
associate-*r/80.6%
mul-1-neg80.6%
*-commutative80.6%
unpow280.6%
rem-square-sqrt81.2%
distribute-lft-neg-in81.2%
metadata-eval81.2%
*-commutative81.2%
associate-/l*81.1%
*-commutative81.1%
Simplified81.1%
associate-*r/81.2%
frac-times82.0%
*-commutative82.0%
clear-num81.9%
un-div-inv82.6%
Applied egg-rr82.6%
if 3.4999999999999999e40 < y Initial program 88.6%
distribute-rgt-out--92.7%
Simplified92.7%
Taylor expanded in y around inf 87.9%
associate-*r/87.9%
*-commutative87.9%
Simplified87.9%
Final simplification81.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= (* x_m 2.0) 2e-46)
(* (/ x_m z_m) (/ 2.0 (- y t)))
(* (/ 2.0 z_m) (/ x_m (- y t)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((x_m * 2.0) <= 2e-46) {
tmp = (x_m / z_m) * (2.0 / (y - t));
} else {
tmp = (2.0 / z_m) * (x_m / (y - t));
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((x_m * 2.0d0) <= 2d-46) then
tmp = (x_m / z_m) * (2.0d0 / (y - t))
else
tmp = (2.0d0 / z_m) * (x_m / (y - t))
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((x_m * 2.0) <= 2e-46) {
tmp = (x_m / z_m) * (2.0 / (y - t));
} else {
tmp = (2.0 / z_m) * (x_m / (y - t));
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if (x_m * 2.0) <= 2e-46: tmp = (x_m / z_m) * (2.0 / (y - t)) else: tmp = (2.0 / z_m) * (x_m / (y - t)) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (Float64(x_m * 2.0) <= 2e-46) tmp = Float64(Float64(x_m / z_m) * Float64(2.0 / Float64(y - t))); else tmp = Float64(Float64(2.0 / z_m) * Float64(x_m / Float64(y - t))); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if ((x_m * 2.0) <= 2e-46) tmp = (x_m / z_m) * (2.0 / (y - t)); else tmp = (2.0 / z_m) * (x_m / (y - t)); end tmp_2 = z_s * (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]
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$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[N[(x$95$m * 2.0), $MachinePrecision], 2e-46], N[(N[(x$95$m / z$95$m), $MachinePrecision] * N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z$95$m), $MachinePrecision] * N[(x$95$m / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot 2 \leq 2 \cdot 10^{-46}:\\
\;\;\;\;\frac{x\_m}{z\_m} \cdot \frac{2}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z\_m} \cdot \frac{x\_m}{y - t}\\
\end{array}\right)
\end{array}
if (*.f64 x #s(literal 2 binary64)) < 2.00000000000000005e-46Initial program 88.6%
distribute-rgt-out--92.7%
Simplified92.7%
Taylor expanded in x around 0 92.7%
associate-*r/92.7%
*-commutative92.7%
times-frac94.9%
Simplified94.9%
if 2.00000000000000005e-46 < (*.f64 x #s(literal 2 binary64)) Initial program 87.3%
distribute-rgt-out--89.1%
Simplified89.1%
*-commutative89.1%
times-frac96.7%
Applied egg-rr96.7%
Final simplification95.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= (* x_m 2.0) 2e-46)
(/ (* x_m (/ 2.0 z_m)) (- y t))
(* (/ 2.0 z_m) (/ x_m (- y t)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((x_m * 2.0) <= 2e-46) {
tmp = (x_m * (2.0 / z_m)) / (y - t);
} else {
tmp = (2.0 / z_m) * (x_m / (y - t));
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((x_m * 2.0d0) <= 2d-46) then
tmp = (x_m * (2.0d0 / z_m)) / (y - t)
else
tmp = (2.0d0 / z_m) * (x_m / (y - t))
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((x_m * 2.0) <= 2e-46) {
tmp = (x_m * (2.0 / z_m)) / (y - t);
} else {
tmp = (2.0 / z_m) * (x_m / (y - t));
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if (x_m * 2.0) <= 2e-46: tmp = (x_m * (2.0 / z_m)) / (y - t) else: tmp = (2.0 / z_m) * (x_m / (y - t)) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (Float64(x_m * 2.0) <= 2e-46) tmp = Float64(Float64(x_m * Float64(2.0 / z_m)) / Float64(y - t)); else tmp = Float64(Float64(2.0 / z_m) * Float64(x_m / Float64(y - t))); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if ((x_m * 2.0) <= 2e-46) tmp = (x_m * (2.0 / z_m)) / (y - t); else tmp = (2.0 / z_m) * (x_m / (y - t)); end tmp_2 = z_s * (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]
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$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[N[(x$95$m * 2.0), $MachinePrecision], 2e-46], N[(N[(x$95$m * N[(2.0 / z$95$m), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z$95$m), $MachinePrecision] * N[(x$95$m / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot 2 \leq 2 \cdot 10^{-46}:\\
\;\;\;\;\frac{x\_m \cdot \frac{2}{z\_m}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z\_m} \cdot \frac{x\_m}{y - t}\\
\end{array}\right)
\end{array}
if (*.f64 x #s(literal 2 binary64)) < 2.00000000000000005e-46Initial program 88.6%
distribute-rgt-out--92.7%
Simplified92.7%
add-sqr-sqrt25.5%
*-commutative25.5%
times-frac24.9%
Applied egg-rr24.9%
frac-times25.5%
add-sqr-sqrt92.7%
*-commutative92.7%
*-commutative92.7%
associate-/r*95.0%
*-commutative95.0%
associate-*r/95.0%
Applied egg-rr95.0%
if 2.00000000000000005e-46 < (*.f64 x #s(literal 2 binary64)) Initial program 87.3%
distribute-rgt-out--89.1%
Simplified89.1%
*-commutative89.1%
times-frac96.7%
Applied egg-rr96.7%
Final simplification95.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= z_m 2.15e+220)
(* x_m (/ 2.0 (* z_m (- y t))))
(/ (/ -2.0 t) (/ z_m x_m))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 2.15e+220) {
tmp = x_m * (2.0 / (z_m * (y - t)));
} else {
tmp = (-2.0 / t) / (z_m / x_m);
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 2.15d+220) then
tmp = x_m * (2.0d0 / (z_m * (y - t)))
else
tmp = ((-2.0d0) / t) / (z_m / x_m)
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 2.15e+220) {
tmp = x_m * (2.0 / (z_m * (y - t)));
} else {
tmp = (-2.0 / t) / (z_m / x_m);
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if z_m <= 2.15e+220: tmp = x_m * (2.0 / (z_m * (y - t))) else: tmp = (-2.0 / t) / (z_m / x_m) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (z_m <= 2.15e+220) tmp = Float64(x_m * Float64(2.0 / Float64(z_m * Float64(y - t)))); else tmp = Float64(Float64(-2.0 / t) / Float64(z_m / x_m)); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if (z_m <= 2.15e+220) tmp = x_m * (2.0 / (z_m * (y - t))); else tmp = (-2.0 / t) / (z_m / x_m); end tmp_2 = z_s * (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]
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$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[z$95$m, 2.15e+220], N[(x$95$m * N[(2.0 / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 / t), $MachinePrecision] / N[(z$95$m / x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 2.15 \cdot 10^{+220}:\\
\;\;\;\;x\_m \cdot \frac{2}{z\_m \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-2}{t}}{\frac{z\_m}{x\_m}}\\
\end{array}\right)
\end{array}
if z < 2.15e220Initial program 90.2%
distribute-rgt-out--92.5%
Simplified92.5%
associate-/l*92.1%
*-commutative92.1%
Applied egg-rr92.1%
if 2.15e220 < z Initial program 65.2%
distribute-rgt-out--83.2%
Simplified83.2%
add-sqr-sqrt50.2%
*-commutative50.2%
times-frac54.8%
Applied egg-rr54.8%
Taylor expanded in y around 0 57.4%
associate-*r/57.4%
mul-1-neg57.4%
*-commutative57.4%
unpow257.4%
rem-square-sqrt57.3%
distribute-lft-neg-in57.3%
metadata-eval57.3%
*-commutative57.3%
associate-/l*57.3%
*-commutative57.3%
Simplified57.3%
associate-*r/57.3%
frac-times73.0%
*-commutative73.0%
clear-num77.5%
un-div-inv77.5%
Applied egg-rr77.5%
Final simplification91.0%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= z_m 8.4e-102)
(* x_m (/ 2.0 (* z_m (- y t))))
(* (/ x_m z_m) (/ 2.0 (- y t)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 8.4e-102) {
tmp = x_m * (2.0 / (z_m * (y - t)));
} else {
tmp = (x_m / z_m) * (2.0 / (y - t));
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 8.4d-102) then
tmp = x_m * (2.0d0 / (z_m * (y - t)))
else
tmp = (x_m / z_m) * (2.0d0 / (y - t))
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 8.4e-102) {
tmp = x_m * (2.0 / (z_m * (y - t)));
} else {
tmp = (x_m / z_m) * (2.0 / (y - t));
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if z_m <= 8.4e-102: tmp = x_m * (2.0 / (z_m * (y - t))) else: tmp = (x_m / z_m) * (2.0 / (y - t)) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (z_m <= 8.4e-102) tmp = Float64(x_m * Float64(2.0 / Float64(z_m * Float64(y - t)))); else tmp = Float64(Float64(x_m / z_m) * Float64(2.0 / Float64(y - t))); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if (z_m <= 8.4e-102) tmp = x_m * (2.0 / (z_m * (y - t))); else tmp = (x_m / z_m) * (2.0 / (y - t)); end tmp_2 = z_s * (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]
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$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[z$95$m, 8.4e-102], N[(x$95$m * N[(2.0 / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z$95$m), $MachinePrecision] * N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 8.4 \cdot 10^{-102}:\\
\;\;\;\;x\_m \cdot \frac{2}{z\_m \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z\_m} \cdot \frac{2}{y - t}\\
\end{array}\right)
\end{array}
if z < 8.4e-102Initial program 88.7%
distribute-rgt-out--91.3%
Simplified91.3%
associate-/l*90.8%
*-commutative90.8%
Applied egg-rr90.8%
if 8.4e-102 < z Initial program 87.5%
distribute-rgt-out--92.7%
Simplified92.7%
Taylor expanded in x around 0 92.7%
associate-*r/92.7%
*-commutative92.7%
times-frac97.0%
Simplified97.0%
Final simplification92.9%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) z\_m = (fabs.f64 z) z\_s = (copysign.f64 #s(literal 1 binary64) z) (FPCore (z_s x_s x_m y z_m t) :precision binary64 (* z_s (* x_s (* -2.0 (/ (/ x_m z_m) t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
return z_s * (x_s * (-2.0 * ((x_m / z_m) / t)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = z_s * (x_s * ((-2.0d0) * ((x_m / z_m) / t)))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
return z_s * (x_s * (-2.0 * ((x_m / z_m) / t)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): return z_s * (x_s * (-2.0 * ((x_m / z_m) / t)))
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) return Float64(z_s * Float64(x_s * Float64(-2.0 * Float64(Float64(x_m / z_m) / t)))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp = code(z_s, x_s, x_m, y, z_m, t) tmp = z_s * (x_s * (-2.0 * ((x_m / z_m) / 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]
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$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * N[(-2.0 * N[(N[(x$95$m / z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \left(-2 \cdot \frac{\frac{x\_m}{z\_m}}{t}\right)\right)
\end{array}
Initial program 88.3%
distribute-rgt-out--91.8%
Simplified91.8%
Taylor expanded in y around 0 58.0%
associate-/l/61.8%
Simplified61.8%
Final simplification61.8%
(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 2024059
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
:alt
(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))))