
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
:precision binary64
(*
z_s
(if (<= z_m 1.6e-113)
(/ (/ (cosh x) (/ z_m y)) x)
(/ y (* x (/ z_m (cosh x)))))))z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if (z_m <= 1.6e-113) {
tmp = (cosh(x) / (z_m / y)) / x;
} else {
tmp = y / (x * (z_m / cosh(x)));
}
return z_s * tmp;
}
z_m = abs(z)
z_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 1.6d-113) then
tmp = (cosh(x) / (z_m / y)) / x
else
tmp = y / (x * (z_m / cosh(x)))
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if (z_m <= 1.6e-113) {
tmp = (Math.cosh(x) / (z_m / y)) / x;
} else {
tmp = y / (x * (z_m / Math.cosh(x)));
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if z_m <= 1.6e-113: tmp = (math.cosh(x) / (z_m / y)) / x else: tmp = y / (x * (z_m / math.cosh(x))) return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (z_m <= 1.6e-113) tmp = Float64(Float64(cosh(x) / Float64(z_m / y)) / x); else tmp = Float64(y / Float64(x * Float64(z_m / cosh(x)))); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if (z_m <= 1.6e-113) tmp = (cosh(x) / (z_m / y)) / x; else tmp = y / (x * (z_m / cosh(x))); end tmp_2 = z_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[z$95$m, 1.6e-113], N[(N[(N[Cosh[x], $MachinePrecision] / N[(z$95$m / y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(y / N[(x * N[(z$95$m / N[Cosh[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 1.6 \cdot 10^{-113}:\\
\;\;\;\;\frac{\frac{\cosh x}{\frac{z_m}{y}}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot \frac{z_m}{\cosh x}}\\
\end{array}
\end{array}
if z < 1.6000000000000001e-113Initial program 83.4%
associate-*l/83.3%
Simplified83.3%
associate-/r/79.8%
associate-/r/85.7%
associate-/r*91.7%
Applied egg-rr91.7%
if 1.6000000000000001e-113 < z Initial program 81.4%
associate-*l/81.3%
Simplified81.3%
clear-num81.3%
frac-times99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Final simplification94.5%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (if (<= x 1.3e-75) (/ y (* z_m x)) (* (/ (cosh x) z_m) (/ y x)))))
z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if (x <= 1.3e-75) {
tmp = y / (z_m * x);
} else {
tmp = (cosh(x) / z_m) * (y / x);
}
return z_s * tmp;
}
z_m = abs(z)
z_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (x <= 1.3d-75) then
tmp = y / (z_m * x)
else
tmp = (cosh(x) / z_m) * (y / x)
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if (x <= 1.3e-75) {
tmp = y / (z_m * x);
} else {
tmp = (Math.cosh(x) / z_m) * (y / x);
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if x <= 1.3e-75: tmp = y / (z_m * x) else: tmp = (math.cosh(x) / z_m) * (y / x) return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (x <= 1.3e-75) tmp = Float64(y / Float64(z_m * x)); else tmp = Float64(Float64(cosh(x) / z_m) * Float64(y / x)); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if (x <= 1.3e-75) tmp = y / (z_m * x); else tmp = (cosh(x) / z_m) * (y / x); end tmp_2 = z_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[x, 1.3e-75], N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cosh[x], $MachinePrecision] / z$95$m), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.3 \cdot 10^{-75}:\\
\;\;\;\;\frac{y}{z_m \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{z_m} \cdot \frac{y}{x}\\
\end{array}
\end{array}
if x < 1.3e-75Initial program 81.8%
associate-*l/81.8%
Simplified81.8%
Taylor expanded in x around 0 62.6%
if 1.3e-75 < x Initial program 84.8%
associate-*l/84.8%
Simplified84.8%
Final simplification68.9%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
:precision binary64
(*
z_s
(if (<= z_m 2e-113)
(/ (* y (/ (cosh x) x)) z_m)
(/ y (* x (/ z_m (cosh x)))))))z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if (z_m <= 2e-113) {
tmp = (y * (cosh(x) / x)) / z_m;
} else {
tmp = y / (x * (z_m / cosh(x)));
}
return z_s * tmp;
}
z_m = abs(z)
z_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 2d-113) then
tmp = (y * (cosh(x) / x)) / z_m
else
tmp = y / (x * (z_m / cosh(x)))
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if (z_m <= 2e-113) {
tmp = (y * (Math.cosh(x) / x)) / z_m;
} else {
tmp = y / (x * (z_m / Math.cosh(x)));
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if z_m <= 2e-113: tmp = (y * (math.cosh(x) / x)) / z_m else: tmp = y / (x * (z_m / math.cosh(x))) return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (z_m <= 2e-113) tmp = Float64(Float64(y * Float64(cosh(x) / x)) / z_m); else tmp = Float64(y / Float64(x * Float64(z_m / cosh(x)))); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if (z_m <= 2e-113) tmp = (y * (cosh(x) / x)) / z_m; else tmp = y / (x * (z_m / cosh(x))); end tmp_2 = z_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[z$95$m, 2e-113], N[(N[(y * N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], N[(y / N[(x * N[(z$95$m / N[Cosh[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 2 \cdot 10^{-113}:\\
\;\;\;\;\frac{y \cdot \frac{\cosh x}{x}}{z_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot \frac{z_m}{\cosh x}}\\
\end{array}
\end{array}
if z < 1.99999999999999996e-113Initial program 83.4%
expm1-log1p-u51.0%
expm1-udef40.1%
Applied egg-rr40.1%
expm1-def51.0%
expm1-log1p83.4%
associate-*r/94.8%
associate-*l/94.8%
*-commutative94.8%
Simplified94.8%
if 1.99999999999999996e-113 < z Initial program 81.4%
associate-*l/81.3%
Simplified81.3%
clear-num81.3%
frac-times99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Final simplification96.5%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (/ y (* x (/ z_m (cosh x))))))
z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
return z_s * (y / (x * (z_m / cosh(x))));
}
z_m = abs(z)
z_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
code = z_s * (y / (x * (z_m / cosh(x))))
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
return z_s * (y / (x * (z_m / Math.cosh(x))));
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): return z_s * (y / (x * (z_m / math.cosh(x))))
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) return Float64(z_s * Float64(y / Float64(x * Float64(z_m / cosh(x))))) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp = code(z_s, x, y, z_m) tmp = z_s * (y / (x * (z_m / cosh(x)))); end
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * N[(y / N[(x * N[(z$95$m / N[Cosh[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z_s \cdot \frac{y}{x \cdot \frac{z_m}{\cosh x}}
\end{array}
Initial program 82.7%
associate-*l/82.6%
Simplified82.6%
clear-num82.6%
frac-times96.9%
*-un-lft-identity96.9%
Applied egg-rr96.9%
Final simplification96.9%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
:precision binary64
(let* ((t_0 (/ (/ z_m x) y)))
(*
z_s
(if (<= z_m 1.6e-114)
(/ (+ (* (/ y x) t_0) (* z_m 0.5)) (* z_m t_0))
(if (<= z_m 6.9e+109)
(/ (+ y (* x (* y (* x 0.5)))) (* z_m x))
(+ (/ y (* z_m x)) (* 0.5 (/ (* x y) z_m))))))))z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double t_0 = (z_m / x) / y;
double tmp;
if (z_m <= 1.6e-114) {
tmp = (((y / x) * t_0) + (z_m * 0.5)) / (z_m * t_0);
} else if (z_m <= 6.9e+109) {
tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x);
} else {
tmp = (y / (z_m * x)) + (0.5 * ((x * y) / z_m));
}
return z_s * tmp;
}
z_m = abs(z)
z_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: t_0
real(8) :: tmp
t_0 = (z_m / x) / y
if (z_m <= 1.6d-114) then
tmp = (((y / x) * t_0) + (z_m * 0.5d0)) / (z_m * t_0)
else if (z_m <= 6.9d+109) then
tmp = (y + (x * (y * (x * 0.5d0)))) / (z_m * x)
else
tmp = (y / (z_m * x)) + (0.5d0 * ((x * y) / z_m))
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double t_0 = (z_m / x) / y;
double tmp;
if (z_m <= 1.6e-114) {
tmp = (((y / x) * t_0) + (z_m * 0.5)) / (z_m * t_0);
} else if (z_m <= 6.9e+109) {
tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x);
} else {
tmp = (y / (z_m * x)) + (0.5 * ((x * y) / z_m));
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): t_0 = (z_m / x) / y tmp = 0 if z_m <= 1.6e-114: tmp = (((y / x) * t_0) + (z_m * 0.5)) / (z_m * t_0) elif z_m <= 6.9e+109: tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x) else: tmp = (y / (z_m * x)) + (0.5 * ((x * y) / z_m)) return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) t_0 = Float64(Float64(z_m / x) / y) tmp = 0.0 if (z_m <= 1.6e-114) tmp = Float64(Float64(Float64(Float64(y / x) * t_0) + Float64(z_m * 0.5)) / Float64(z_m * t_0)); elseif (z_m <= 6.9e+109) tmp = Float64(Float64(y + Float64(x * Float64(y * Float64(x * 0.5)))) / Float64(z_m * x)); else tmp = Float64(Float64(y / Float64(z_m * x)) + Float64(0.5 * Float64(Float64(x * y) / z_m))); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) t_0 = (z_m / x) / y; tmp = 0.0; if (z_m <= 1.6e-114) tmp = (((y / x) * t_0) + (z_m * 0.5)) / (z_m * t_0); elseif (z_m <= 6.9e+109) tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x); else tmp = (y / (z_m * x)) + (0.5 * ((x * y) / z_m)); end tmp_2 = z_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := Block[{t$95$0 = N[(N[(z$95$m / x), $MachinePrecision] / y), $MachinePrecision]}, N[(z$95$s * If[LessEqual[z$95$m, 1.6e-114], N[(N[(N[(N[(y / x), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(z$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / N[(z$95$m * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 6.9e+109], N[(N[(y + N[(x * N[(y * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(x * y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
\begin{array}{l}
t_0 := \frac{\frac{z_m}{x}}{y}\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 1.6 \cdot 10^{-114}:\\
\;\;\;\;\frac{\frac{y}{x} \cdot t_0 + z_m \cdot 0.5}{z_m \cdot t_0}\\
\mathbf{elif}\;z_m \leq 6.9 \cdot 10^{+109}:\\
\;\;\;\;\frac{y + x \cdot \left(y \cdot \left(x \cdot 0.5\right)\right)}{z_m \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z_m \cdot x} + 0.5 \cdot \frac{x \cdot y}{z_m}\\
\end{array}
\end{array}
\end{array}
if z < 1.6000000000000001e-114Initial program 83.4%
associate-*l/83.3%
Simplified83.3%
Taylor expanded in x around 0 71.3%
div-inv71.3%
*-commutative71.3%
associate-*l*74.2%
Applied egg-rr74.2%
+-commutative74.2%
associate-/r*73.6%
associate-*r*73.6%
un-div-inv73.6%
associate-*r/70.7%
associate-*r*70.7%
associate-/l*70.7%
frac-add51.9%
*-commutative51.9%
associate-/r*51.7%
*-commutative51.7%
associate-/r*57.3%
Applied egg-rr57.3%
if 1.6000000000000001e-114 < z < 6.8999999999999999e109Initial program 84.6%
associate-*l/84.5%
Simplified84.5%
Taylor expanded in x around 0 58.1%
+-commutative58.1%
associate-/r*56.1%
*-un-lft-identity56.1%
associate-*l/56.1%
associate-*r/58.0%
associate-*r/58.0%
frac-add70.6%
associate-*l/70.6%
*-un-lft-identity70.6%
associate-*r*70.6%
*-commutative70.6%
Applied egg-rr70.6%
Taylor expanded in y around 0 70.6%
if 6.8999999999999999e109 < z Initial program 78.1%
associate-*l/78.0%
Simplified78.0%
Taylor expanded in x around 0 75.8%
Final simplification62.8%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
:precision binary64
(*
z_s
(if (<= z_m 1.6e-113)
(* (/ y z_m) (+ (* x 0.5) (/ 1.0 x)))
(if (<= z_m 2.2e+109)
(/ (+ y (* x (* y (* x 0.5)))) (* z_m x))
(+ (/ y (* z_m x)) (* 0.5 (/ (* x y) z_m)))))))z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if (z_m <= 1.6e-113) {
tmp = (y / z_m) * ((x * 0.5) + (1.0 / x));
} else if (z_m <= 2.2e+109) {
tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x);
} else {
tmp = (y / (z_m * x)) + (0.5 * ((x * y) / z_m));
}
return z_s * tmp;
}
z_m = abs(z)
z_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 1.6d-113) then
tmp = (y / z_m) * ((x * 0.5d0) + (1.0d0 / x))
else if (z_m <= 2.2d+109) then
tmp = (y + (x * (y * (x * 0.5d0)))) / (z_m * x)
else
tmp = (y / (z_m * x)) + (0.5d0 * ((x * y) / z_m))
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if (z_m <= 1.6e-113) {
tmp = (y / z_m) * ((x * 0.5) + (1.0 / x));
} else if (z_m <= 2.2e+109) {
tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x);
} else {
tmp = (y / (z_m * x)) + (0.5 * ((x * y) / z_m));
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if z_m <= 1.6e-113: tmp = (y / z_m) * ((x * 0.5) + (1.0 / x)) elif z_m <= 2.2e+109: tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x) else: tmp = (y / (z_m * x)) + (0.5 * ((x * y) / z_m)) return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (z_m <= 1.6e-113) tmp = Float64(Float64(y / z_m) * Float64(Float64(x * 0.5) + Float64(1.0 / x))); elseif (z_m <= 2.2e+109) tmp = Float64(Float64(y + Float64(x * Float64(y * Float64(x * 0.5)))) / Float64(z_m * x)); else tmp = Float64(Float64(y / Float64(z_m * x)) + Float64(0.5 * Float64(Float64(x * y) / z_m))); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if (z_m <= 1.6e-113) tmp = (y / z_m) * ((x * 0.5) + (1.0 / x)); elseif (z_m <= 2.2e+109) tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x); else tmp = (y / (z_m * x)) + (0.5 * ((x * y) / z_m)); end tmp_2 = z_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[z$95$m, 1.6e-113], N[(N[(y / z$95$m), $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 2.2e+109], N[(N[(y + N[(x * N[(y * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(x * y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 1.6 \cdot 10^{-113}:\\
\;\;\;\;\frac{y}{z_m} \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)\\
\mathbf{elif}\;z_m \leq 2.2 \cdot 10^{+109}:\\
\;\;\;\;\frac{y + x \cdot \left(y \cdot \left(x \cdot 0.5\right)\right)}{z_m \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z_m \cdot x} + 0.5 \cdot \frac{x \cdot y}{z_m}\\
\end{array}
\end{array}
if z < 1.6000000000000001e-113Initial program 83.4%
associate-*l/83.3%
Simplified83.3%
Taylor expanded in x around 0 71.3%
div-inv71.3%
*-commutative71.3%
associate-*l*74.2%
Applied egg-rr74.2%
un-div-inv74.2%
clear-num74.2%
Applied egg-rr74.2%
Taylor expanded in y around 0 73.6%
distribute-lft-in73.6%
*-commutative73.6%
associate-*r/74.2%
*-rgt-identity74.2%
*-commutative74.2%
associate-*r*74.2%
associate-*r/71.3%
associate-*l/69.1%
+-commutative69.1%
*-rgt-identity69.1%
times-frac70.0%
associate-*l*70.0%
distribute-lft-out70.0%
Simplified70.0%
if 1.6000000000000001e-113 < z < 2.1999999999999999e109Initial program 84.6%
associate-*l/84.5%
Simplified84.5%
Taylor expanded in x around 0 58.1%
+-commutative58.1%
associate-/r*56.1%
*-un-lft-identity56.1%
associate-*l/56.1%
associate-*r/58.0%
associate-*r/58.0%
frac-add70.6%
associate-*l/70.6%
*-un-lft-identity70.6%
associate-*r*70.6%
*-commutative70.6%
Applied egg-rr70.6%
Taylor expanded in y around 0 70.6%
if 2.1999999999999999e109 < z Initial program 78.1%
associate-*l/78.0%
Simplified78.0%
Taylor expanded in x around 0 75.8%
Final simplification71.1%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
:precision binary64
(*
z_s
(if (<= z_m 7.1e+71)
(/ (* y (+ (* x 0.5) (/ 1.0 x))) z_m)
(+ (/ y (* z_m x)) (* 0.5 (* x (/ y z_m)))))))z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if (z_m <= 7.1e+71) {
tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m;
} else {
tmp = (y / (z_m * x)) + (0.5 * (x * (y / z_m)));
}
return z_s * tmp;
}
z_m = abs(z)
z_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 7.1d+71) then
tmp = (y * ((x * 0.5d0) + (1.0d0 / x))) / z_m
else
tmp = (y / (z_m * x)) + (0.5d0 * (x * (y / z_m)))
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if (z_m <= 7.1e+71) {
tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m;
} else {
tmp = (y / (z_m * x)) + (0.5 * (x * (y / z_m)));
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if z_m <= 7.1e+71: tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m else: tmp = (y / (z_m * x)) + (0.5 * (x * (y / z_m))) return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (z_m <= 7.1e+71) tmp = Float64(Float64(y * Float64(Float64(x * 0.5) + Float64(1.0 / x))) / z_m); else tmp = Float64(Float64(y / Float64(z_m * x)) + Float64(0.5 * Float64(x * Float64(y / z_m)))); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if (z_m <= 7.1e+71) tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m; else tmp = (y / (z_m * x)) + (0.5 * (x * (y / z_m))); end tmp_2 = z_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[z$95$m, 7.1e+71], N[(N[(y * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], N[(N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[(y / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 7.1 \cdot 10^{+71}:\\
\;\;\;\;\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z_m \cdot x} + 0.5 \cdot \left(x \cdot \frac{y}{z_m}\right)\\
\end{array}
\end{array}
if z < 7.09999999999999986e71Initial program 83.6%
Taylor expanded in x around 0 68.5%
Taylor expanded in y around 0 68.5%
if 7.09999999999999986e71 < z Initial program 78.9%
associate-*l/78.8%
Simplified78.8%
Taylor expanded in x around 0 72.9%
div-inv72.9%
associate-*l*65.2%
*-commutative65.2%
associate-*l/65.2%
*-un-lft-identity65.2%
Applied egg-rr65.2%
Final simplification67.9%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
:precision binary64
(let* ((t_0 (/ y (* z_m x))))
(*
z_s
(if (<= z_m 2e-49)
(+ t_0 (* 0.5 (/ y (/ z_m x))))
(+ t_0 (* 0.5 (/ (* x y) z_m)))))))z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double t_0 = y / (z_m * x);
double tmp;
if (z_m <= 2e-49) {
tmp = t_0 + (0.5 * (y / (z_m / x)));
} else {
tmp = t_0 + (0.5 * ((x * y) / z_m));
}
return z_s * tmp;
}
z_m = abs(z)
z_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: t_0
real(8) :: tmp
t_0 = y / (z_m * x)
if (z_m <= 2d-49) then
tmp = t_0 + (0.5d0 * (y / (z_m / x)))
else
tmp = t_0 + (0.5d0 * ((x * y) / z_m))
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double t_0 = y / (z_m * x);
double tmp;
if (z_m <= 2e-49) {
tmp = t_0 + (0.5 * (y / (z_m / x)));
} else {
tmp = t_0 + (0.5 * ((x * y) / z_m));
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): t_0 = y / (z_m * x) tmp = 0 if z_m <= 2e-49: tmp = t_0 + (0.5 * (y / (z_m / x))) else: tmp = t_0 + (0.5 * ((x * y) / z_m)) return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) t_0 = Float64(y / Float64(z_m * x)) tmp = 0.0 if (z_m <= 2e-49) tmp = Float64(t_0 + Float64(0.5 * Float64(y / Float64(z_m / x)))); else tmp = Float64(t_0 + Float64(0.5 * Float64(Float64(x * y) / z_m))); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) t_0 = y / (z_m * x); tmp = 0.0; if (z_m <= 2e-49) tmp = t_0 + (0.5 * (y / (z_m / x))); else tmp = t_0 + (0.5 * ((x * y) / z_m)); end tmp_2 = z_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := Block[{t$95$0 = N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * If[LessEqual[z$95$m, 2e-49], N[(t$95$0 + N[(0.5 * N[(y / N[(z$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(0.5 * N[(N[(x * y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
\begin{array}{l}
t_0 := \frac{y}{z_m \cdot x}\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 2 \cdot 10^{-49}:\\
\;\;\;\;t_0 + 0.5 \cdot \frac{y}{\frac{z_m}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0 + 0.5 \cdot \frac{x \cdot y}{z_m}\\
\end{array}
\end{array}
\end{array}
if z < 1.99999999999999987e-49Initial program 83.4%
associate-*l/83.3%
Simplified83.3%
Taylor expanded in x around 0 71.0%
div-inv71.0%
*-commutative71.0%
associate-*l*73.6%
Applied egg-rr73.6%
associate-*r*71.0%
div-inv71.0%
associate-/l*73.6%
Applied egg-rr73.6%
if 1.99999999999999987e-49 < z Initial program 80.9%
associate-*l/80.8%
Simplified80.8%
Taylor expanded in x around 0 66.5%
Final simplification71.6%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (if (<= z_m 1.8e+72) (/ (* y (+ (* x 0.5) (/ 1.0 x))) z_m) (/ y (* z_m x)))))
z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if (z_m <= 1.8e+72) {
tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m;
} else {
tmp = y / (z_m * x);
}
return z_s * tmp;
}
z_m = abs(z)
z_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 1.8d+72) then
tmp = (y * ((x * 0.5d0) + (1.0d0 / x))) / z_m
else
tmp = y / (z_m * x)
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if (z_m <= 1.8e+72) {
tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m;
} else {
tmp = y / (z_m * x);
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if z_m <= 1.8e+72: tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m else: tmp = y / (z_m * x) return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (z_m <= 1.8e+72) tmp = Float64(Float64(y * Float64(Float64(x * 0.5) + Float64(1.0 / x))) / z_m); else tmp = Float64(y / Float64(z_m * x)); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if (z_m <= 1.8e+72) tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m; else tmp = y / (z_m * x); end tmp_2 = z_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[z$95$m, 1.8e+72], N[(N[(y * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 1.8 \cdot 10^{+72}:\\
\;\;\;\;\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z_m \cdot x}\\
\end{array}
\end{array}
if z < 1.80000000000000017e72Initial program 83.7%
Taylor expanded in x around 0 68.2%
Taylor expanded in y around 0 68.2%
if 1.80000000000000017e72 < z Initial program 78.5%
associate-*l/78.4%
Simplified78.4%
Taylor expanded in x around 0 66.0%
Final simplification67.8%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (+ (/ y (* z_m x)) (* 0.5 (/ y (/ z_m x))))))
z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
return z_s * ((y / (z_m * x)) + (0.5 * (y / (z_m / x))));
}
z_m = abs(z)
z_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
code = z_s * ((y / (z_m * x)) + (0.5d0 * (y / (z_m / x))))
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
return z_s * ((y / (z_m * x)) + (0.5 * (y / (z_m / x))));
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): return z_s * ((y / (z_m * x)) + (0.5 * (y / (z_m / x))))
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) return Float64(z_s * Float64(Float64(y / Float64(z_m * x)) + Float64(0.5 * Float64(y / Float64(z_m / x))))) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp = code(z_s, x, y, z_m) tmp = z_s * ((y / (z_m * x)) + (0.5 * (y / (z_m / x)))); end
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * N[(N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(y / N[(z$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z_s \cdot \left(\frac{y}{z_m \cdot x} + 0.5 \cdot \frac{y}{\frac{z_m}{x}}\right)
\end{array}
Initial program 82.7%
associate-*l/82.6%
Simplified82.6%
Taylor expanded in x around 0 69.8%
div-inv69.8%
*-commutative69.8%
associate-*l*70.1%
Applied egg-rr70.1%
associate-*r*69.8%
div-inv69.8%
associate-/l*70.1%
Applied egg-rr70.1%
Final simplification70.1%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (if (<= x 1.45) (/ y (* z_m x)) (* 0.5 (* y (/ x z_m))))))
z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if (x <= 1.45) {
tmp = y / (z_m * x);
} else {
tmp = 0.5 * (y * (x / z_m));
}
return z_s * tmp;
}
z_m = abs(z)
z_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (x <= 1.45d0) then
tmp = y / (z_m * x)
else
tmp = 0.5d0 * (y * (x / z_m))
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if (x <= 1.45) {
tmp = y / (z_m * x);
} else {
tmp = 0.5 * (y * (x / z_m));
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if x <= 1.45: tmp = y / (z_m * x) else: tmp = 0.5 * (y * (x / z_m)) return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (x <= 1.45) tmp = Float64(y / Float64(z_m * x)); else tmp = Float64(0.5 * Float64(y * Float64(x / z_m))); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if (x <= 1.45) tmp = y / (z_m * x); else tmp = 0.5 * (y * (x / z_m)); end tmp_2 = z_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[x, 1.45], N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y * N[(x / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.45:\\
\;\;\;\;\frac{y}{z_m \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{z_m}\right)\\
\end{array}
\end{array}
if x < 1.44999999999999996Initial program 83.2%
associate-*l/83.1%
Simplified83.1%
Taylor expanded in x around 0 64.4%
if 1.44999999999999996 < x Initial program 81.0%
associate-*l/81.0%
Simplified81.0%
Taylor expanded in x around 0 42.0%
Taylor expanded in x around inf 42.0%
associate-*l/41.9%
*-commutative41.9%
Simplified41.9%
Final simplification59.3%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (if (<= y 1.15e-63) (/ (/ y x) z_m) (/ y (* z_m x)))))
z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if (y <= 1.15e-63) {
tmp = (y / x) / z_m;
} else {
tmp = y / (z_m * x);
}
return z_s * tmp;
}
z_m = abs(z)
z_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (y <= 1.15d-63) then
tmp = (y / x) / z_m
else
tmp = y / (z_m * x)
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if (y <= 1.15e-63) {
tmp = (y / x) / z_m;
} else {
tmp = y / (z_m * x);
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if y <= 1.15e-63: tmp = (y / x) / z_m else: tmp = y / (z_m * x) return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (y <= 1.15e-63) tmp = Float64(Float64(y / x) / z_m); else tmp = Float64(y / Float64(z_m * x)); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if (y <= 1.15e-63) tmp = (y / x) / z_m; else tmp = y / (z_m * x); end tmp_2 = z_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[y, 1.15e-63], N[(N[(y / x), $MachinePrecision] / z$95$m), $MachinePrecision], N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq 1.15 \cdot 10^{-63}:\\
\;\;\;\;\frac{\frac{y}{x}}{z_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z_m \cdot x}\\
\end{array}
\end{array}
if y < 1.15e-63Initial program 79.6%
Taylor expanded in x around 0 53.2%
if 1.15e-63 < y Initial program 89.9%
associate-*l/89.9%
Simplified89.9%
Taylor expanded in x around 0 44.2%
Final simplification50.5%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (if (<= z_m 100000000000.0) (/ (/ y z_m) x) (/ y (* z_m x)))))
z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if (z_m <= 100000000000.0) {
tmp = (y / z_m) / x;
} else {
tmp = y / (z_m * x);
}
return z_s * tmp;
}
z_m = abs(z)
z_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 100000000000.0d0) then
tmp = (y / z_m) / x
else
tmp = y / (z_m * x)
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if (z_m <= 100000000000.0) {
tmp = (y / z_m) / x;
} else {
tmp = y / (z_m * x);
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if z_m <= 100000000000.0: tmp = (y / z_m) / x else: tmp = y / (z_m * x) return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (z_m <= 100000000000.0) tmp = Float64(Float64(y / z_m) / x); else tmp = Float64(y / Float64(z_m * x)); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if (z_m <= 100000000000.0) tmp = (y / z_m) / x; else tmp = y / (z_m * x); end tmp_2 = z_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[z$95$m, 100000000000.0], N[(N[(y / z$95$m), $MachinePrecision] / x), $MachinePrecision], N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 100000000000:\\
\;\;\;\;\frac{\frac{y}{z_m}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z_m \cdot x}\\
\end{array}
\end{array}
if z < 1e11Initial program 83.2%
associate-*l/83.1%
Simplified83.1%
Taylor expanded in x around 0 47.8%
associate-*r/56.4%
associate-*l/56.4%
*-un-lft-identity56.4%
Applied egg-rr56.4%
if 1e11 < z Initial program 81.1%
associate-*l/81.0%
Simplified81.0%
Taylor expanded in x around 0 61.9%
Final simplification57.7%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (/ y (* z_m x))))
z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
return z_s * (y / (z_m * x));
}
z_m = abs(z)
z_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
code = z_s * (y / (z_m * x))
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
return z_s * (y / (z_m * x));
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): return z_s * (y / (z_m * x))
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) return Float64(z_s * Float64(y / Float64(z_m * x))) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp = code(z_s, x, y, z_m) tmp = z_s * (y / (z_m * x)); end
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z_s \cdot \frac{y}{z_m \cdot x}
\end{array}
Initial program 82.7%
associate-*l/82.6%
Simplified82.6%
Taylor expanded in x around 0 51.6%
Final simplification51.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ (/ y z) x) (cosh x))))
(if (< y -4.618902267687042e-52)
t_0
(if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) t_0))))
double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((y / z) / x) * cosh(x)
if (y < (-4.618902267687042d-52)) then
tmp = t_0
else if (y < 1.038530535935153d-39) then
tmp = ((cosh(x) * y) / x) / z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * Math.cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((Math.cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y / z) / x) * math.cosh(x) tmp = 0 if y < -4.618902267687042e-52: tmp = t_0 elif y < 1.038530535935153e-39: tmp = ((math.cosh(x) * y) / x) / z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y / z) / x) * cosh(x)) tmp = 0.0 if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = Float64(Float64(Float64(cosh(x) * y) / x) / z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y / z) / x) * cosh(x); tmp = 0.0; if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = ((cosh(x) * y) / x) / z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision]}, If[Less[y, -4.618902267687042e-52], t$95$0, If[Less[y, 1.038530535935153e-39], N[(N[(N[(N[Cosh[x], $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{z}}{x} \cdot \cosh x\\
\mathbf{if}\;y < -4.618902267687042 \cdot 10^{-52}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y < 1.038530535935153 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
herbie shell --seed 2024010
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< y -4.618902267687042e-52) (* (/ (/ y z) x) (cosh x)) (if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))