
(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 1 x)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= (/ (* x_m 2.0) (- (* y z_m) (* z_m t))) -5e-309)
(/ (* x_m 2.0) (* z_m (- y t)))
(* (/ x_m (- y t)) (/ 2.0 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 tmp;
if (((x_m * 2.0) / ((y * z_m) - (z_m * t))) <= -5e-309) {
tmp = (x_m * 2.0) / (z_m * (y - t));
} else {
tmp = (x_m / (y - t)) * (2.0 / 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) :: tmp
if (((x_m * 2.0d0) / ((y * z_m) - (z_m * t))) <= (-5d-309)) then
tmp = (x_m * 2.0d0) / (z_m * (y - t))
else
tmp = (x_m / (y - t)) * (2.0d0 / 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 tmp;
if (((x_m * 2.0) / ((y * z_m) - (z_m * t))) <= -5e-309) {
tmp = (x_m * 2.0) / (z_m * (y - t));
} else {
tmp = (x_m / (y - t)) * (2.0 / 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): tmp = 0 if ((x_m * 2.0) / ((y * z_m) - (z_m * t))) <= -5e-309: tmp = (x_m * 2.0) / (z_m * (y - t)) else: tmp = (x_m / (y - t)) * (2.0 / 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) tmp = 0.0 if (Float64(Float64(x_m * 2.0) / Float64(Float64(y * z_m) - Float64(z_m * t))) <= -5e-309) tmp = Float64(Float64(x_m * 2.0) / Float64(z_m * Float64(y - t))); else tmp = Float64(Float64(x_m / Float64(y - t)) * Float64(2.0 / 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) tmp = 0.0; if (((x_m * 2.0) / ((y * z_m) - (z_m * t))) <= -5e-309) tmp = (x_m * 2.0) / (z_m * (y - t)); else tmp = (x_m / (y - t)) * (2.0 / 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_] := N[(z$95$s * N[(x$95$s * If[LessEqual[N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(N[(y * z$95$m), $MachinePrecision] - N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-309], N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / 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)
\\
z_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{x_m \cdot 2}{y \cdot z_m - z_m \cdot t} \leq -5 \cdot 10^{-309}:\\
\;\;\;\;\frac{x_m \cdot 2}{z_m \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m}{y - t} \cdot \frac{2}{z_m}\\
\end{array}\right)
\end{array}
if (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) < -4.9999999999999995e-309Initial program 97.3%
distribute-rgt-out--98.5%
Simplified98.5%
if -4.9999999999999995e-309 < (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) Initial program 84.2%
distribute-rgt-out--86.0%
Simplified86.0%
*-commutative86.0%
times-frac94.4%
Applied egg-rr94.4%
Final simplification95.8%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= (* x_m 2.0) 1e-92)
(* (/ x_m z_m) (/ 2.0 (- y t)))
(* (/ x_m (- y t)) (/ 2.0 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 tmp;
if ((x_m * 2.0) <= 1e-92) {
tmp = (x_m / z_m) * (2.0 / (y - t));
} else {
tmp = (x_m / (y - t)) * (2.0 / 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) :: tmp
if ((x_m * 2.0d0) <= 1d-92) then
tmp = (x_m / z_m) * (2.0d0 / (y - t))
else
tmp = (x_m / (y - t)) * (2.0d0 / 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 tmp;
if ((x_m * 2.0) <= 1e-92) {
tmp = (x_m / z_m) * (2.0 / (y - t));
} else {
tmp = (x_m / (y - t)) * (2.0 / 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): tmp = 0 if (x_m * 2.0) <= 1e-92: tmp = (x_m / z_m) * (2.0 / (y - t)) else: tmp = (x_m / (y - t)) * (2.0 / 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) tmp = 0.0 if (Float64(x_m * 2.0) <= 1e-92) tmp = Float64(Float64(x_m / z_m) * Float64(2.0 / Float64(y - t))); else tmp = Float64(Float64(x_m / Float64(y - t)) * Float64(2.0 / 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) tmp = 0.0; if ((x_m * 2.0) <= 1e-92) tmp = (x_m / z_m) * (2.0 / (y - t)); else tmp = (x_m / (y - t)) * (2.0 / 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_] := N[(z$95$s * N[(x$95$s * If[LessEqual[N[(x$95$m * 2.0), $MachinePrecision], 1e-92], N[(N[(x$95$m / z$95$m), $MachinePrecision] * N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / 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)
\\
z_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;x_m \cdot 2 \leq 10^{-92}:\\
\;\;\;\;\frac{x_m}{z_m} \cdot \frac{2}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m}{y - t} \cdot \frac{2}{z_m}\\
\end{array}\right)
\end{array}
if (*.f64 x 2) < 9.99999999999999988e-93Initial program 89.8%
distribute-rgt-out--91.1%
times-frac94.3%
Simplified94.3%
if 9.99999999999999988e-93 < (*.f64 x 2) Initial program 86.7%
distribute-rgt-out--89.0%
Simplified89.0%
*-commutative89.0%
times-frac97.4%
Applied egg-rr97.4%
Final simplification95.4%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (or (<= y -2700000.0) (not (<= y 1.55e-44)))
(* x_m (/ 2.0 (* y z_m)))
(* -2.0 (/ (/ x_m t) 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 tmp;
if ((y <= -2700000.0) || !(y <= 1.55e-44)) {
tmp = x_m * (2.0 / (y * z_m));
} else {
tmp = -2.0 * ((x_m / t) / 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) :: tmp
if ((y <= (-2700000.0d0)) .or. (.not. (y <= 1.55d-44))) then
tmp = x_m * (2.0d0 / (y * z_m))
else
tmp = (-2.0d0) * ((x_m / t) / 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 tmp;
if ((y <= -2700000.0) || !(y <= 1.55e-44)) {
tmp = x_m * (2.0 / (y * z_m));
} else {
tmp = -2.0 * ((x_m / t) / 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): tmp = 0 if (y <= -2700000.0) or not (y <= 1.55e-44): tmp = x_m * (2.0 / (y * z_m)) else: tmp = -2.0 * ((x_m / t) / 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) tmp = 0.0 if ((y <= -2700000.0) || !(y <= 1.55e-44)) tmp = Float64(x_m * Float64(2.0 / Float64(y * z_m))); else tmp = Float64(-2.0 * Float64(Float64(x_m / t) / 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) tmp = 0.0; if ((y <= -2700000.0) || ~((y <= 1.55e-44))) tmp = x_m * (2.0 / (y * z_m)); else tmp = -2.0 * ((x_m / t) / 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_] := N[(z$95$s * N[(x$95$s * If[Or[LessEqual[y, -2700000.0], N[Not[LessEqual[y, 1.55e-44]], $MachinePrecision]], N[(x$95$m * N[(2.0 / N[(y * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / 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)
\\
z_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2700000 \lor \neg \left(y \leq 1.55 \cdot 10^{-44}\right):\\
\;\;\;\;x_m \cdot \frac{2}{y \cdot z_m}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x_m}{t}}{z_m}\\
\end{array}\right)
\end{array}
if y < -2.7e6 or 1.54999999999999992e-44 < y Initial program 89.7%
*-commutative89.7%
associate-*l/88.9%
*-commutative88.9%
distribute-rgt-out--90.7%
associate-/l/92.0%
Simplified92.0%
Taylor expanded in y around inf 76.5%
*-commutative76.5%
Simplified76.5%
if -2.7e6 < y < 1.54999999999999992e-44Initial program 88.0%
*-commutative88.0%
associate-*l/86.9%
*-commutative86.9%
distribute-rgt-out--88.3%
associate-/l/90.1%
Simplified90.1%
Taylor expanded in y around 0 70.7%
associate-/r*74.6%
Simplified74.6%
Final simplification75.5%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (or (<= y -5500000.0) (not (<= y 1.2e-44)))
(* x_m (/ (/ 2.0 y) z_m))
(* -2.0 (/ (/ x_m t) 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 tmp;
if ((y <= -5500000.0) || !(y <= 1.2e-44)) {
tmp = x_m * ((2.0 / y) / z_m);
} else {
tmp = -2.0 * ((x_m / t) / 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) :: tmp
if ((y <= (-5500000.0d0)) .or. (.not. (y <= 1.2d-44))) then
tmp = x_m * ((2.0d0 / y) / z_m)
else
tmp = (-2.0d0) * ((x_m / t) / 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 tmp;
if ((y <= -5500000.0) || !(y <= 1.2e-44)) {
tmp = x_m * ((2.0 / y) / z_m);
} else {
tmp = -2.0 * ((x_m / t) / 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): tmp = 0 if (y <= -5500000.0) or not (y <= 1.2e-44): tmp = x_m * ((2.0 / y) / z_m) else: tmp = -2.0 * ((x_m / t) / 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) tmp = 0.0 if ((y <= -5500000.0) || !(y <= 1.2e-44)) tmp = Float64(x_m * Float64(Float64(2.0 / y) / z_m)); else tmp = Float64(-2.0 * Float64(Float64(x_m / t) / 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) tmp = 0.0; if ((y <= -5500000.0) || ~((y <= 1.2e-44))) tmp = x_m * ((2.0 / y) / z_m); else tmp = -2.0 * ((x_m / t) / 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_] := N[(z$95$s * N[(x$95$s * If[Or[LessEqual[y, -5500000.0], N[Not[LessEqual[y, 1.2e-44]], $MachinePrecision]], N[(x$95$m * N[(N[(2.0 / y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / 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)
\\
z_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -5500000 \lor \neg \left(y \leq 1.2 \cdot 10^{-44}\right):\\
\;\;\;\;x_m \cdot \frac{\frac{2}{y}}{z_m}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x_m}{t}}{z_m}\\
\end{array}\right)
\end{array}
if y < -5.5e6 or 1.20000000000000004e-44 < y Initial program 89.7%
*-commutative89.7%
associate-*l/88.9%
*-commutative88.9%
distribute-rgt-out--90.7%
associate-/l/92.0%
Simplified92.0%
Taylor expanded in y around inf 76.5%
associate-/r*77.7%
Simplified77.7%
if -5.5e6 < y < 1.20000000000000004e-44Initial program 88.0%
*-commutative88.0%
associate-*l/86.9%
*-commutative86.9%
distribute-rgt-out--88.3%
associate-/l/90.1%
Simplified90.1%
Taylor expanded in y around 0 70.7%
associate-/r*74.6%
Simplified74.6%
Final simplification76.0%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= t -4.45e-48)
(* -2.0 (/ (/ x_m t) z_m))
(if (<= t 1.15e-144)
(* x_m (/ (/ 2.0 y) z_m))
(* (/ x_m z_m) (/ -2.0 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 (t <= -4.45e-48) {
tmp = -2.0 * ((x_m / t) / z_m);
} else if (t <= 1.15e-144) {
tmp = x_m * ((2.0 / y) / z_m);
} else {
tmp = (x_m / z_m) * (-2.0 / 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 (t <= (-4.45d-48)) then
tmp = (-2.0d0) * ((x_m / t) / z_m)
else if (t <= 1.15d-144) then
tmp = x_m * ((2.0d0 / y) / z_m)
else
tmp = (x_m / z_m) * ((-2.0d0) / 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 (t <= -4.45e-48) {
tmp = -2.0 * ((x_m / t) / z_m);
} else if (t <= 1.15e-144) {
tmp = x_m * ((2.0 / y) / z_m);
} else {
tmp = (x_m / z_m) * (-2.0 / 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 t <= -4.45e-48: tmp = -2.0 * ((x_m / t) / z_m) elif t <= 1.15e-144: tmp = x_m * ((2.0 / y) / z_m) else: tmp = (x_m / z_m) * (-2.0 / 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 (t <= -4.45e-48) tmp = Float64(-2.0 * Float64(Float64(x_m / t) / z_m)); elseif (t <= 1.15e-144) tmp = Float64(x_m * Float64(Float64(2.0 / y) / z_m)); else tmp = Float64(Float64(x_m / z_m) * Float64(-2.0 / 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 (t <= -4.45e-48) tmp = -2.0 * ((x_m / t) / z_m); elseif (t <= 1.15e-144) tmp = x_m * ((2.0 / y) / z_m); else tmp = (x_m / z_m) * (-2.0 / 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[t, -4.45e-48], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.15e-144], N[(x$95$m * N[(N[(2.0 / y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z$95$m), $MachinePrecision] * N[(-2.0 / 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}\;t \leq -4.45 \cdot 10^{-48}:\\
\;\;\;\;-2 \cdot \frac{\frac{x_m}{t}}{z_m}\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{-144}:\\
\;\;\;\;x_m \cdot \frac{\frac{2}{y}}{z_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m}{z_m} \cdot \frac{-2}{t}\\
\end{array}\right)
\end{array}
if t < -4.45000000000000007e-48Initial program 88.0%
*-commutative88.0%
associate-*l/87.8%
*-commutative87.8%
distribute-rgt-out--89.0%
associate-/l/91.2%
Simplified91.2%
Taylor expanded in y around 0 69.6%
associate-/r*75.5%
Simplified75.5%
if -4.45000000000000007e-48 < t < 1.15e-144Initial program 91.8%
*-commutative91.8%
associate-*l/90.0%
*-commutative90.0%
distribute-rgt-out--91.2%
associate-/l/91.6%
Simplified91.6%
Taylor expanded in y around inf 79.7%
associate-/r*80.1%
Simplified80.1%
if 1.15e-144 < t Initial program 86.5%
distribute-rgt-out--88.8%
times-frac94.0%
Simplified94.0%
Taylor expanded in y around 0 73.5%
Final simplification76.4%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= t -8e-47)
(* -2.0 (/ (/ x_m t) z_m))
(if (<= t 3.4e-57)
(* (/ x_m z_m) (/ 2.0 y))
(* (/ x_m z_m) (/ -2.0 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 (t <= -8e-47) {
tmp = -2.0 * ((x_m / t) / z_m);
} else if (t <= 3.4e-57) {
tmp = (x_m / z_m) * (2.0 / y);
} else {
tmp = (x_m / z_m) * (-2.0 / 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 (t <= (-8d-47)) then
tmp = (-2.0d0) * ((x_m / t) / z_m)
else if (t <= 3.4d-57) then
tmp = (x_m / z_m) * (2.0d0 / y)
else
tmp = (x_m / z_m) * ((-2.0d0) / 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 (t <= -8e-47) {
tmp = -2.0 * ((x_m / t) / z_m);
} else if (t <= 3.4e-57) {
tmp = (x_m / z_m) * (2.0 / y);
} else {
tmp = (x_m / z_m) * (-2.0 / 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 t <= -8e-47: tmp = -2.0 * ((x_m / t) / z_m) elif t <= 3.4e-57: tmp = (x_m / z_m) * (2.0 / y) else: tmp = (x_m / z_m) * (-2.0 / 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 (t <= -8e-47) tmp = Float64(-2.0 * Float64(Float64(x_m / t) / z_m)); elseif (t <= 3.4e-57) tmp = Float64(Float64(x_m / z_m) * Float64(2.0 / y)); else tmp = Float64(Float64(x_m / z_m) * Float64(-2.0 / 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 (t <= -8e-47) tmp = -2.0 * ((x_m / t) / z_m); elseif (t <= 3.4e-57) tmp = (x_m / z_m) * (2.0 / y); else tmp = (x_m / z_m) * (-2.0 / 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[t, -8e-47], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.4e-57], N[(N[(x$95$m / z$95$m), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z$95$m), $MachinePrecision] * N[(-2.0 / 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}\;t \leq -8 \cdot 10^{-47}:\\
\;\;\;\;-2 \cdot \frac{\frac{x_m}{t}}{z_m}\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{-57}:\\
\;\;\;\;\frac{x_m}{z_m} \cdot \frac{2}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m}{z_m} \cdot \frac{-2}{t}\\
\end{array}\right)
\end{array}
if t < -7.9999999999999998e-47Initial program 88.0%
*-commutative88.0%
associate-*l/87.8%
*-commutative87.8%
distribute-rgt-out--89.0%
associate-/l/91.2%
Simplified91.2%
Taylor expanded in y around 0 69.6%
associate-/r*75.5%
Simplified75.5%
if -7.9999999999999998e-47 < t < 3.40000000000000016e-57Initial program 92.6%
distribute-rgt-out--93.7%
times-frac94.3%
Simplified94.3%
Taylor expanded in y around inf 79.4%
if 3.40000000000000016e-57 < t Initial program 84.8%
distribute-rgt-out--87.4%
times-frac93.7%
Simplified93.7%
Taylor expanded in y around 0 76.7%
Final simplification77.4%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= t -4.1e-46)
(* -2.0 (/ (/ x_m t) z_m))
(if (<= t 2.5e-58)
(* (/ 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 (t <= -4.1e-46) {
tmp = -2.0 * ((x_m / t) / z_m);
} else if (t <= 2.5e-58) {
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 (t <= (-4.1d-46)) then
tmp = (-2.0d0) * ((x_m / t) / z_m)
else if (t <= 2.5d-58) 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 (t <= -4.1e-46) {
tmp = -2.0 * ((x_m / t) / z_m);
} else if (t <= 2.5e-58) {
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 t <= -4.1e-46: tmp = -2.0 * ((x_m / t) / z_m) elif t <= 2.5e-58: 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 (t <= -4.1e-46) tmp = Float64(-2.0 * Float64(Float64(x_m / t) / z_m)); elseif (t <= 2.5e-58) 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 (t <= -4.1e-46) tmp = -2.0 * ((x_m / t) / z_m); elseif (t <= 2.5e-58) 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[LessEqual[t, -4.1e-46], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.5e-58], 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}\;t \leq -4.1 \cdot 10^{-46}:\\
\;\;\;\;-2 \cdot \frac{\frac{x_m}{t}}{z_m}\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{-58}:\\
\;\;\;\;\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 t < -4.0999999999999999e-46Initial program 88.0%
*-commutative88.0%
associate-*l/87.8%
*-commutative87.8%
distribute-rgt-out--89.0%
associate-/l/91.2%
Simplified91.2%
Taylor expanded in y around 0 69.6%
associate-/r*75.5%
Simplified75.5%
if -4.0999999999999999e-46 < t < 2.49999999999999989e-58Initial program 92.6%
distribute-rgt-out--93.7%
times-frac94.3%
Simplified94.3%
Taylor expanded in y around inf 79.4%
if 2.49999999999999989e-58 < t Initial program 84.8%
distribute-rgt-out--87.4%
times-frac93.7%
Simplified93.7%
Taylor expanded in y around 0 76.7%
*-commutative76.7%
clear-num76.5%
frac-times77.3%
metadata-eval77.3%
Applied egg-rr77.3%
Final simplification77.5%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= y -82000.0)
(* x_m (/ (/ 2.0 y) z_m))
(if (<= y 8.5e-45)
(* -2.0 (/ (/ x_m t) z_m))
(/ 2.0 (* z_m (/ y 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 <= -82000.0) {
tmp = x_m * ((2.0 / y) / z_m);
} else if (y <= 8.5e-45) {
tmp = -2.0 * ((x_m / t) / z_m);
} else {
tmp = 2.0 / (z_m * (y / 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 <= (-82000.0d0)) then
tmp = x_m * ((2.0d0 / y) / z_m)
else if (y <= 8.5d-45) then
tmp = (-2.0d0) * ((x_m / t) / z_m)
else
tmp = 2.0d0 / (z_m * (y / 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 <= -82000.0) {
tmp = x_m * ((2.0 / y) / z_m);
} else if (y <= 8.5e-45) {
tmp = -2.0 * ((x_m / t) / z_m);
} else {
tmp = 2.0 / (z_m * (y / 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 <= -82000.0: tmp = x_m * ((2.0 / y) / z_m) elif y <= 8.5e-45: tmp = -2.0 * ((x_m / t) / z_m) else: tmp = 2.0 / (z_m * (y / 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 <= -82000.0) tmp = Float64(x_m * Float64(Float64(2.0 / y) / z_m)); elseif (y <= 8.5e-45) tmp = Float64(-2.0 * Float64(Float64(x_m / t) / z_m)); else tmp = Float64(2.0 / Float64(z_m * Float64(y / 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 <= -82000.0) tmp = x_m * ((2.0 / y) / z_m); elseif (y <= 8.5e-45) tmp = -2.0 * ((x_m / t) / z_m); else tmp = 2.0 / (z_m * (y / 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, -82000.0], N[(x$95$m * N[(N[(2.0 / y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.5e-45], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(z$95$m * N[(y / 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 -82000:\\
\;\;\;\;x_m \cdot \frac{\frac{2}{y}}{z_m}\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-45}:\\
\;\;\;\;-2 \cdot \frac{\frac{x_m}{t}}{z_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z_m \cdot \frac{y}{x_m}}\\
\end{array}\right)
\end{array}
if y < -82000Initial program 93.9%
*-commutative93.9%
associate-*l/93.9%
*-commutative93.9%
distribute-rgt-out--96.0%
associate-/l/97.4%
Simplified97.4%
Taylor expanded in y around inf 81.9%
associate-/r*83.4%
Simplified83.4%
if -82000 < y < 8.50000000000000041e-45Initial program 88.0%
*-commutative88.0%
associate-*l/86.9%
*-commutative86.9%
distribute-rgt-out--88.3%
associate-/l/90.1%
Simplified90.1%
Taylor expanded in y around 0 70.7%
associate-/r*74.6%
Simplified74.6%
if 8.50000000000000041e-45 < y Initial program 86.5%
*-commutative86.5%
associate-*l/85.1%
*-commutative85.1%
distribute-rgt-out--86.7%
associate-/l/87.8%
Simplified87.8%
Taylor expanded in y around inf 72.4%
*-commutative72.4%
Simplified72.4%
associate-*r/73.8%
frac-times75.2%
clear-num75.2%
frac-times77.7%
metadata-eval77.7%
Applied egg-rr77.7%
Taylor expanded in z around 0 73.6%
associate-*l/79.6%
Simplified79.6%
Final simplification77.6%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= t -3.6e-48)
(* -2.0 (/ (/ x_m t) z_m))
(if (<= t 5e-58) (/ 2.0 (* y (/ z_m x_m))) (/ -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 (t <= -3.6e-48) {
tmp = -2.0 * ((x_m / t) / z_m);
} else if (t <= 5e-58) {
tmp = 2.0 / (y * (z_m / x_m));
} 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 (t <= (-3.6d-48)) then
tmp = (-2.0d0) * ((x_m / t) / z_m)
else if (t <= 5d-58) then
tmp = 2.0d0 / (y * (z_m / x_m))
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 (t <= -3.6e-48) {
tmp = -2.0 * ((x_m / t) / z_m);
} else if (t <= 5e-58) {
tmp = 2.0 / (y * (z_m / x_m));
} 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 t <= -3.6e-48: tmp = -2.0 * ((x_m / t) / z_m) elif t <= 5e-58: tmp = 2.0 / (y * (z_m / x_m)) 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 (t <= -3.6e-48) tmp = Float64(-2.0 * Float64(Float64(x_m / t) / z_m)); elseif (t <= 5e-58) tmp = Float64(2.0 / Float64(y * Float64(z_m / x_m))); 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 (t <= -3.6e-48) tmp = -2.0 * ((x_m / t) / z_m); elseif (t <= 5e-58) tmp = 2.0 / (y * (z_m / x_m)); 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[t, -3.6e-48], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5e-58], N[(2.0 / N[(y * N[(z$95$m / x$95$m), $MachinePrecision]), $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}\;t \leq -3.6 \cdot 10^{-48}:\\
\;\;\;\;-2 \cdot \frac{\frac{x_m}{t}}{z_m}\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-58}:\\
\;\;\;\;\frac{2}{y \cdot \frac{z_m}{x_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{t \cdot \frac{z_m}{x_m}}\\
\end{array}\right)
\end{array}
if t < -3.6000000000000002e-48Initial program 88.0%
*-commutative88.0%
associate-*l/87.8%
*-commutative87.8%
distribute-rgt-out--89.0%
associate-/l/91.2%
Simplified91.2%
Taylor expanded in y around 0 69.6%
associate-/r*75.5%
Simplified75.5%
if -3.6000000000000002e-48 < t < 4.99999999999999977e-58Initial program 92.6%
*-commutative92.6%
associate-*l/91.0%
*-commutative91.0%
distribute-rgt-out--92.1%
associate-/l/92.4%
Simplified92.4%
Taylor expanded in y around inf 76.3%
*-commutative76.3%
Simplified76.3%
associate-*r/77.9%
frac-times79.4%
clear-num79.3%
frac-times80.3%
metadata-eval80.3%
Applied egg-rr80.3%
if 4.99999999999999977e-58 < t Initial program 84.8%
distribute-rgt-out--87.4%
times-frac93.7%
Simplified93.7%
Taylor expanded in y around 0 76.7%
*-commutative76.7%
clear-num76.5%
frac-times77.3%
metadata-eval77.3%
Applied egg-rr77.3%
Final simplification77.9%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(let* ((t_1 (/ 2.0 (- y t))))
(*
z_s
(* x_s (if (<= z_m 2e-71) (* x_m (/ t_1 z_m)) (* (/ x_m z_m) t_1))))))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 = 2.0 / (y - t);
double tmp;
if (z_m <= 2e-71) {
tmp = x_m * (t_1 / z_m);
} else {
tmp = (x_m / z_m) * t_1;
}
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 = 2.0d0 / (y - t)
if (z_m <= 2d-71) then
tmp = x_m * (t_1 / z_m)
else
tmp = (x_m / z_m) * t_1
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 = 2.0 / (y - t);
double tmp;
if (z_m <= 2e-71) {
tmp = x_m * (t_1 / z_m);
} else {
tmp = (x_m / z_m) * t_1;
}
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 = 2.0 / (y - t) tmp = 0 if z_m <= 2e-71: tmp = x_m * (t_1 / z_m) else: tmp = (x_m / z_m) * t_1 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 = Float64(2.0 / Float64(y - t)) tmp = 0.0 if (z_m <= 2e-71) tmp = Float64(x_m * Float64(t_1 / z_m)); else tmp = Float64(Float64(x_m / z_m) * t_1); 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 = 2.0 / (y - t); tmp = 0.0; if (z_m <= 2e-71) tmp = x_m * (t_1 / z_m); else tmp = (x_m / z_m) * t_1; 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[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * N[(x$95$s * If[LessEqual[z$95$m, 2e-71], N[(x$95$m * N[(t$95$1 / z$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z$95$m), $MachinePrecision] * t$95$1), $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 := \frac{2}{y - t}\\
z_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 2 \cdot 10^{-71}:\\
\;\;\;\;x_m \cdot \frac{t_1}{z_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m}{z_m} \cdot t_1\\
\end{array}\right)
\end{array}
\end{array}
if z < 1.9999999999999998e-71Initial program 89.6%
*-commutative89.6%
associate-*l/88.2%
*-commutative88.2%
distribute-rgt-out--89.4%
associate-/l/90.6%
Simplified90.6%
if 1.9999999999999998e-71 < z Initial program 87.1%
distribute-rgt-out--89.3%
times-frac98.1%
Simplified98.1%
Final simplification93.3%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x_s x_m y z_m t) :precision binary64 (* z_s (* x_s (if (<= z_m 4e+58) (* -2.0 (/ x_m (* z_m t))) (* -2.0 (/ (/ x_m t) 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 tmp;
if (z_m <= 4e+58) {
tmp = -2.0 * (x_m / (z_m * t));
} else {
tmp = -2.0 * ((x_m / t) / 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) :: tmp
if (z_m <= 4d+58) then
tmp = (-2.0d0) * (x_m / (z_m * t))
else
tmp = (-2.0d0) * ((x_m / t) / 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 tmp;
if (z_m <= 4e+58) {
tmp = -2.0 * (x_m / (z_m * t));
} else {
tmp = -2.0 * ((x_m / t) / 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): tmp = 0 if z_m <= 4e+58: tmp = -2.0 * (x_m / (z_m * t)) else: tmp = -2.0 * ((x_m / t) / 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) tmp = 0.0 if (z_m <= 4e+58) tmp = Float64(-2.0 * Float64(x_m / Float64(z_m * t))); else tmp = Float64(-2.0 * Float64(Float64(x_m / t) / 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) tmp = 0.0; if (z_m <= 4e+58) tmp = -2.0 * (x_m / (z_m * t)); else tmp = -2.0 * ((x_m / t) / 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_] := N[(z$95$s * N[(x$95$s * If[LessEqual[z$95$m, 4e+58], N[(-2.0 * N[(x$95$m / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / 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)
\\
z_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 4 \cdot 10^{+58}:\\
\;\;\;\;-2 \cdot \frac{x_m}{z_m \cdot t}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x_m}{t}}{z_m}\\
\end{array}\right)
\end{array}
if z < 3.99999999999999978e58Initial program 90.4%
*-commutative90.4%
associate-*l/89.2%
*-commutative89.2%
distribute-rgt-out--90.2%
associate-/l/91.7%
Simplified91.7%
Taylor expanded in y around 0 54.2%
if 3.99999999999999978e58 < z Initial program 82.8%
*-commutative82.8%
associate-*l/82.8%
*-commutative82.8%
distribute-rgt-out--86.3%
associate-/l/88.0%
Simplified88.0%
Taylor expanded in y around 0 57.4%
associate-/r*65.9%
Simplified65.9%
Final simplification56.8%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x_s x_m y z_m t) :precision binary64 (* z_s (* x_s (* x_m (/ (/ 2.0 (- y t)) 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) {
return z_s * (x_s * (x_m * ((2.0 / (y - t)) / z_m)));
}
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 * (x_m * ((2.0d0 / (y - t)) / z_m)))
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 * (x_m * ((2.0 / (y - t)) / z_m)));
}
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 * (x_m * ((2.0 / (y - t)) / z_m)))
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(x_m * Float64(Float64(2.0 / Float64(y - t)) / z_m)))) 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 * (x_m * ((2.0 / (y - t)) / z_m))); 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[(x$95$m * N[(N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision] / 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)
\\
z_s \cdot \left(x_s \cdot \left(x_m \cdot \frac{\frac{2}{y - t}}{z_m}\right)\right)
\end{array}
Initial program 88.7%
*-commutative88.7%
associate-*l/87.8%
*-commutative87.8%
distribute-rgt-out--89.4%
associate-/l/90.9%
Simplified90.9%
Final simplification90.9%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) z_m = (fabs.f64 z) z_s = (copysign.f64 1 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(x_m / Float64(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[(x$95$m / N[(z$95$m * 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 \left(-2 \cdot \frac{x_m}{z_m \cdot t}\right)\right)
\end{array}
Initial program 88.7%
*-commutative88.7%
associate-*l/87.8%
*-commutative87.8%
distribute-rgt-out--89.4%
associate-/l/90.9%
Simplified90.9%
Taylor expanded in y around 0 54.9%
Final simplification54.9%
(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 2023322
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
:herbie-target
(if (< (/ (* x 2.0) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2.0) (if (< (/ (* x 2.0) (- (* y z) (* t z))) 1.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) (* (/ x (* (- y t) z)) 2.0)))
(/ (* x 2.0) (- (* y z) (* t z))))