
(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 16 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.85e-40)
(/ (/ (cosh x) (/ z_m y)) x)
(* y (/ (/ (cosh x) 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.85e-40) {
tmp = (cosh(x) / (z_m / y)) / x;
} else {
tmp = y * ((cosh(x) / 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.85d-40) then
tmp = (cosh(x) / (z_m / y)) / x
else
tmp = y * ((cosh(x) / 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.85e-40) {
tmp = (Math.cosh(x) / (z_m / y)) / x;
} else {
tmp = y * ((Math.cosh(x) / 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.85e-40: tmp = (math.cosh(x) / (z_m / y)) / x else: tmp = y * ((math.cosh(x) / 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.85e-40) tmp = Float64(Float64(cosh(x) / Float64(z_m / y)) / x); else tmp = Float64(y * Float64(Float64(cosh(x) / 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.85e-40) tmp = (cosh(x) / (z_m / y)) / x; else tmp = y * ((cosh(x) / 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.85e-40], N[(N[(N[Cosh[x], $MachinePrecision] / N[(z$95$m / y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(y * N[(N[(N[Cosh[x], $MachinePrecision] / z$95$m), $MachinePrecision] / 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.85 \cdot 10^{-40}:\\
\;\;\;\;\frac{\frac{\cosh x}{\frac{z\_m}{y}}}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\frac{\cosh x}{z\_m}}{x}\\
\end{array}
\end{array}
if z < 1.84999999999999999e-40Initial program 91.5%
associate-*l/91.5%
Simplified91.5%
associate-/r/88.7%
associate-/r/87.4%
associate-/r*91.3%
Applied egg-rr91.3%
if 1.84999999999999999e-40 < z Initial program 85.0%
associate-*l/85.0%
Simplified85.0%
expm1-log1p-u54.5%
expm1-udef41.3%
associate-*l/41.3%
div-inv41.3%
associate-*l*37.4%
div-inv37.4%
Applied egg-rr37.4%
expm1-def49.4%
expm1-log1p78.6%
associate-*r/85.0%
associate-*l/85.0%
*-commutative85.0%
associate-*l/98.3%
associate-*r/99.8%
Simplified99.8%
Final simplification93.9%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (let* ((t_0 (* (cosh x) (/ y x)))) (* z_s (if (<= t_0 5e+213) (/ t_0 z_m) (* y (/ (/ (cosh x) z_m) x))))))
z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double t_0 = cosh(x) * (y / x);
double tmp;
if (t_0 <= 5e+213) {
tmp = t_0 / z_m;
} else {
tmp = y * ((cosh(x) / 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) :: t_0
real(8) :: tmp
t_0 = cosh(x) * (y / x)
if (t_0 <= 5d+213) then
tmp = t_0 / z_m
else
tmp = y * ((cosh(x) / z_m) / x)
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double t_0 = Math.cosh(x) * (y / x);
double tmp;
if (t_0 <= 5e+213) {
tmp = t_0 / z_m;
} else {
tmp = y * ((Math.cosh(x) / z_m) / x);
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): t_0 = math.cosh(x) * (y / x) tmp = 0 if t_0 <= 5e+213: tmp = t_0 / z_m else: tmp = y * ((math.cosh(x) / z_m) / x) return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) t_0 = Float64(cosh(x) * Float64(y / x)) tmp = 0.0 if (t_0 <= 5e+213) tmp = Float64(t_0 / z_m); else tmp = Float64(y * Float64(Float64(cosh(x) / z_m) / x)); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) t_0 = cosh(x) * (y / x); tmp = 0.0; if (t_0 <= 5e+213) tmp = t_0 / z_m; else tmp = y * ((cosh(x) / 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_] := Block[{t$95$0 = N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * If[LessEqual[t$95$0, 5e+213], N[(t$95$0 / z$95$m), $MachinePrecision], N[(y * N[(N[(N[Cosh[x], $MachinePrecision] / z$95$m), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
\begin{array}{l}
t_0 := \cosh x \cdot \frac{y}{x}\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+213}:\\
\;\;\;\;\frac{t\_0}{z\_m}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\frac{\cosh x}{z\_m}}{x}\\
\end{array}
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 4.9999999999999998e213Initial program 95.9%
if 4.9999999999999998e213 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 76.8%
associate-*l/76.8%
Simplified76.8%
expm1-log1p-u42.5%
expm1-udef42.5%
associate-*l/42.5%
div-inv42.5%
associate-*l*39.0%
div-inv39.0%
Applied egg-rr39.0%
expm1-def39.0%
expm1-log1p70.9%
associate-*r/76.8%
associate-*l/76.8%
*-commutative76.8%
associate-*l/100.0%
associate-*r/99.9%
Simplified99.9%
Final simplification97.2%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (if (<= x 2.65e-109) (/ (/ y z_m) x) (* y (/ (/ (cosh x) 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 (x <= 2.65e-109) {
tmp = (y / z_m) / x;
} else {
tmp = y * ((cosh(x) / 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 (x <= 2.65d-109) then
tmp = (y / z_m) / x
else
tmp = y * ((cosh(x) / 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 (x <= 2.65e-109) {
tmp = (y / z_m) / x;
} else {
tmp = y * ((Math.cosh(x) / 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 x <= 2.65e-109: tmp = (y / z_m) / x else: tmp = y * ((math.cosh(x) / 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 (x <= 2.65e-109) tmp = Float64(Float64(y / z_m) / x); else tmp = Float64(y * Float64(Float64(cosh(x) / 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 (x <= 2.65e-109) tmp = (y / z_m) / x; else tmp = y * ((cosh(x) / 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[x, 2.65e-109], N[(N[(y / z$95$m), $MachinePrecision] / x), $MachinePrecision], N[(y * N[(N[(N[Cosh[x], $MachinePrecision] / z$95$m), $MachinePrecision] / 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 2.65 \cdot 10^{-109}:\\
\;\;\;\;\frac{\frac{y}{z\_m}}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\frac{\cosh x}{z\_m}}{x}\\
\end{array}
\end{array}
if x < 2.6499999999999999e-109Initial program 91.5%
associate-*l/91.5%
Simplified91.5%
Taylor expanded in x around 0 65.2%
associate-*r/67.0%
associate-*l/67.0%
*-un-lft-identity67.0%
Applied egg-rr67.0%
if 2.6499999999999999e-109 < x Initial program 85.4%
associate-*l/85.4%
Simplified85.4%
expm1-log1p-u54.6%
expm1-udef43.2%
associate-*l/43.2%
div-inv43.2%
associate-*l*40.8%
div-inv40.8%
Applied egg-rr40.8%
expm1-def51.0%
expm1-log1p79.5%
associate-*r/85.4%
associate-*l/85.4%
*-commutative85.4%
associate-*l/97.7%
associate-*r/98.8%
Simplified98.8%
Final simplification77.3%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (let* ((t_0 (/ (cosh x) z_m))) (* z_s (if (<= z_m 1.45e-96) (* t_0 (/ y x)) (* y (/ t_0 x))))))
z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double t_0 = cosh(x) / z_m;
double tmp;
if (z_m <= 1.45e-96) {
tmp = t_0 * (y / x);
} else {
tmp = y * (t_0 / 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) :: t_0
real(8) :: tmp
t_0 = cosh(x) / z_m
if (z_m <= 1.45d-96) then
tmp = t_0 * (y / x)
else
tmp = y * (t_0 / x)
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double t_0 = Math.cosh(x) / z_m;
double tmp;
if (z_m <= 1.45e-96) {
tmp = t_0 * (y / x);
} else {
tmp = y * (t_0 / x);
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): t_0 = math.cosh(x) / z_m tmp = 0 if z_m <= 1.45e-96: tmp = t_0 * (y / x) else: tmp = y * (t_0 / x) 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(cosh(x) / z_m) tmp = 0.0 if (z_m <= 1.45e-96) tmp = Float64(t_0 * Float64(y / x)); else tmp = Float64(y * Float64(t_0 / x)); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) t_0 = cosh(x) / z_m; tmp = 0.0; if (z_m <= 1.45e-96) tmp = t_0 * (y / x); else tmp = y * (t_0 / 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_] := Block[{t$95$0 = N[(N[Cosh[x], $MachinePrecision] / z$95$m), $MachinePrecision]}, N[(z$95$s * If[LessEqual[z$95$m, 1.45e-96], N[(t$95$0 * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(y * N[(t$95$0 / x), $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{\cosh x}{z\_m}\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 1.45 \cdot 10^{-96}:\\
\;\;\;\;t\_0 \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t\_0}{x}\\
\end{array}
\end{array}
\end{array}
if z < 1.44999999999999997e-96Initial program 90.9%
associate-*l/90.8%
Simplified90.8%
if 1.44999999999999997e-96 < z Initial program 87.0%
associate-*l/87.0%
Simplified87.0%
expm1-log1p-u55.9%
expm1-udef43.4%
associate-*l/43.4%
div-inv43.4%
associate-*l*40.0%
div-inv40.0%
Applied egg-rr40.0%
expm1-def51.5%
expm1-log1p81.5%
associate-*r/87.0%
associate-*l/87.0%
*-commutative87.0%
associate-*l/98.5%
associate-*r/99.8%
Simplified99.8%
Final simplification94.0%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
:precision binary64
(let* ((t_0 (* 0.5 (* x y))))
(*
z_s
(if (<= z_m 3.7e-56)
(/ (+ (/ y x) t_0) z_m)
(if (<= z_m 1.45e+78)
(/ (+ (* t_0 (* z_m x)) (* z_m y)) (* z_m (* z_m x)))
(+ (* 0.5 (/ (* x y) 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 t_0 = 0.5 * (x * y);
double tmp;
if (z_m <= 3.7e-56) {
tmp = ((y / x) + t_0) / z_m;
} else if (z_m <= 1.45e+78) {
tmp = ((t_0 * (z_m * x)) + (z_m * y)) / (z_m * (z_m * x));
} else {
tmp = (0.5 * ((x * y) / z_m)) + (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) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (x * y)
if (z_m <= 3.7d-56) then
tmp = ((y / x) + t_0) / z_m
else if (z_m <= 1.45d+78) then
tmp = ((t_0 * (z_m * x)) + (z_m * y)) / (z_m * (z_m * x))
else
tmp = (0.5d0 * ((x * y) / z_m)) + (y / (z_m * x))
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double t_0 = 0.5 * (x * y);
double tmp;
if (z_m <= 3.7e-56) {
tmp = ((y / x) + t_0) / z_m;
} else if (z_m <= 1.45e+78) {
tmp = ((t_0 * (z_m * x)) + (z_m * y)) / (z_m * (z_m * x));
} else {
tmp = (0.5 * ((x * y) / z_m)) + (y / (z_m * x));
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): t_0 = 0.5 * (x * y) tmp = 0 if z_m <= 3.7e-56: tmp = ((y / x) + t_0) / z_m elif z_m <= 1.45e+78: tmp = ((t_0 * (z_m * x)) + (z_m * y)) / (z_m * (z_m * x)) else: tmp = (0.5 * ((x * y) / z_m)) + (y / (z_m * x)) return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) t_0 = Float64(0.5 * Float64(x * y)) tmp = 0.0 if (z_m <= 3.7e-56) tmp = Float64(Float64(Float64(y / x) + t_0) / z_m); elseif (z_m <= 1.45e+78) tmp = Float64(Float64(Float64(t_0 * Float64(z_m * x)) + Float64(z_m * y)) / Float64(z_m * Float64(z_m * x))); else tmp = Float64(Float64(0.5 * Float64(Float64(x * y) / z_m)) + Float64(y / Float64(z_m * x))); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) t_0 = 0.5 * (x * y); tmp = 0.0; if (z_m <= 3.7e-56) tmp = ((y / x) + t_0) / z_m; elseif (z_m <= 1.45e+78) tmp = ((t_0 * (z_m * x)) + (z_m * y)) / (z_m * (z_m * x)); else tmp = (0.5 * ((x * y) / z_m)) + (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_] := Block[{t$95$0 = N[(0.5 * N[(x * y), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * If[LessEqual[z$95$m, 3.7e-56], N[(N[(N[(y / x), $MachinePrecision] + t$95$0), $MachinePrecision] / z$95$m), $MachinePrecision], If[LessEqual[z$95$m, 1.45e+78], N[(N[(N[(t$95$0 * N[(z$95$m * x), $MachinePrecision]), $MachinePrecision] + N[(z$95$m * y), $MachinePrecision]), $MachinePrecision] / N[(z$95$m * N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(N[(x * y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision] + N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(x \cdot y\right)\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 3.7 \cdot 10^{-56}:\\
\;\;\;\;\frac{\frac{y}{x} + t\_0}{z\_m}\\
\mathbf{elif}\;z\_m \leq 1.45 \cdot 10^{+78}:\\
\;\;\;\;\frac{t\_0 \cdot \left(z\_m \cdot x\right) + z\_m \cdot y}{z\_m \cdot \left(z\_m \cdot x\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{z\_m} + \frac{y}{z\_m \cdot x}\\
\end{array}
\end{array}
\end{array}
if z < 3.7000000000000002e-56Initial program 91.2%
Taylor expanded in x around 0 71.1%
if 3.7000000000000002e-56 < z < 1.45000000000000008e78Initial program 94.1%
associate-*l/94.1%
Simplified94.1%
Taylor expanded in x around 0 77.4%
associate-*r/77.4%
frac-add82.6%
*-commutative82.6%
*-commutative82.6%
Applied egg-rr82.6%
if 1.45000000000000008e78 < z Initial program 80.2%
associate-*l/80.2%
Simplified80.2%
Taylor expanded in x around 0 69.6%
Final simplification72.4%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
:precision binary64
(let* ((t_0 (* 0.5 (* x y))))
(*
z_s
(if (<= z_m 5e-96)
(/ (+ (/ y x) t_0) z_m)
(if (<= z_m 1.35e+135)
(/ (+ y (* x t_0)) (* z_m x))
(+ (* 0.5 (/ (* x y) 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 t_0 = 0.5 * (x * y);
double tmp;
if (z_m <= 5e-96) {
tmp = ((y / x) + t_0) / z_m;
} else if (z_m <= 1.35e+135) {
tmp = (y + (x * t_0)) / (z_m * x);
} else {
tmp = (0.5 * ((x * y) / z_m)) + (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) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (x * y)
if (z_m <= 5d-96) then
tmp = ((y / x) + t_0) / z_m
else if (z_m <= 1.35d+135) then
tmp = (y + (x * t_0)) / (z_m * x)
else
tmp = (0.5d0 * ((x * y) / z_m)) + (y / (z_m * x))
end if
code = z_s * tmp
end function
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double t_0 = 0.5 * (x * y);
double tmp;
if (z_m <= 5e-96) {
tmp = ((y / x) + t_0) / z_m;
} else if (z_m <= 1.35e+135) {
tmp = (y + (x * t_0)) / (z_m * x);
} else {
tmp = (0.5 * ((x * y) / z_m)) + (y / (z_m * x));
}
return z_s * tmp;
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): t_0 = 0.5 * (x * y) tmp = 0 if z_m <= 5e-96: tmp = ((y / x) + t_0) / z_m elif z_m <= 1.35e+135: tmp = (y + (x * t_0)) / (z_m * x) else: tmp = (0.5 * ((x * y) / z_m)) + (y / (z_m * x)) return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) t_0 = Float64(0.5 * Float64(x * y)) tmp = 0.0 if (z_m <= 5e-96) tmp = Float64(Float64(Float64(y / x) + t_0) / z_m); elseif (z_m <= 1.35e+135) tmp = Float64(Float64(y + Float64(x * t_0)) / Float64(z_m * x)); else tmp = Float64(Float64(0.5 * Float64(Float64(x * y) / z_m)) + Float64(y / Float64(z_m * x))); end return Float64(z_s * tmp) end
z_m = abs(z); z_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) t_0 = 0.5 * (x * y); tmp = 0.0; if (z_m <= 5e-96) tmp = ((y / x) + t_0) / z_m; elseif (z_m <= 1.35e+135) tmp = (y + (x * t_0)) / (z_m * x); else tmp = (0.5 * ((x * y) / z_m)) + (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_] := Block[{t$95$0 = N[(0.5 * N[(x * y), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * If[LessEqual[z$95$m, 5e-96], N[(N[(N[(y / x), $MachinePrecision] + t$95$0), $MachinePrecision] / z$95$m), $MachinePrecision], If[LessEqual[z$95$m, 1.35e+135], N[(N[(y + N[(x * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(N[(x * y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision] + N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(x \cdot y\right)\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 5 \cdot 10^{-96}:\\
\;\;\;\;\frac{\frac{y}{x} + t\_0}{z\_m}\\
\mathbf{elif}\;z\_m \leq 1.35 \cdot 10^{+135}:\\
\;\;\;\;\frac{y + x \cdot t\_0}{z\_m \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{z\_m} + \frac{y}{z\_m \cdot x}\\
\end{array}
\end{array}
\end{array}
if z < 4.99999999999999995e-96Initial program 90.9%
Taylor expanded in x around 0 71.6%
if 4.99999999999999995e-96 < z < 1.34999999999999992e135Initial program 93.3%
associate-*l/93.3%
Simplified93.3%
Taylor expanded in x around 0 70.1%
+-commutative70.1%
associate-/r*67.0%
*-un-lft-identity67.0%
associate-*l/67.0%
associate-*r/70.1%
associate-*r/70.1%
frac-add76.5%
associate-*l/76.5%
*-un-lft-identity76.5%
*-commutative76.5%
*-commutative76.5%
Applied egg-rr76.5%
Taylor expanded in y around 0 76.6%
if 1.34999999999999992e135 < z Initial program 75.3%
associate-*l/75.4%
Simplified75.4%
Taylor expanded in x around 0 74.8%
Final simplification73.1%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
:precision binary64
(*
z_s
(if (<= y 4.2e+181)
(/ (+ (/ y x) (* 0.5 (* x y))) 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 (y <= 4.2e+181) {
tmp = ((y / x) + (0.5 * (x * y))) / 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 (y <= 4.2d+181) then
tmp = ((y / x) + (0.5d0 * (x * y))) / 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 (y <= 4.2e+181) {
tmp = ((y / x) + (0.5 * (x * y))) / 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 y <= 4.2e+181: tmp = ((y / x) + (0.5 * (x * y))) / 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 (y <= 4.2e+181) tmp = Float64(Float64(Float64(y / x) + Float64(0.5 * Float64(x * y))) / 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 (y <= 4.2e+181) tmp = ((y / x) + (0.5 * (x * y))) / 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[y, 4.2e+181], N[(N[(N[(y / x), $MachinePrecision] + N[(0.5 * N[(x * y), $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}\;y \leq 4.2 \cdot 10^{+181}:\\
\;\;\;\;\frac{\frac{y}{x} + 0.5 \cdot \left(x \cdot y\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 y < 4.19999999999999995e181Initial program 90.0%
Taylor expanded in x around 0 66.9%
if 4.19999999999999995e181 < y Initial program 85.5%
associate-*l/85.5%
Simplified85.5%
Taylor expanded in x around 0 96.4%
expm1-log1p-u57.7%
expm1-udef57.7%
div-inv57.7%
associate-*l*57.7%
*-commutative57.7%
associate-*l/57.7%
*-un-lft-identity57.7%
Applied egg-rr57.7%
expm1-def57.7%
expm1-log1p92.7%
Simplified92.7%
Final simplification69.5%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
:precision binary64
(*
z_s
(if (<= y 6e+32)
(/ (+ (/ y x) (* 0.5 (* x y))) z_m)
(+ (* 0.5 (/ (* x y) 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 <= 6e+32) {
tmp = ((y / x) + (0.5 * (x * y))) / z_m;
} else {
tmp = (0.5 * ((x * y) / z_m)) + (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 <= 6d+32) then
tmp = ((y / x) + (0.5d0 * (x * y))) / z_m
else
tmp = (0.5d0 * ((x * y) / z_m)) + (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 <= 6e+32) {
tmp = ((y / x) + (0.5 * (x * y))) / z_m;
} else {
tmp = (0.5 * ((x * y) / z_m)) + (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 <= 6e+32: tmp = ((y / x) + (0.5 * (x * y))) / z_m else: tmp = (0.5 * ((x * y) / z_m)) + (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 <= 6e+32) tmp = Float64(Float64(Float64(y / x) + Float64(0.5 * Float64(x * y))) / z_m); else tmp = Float64(Float64(0.5 * Float64(Float64(x * y) / z_m)) + 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 <= 6e+32) tmp = ((y / x) + (0.5 * (x * y))) / z_m; else tmp = (0.5 * ((x * y) / z_m)) + (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, 6e+32], N[(N[(N[(y / x), $MachinePrecision] + N[(0.5 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], N[(N[(0.5 * N[(N[(x * y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision] + N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq 6 \cdot 10^{+32}:\\
\;\;\;\;\frac{\frac{y}{x} + 0.5 \cdot \left(x \cdot y\right)}{z\_m}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{z\_m} + \frac{y}{z\_m \cdot x}\\
\end{array}
\end{array}
if y < 6e32Initial program 88.7%
Taylor expanded in x around 0 66.9%
if 6e32 < y Initial program 92.2%
associate-*l/92.1%
Simplified92.1%
Taylor expanded in x around 0 80.9%
Final simplification70.2%
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.4) (/ (/ 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 (x <= 1.4) {
tmp = (y / z_m) / x;
} else {
tmp = 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 (x <= 1.4d0) then
tmp = (y / z_m) / x
else
tmp = 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 (x <= 1.4) {
tmp = (y / z_m) / x;
} else {
tmp = 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 x <= 1.4: tmp = (y / z_m) / x else: tmp = 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 (x <= 1.4) tmp = Float64(Float64(y / z_m) / x); else tmp = 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 (x <= 1.4) tmp = (y / z_m) / x; else tmp = 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[x, 1.4], N[(N[(y / z$95$m), $MachinePrecision] / x), $MachinePrecision], N[(0.5 * N[(x * N[(y / 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.4:\\
\;\;\;\;\frac{\frac{y}{z\_m}}{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{z\_m}\right)\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 92.6%
associate-*l/92.5%
Simplified92.5%
Taylor expanded in x around 0 69.3%
associate-*r/69.9%
associate-*l/69.9%
*-un-lft-identity69.9%
Applied egg-rr69.9%
if 1.3999999999999999 < x Initial program 79.3%
associate-*l/79.3%
Simplified79.3%
Taylor expanded in x around 0 32.1%
Taylor expanded in x around inf 32.1%
associate-*r/22.4%
Simplified22.4%
Final simplification59.2%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (if (<= x 190.0) (/ (/ 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 <= 190.0) {
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 <= 190.0d0) 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 <= 190.0) {
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 <= 190.0: 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 <= 190.0) tmp = Float64(Float64(y / 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 <= 190.0) 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, 190.0], N[(N[(y / z$95$m), $MachinePrecision] / x), $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 190:\\
\;\;\;\;\frac{\frac{y}{z\_m}}{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{z\_m}\right)\\
\end{array}
\end{array}
if x < 190Initial program 92.6%
associate-*l/92.6%
Simplified92.6%
Taylor expanded in x around 0 69.0%
associate-*r/69.6%
associate-*l/69.6%
*-un-lft-identity69.6%
Applied egg-rr69.6%
if 190 < x Initial program 78.9%
associate-*l/78.9%
Simplified78.9%
Taylor expanded in x around 0 32.5%
Taylor expanded in x around inf 32.5%
associate-*l/31.0%
*-commutative31.0%
Simplified31.0%
Final simplification61.0%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (if (<= x 190.0) (/ (/ 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 (x <= 190.0) {
tmp = (y / z_m) / x;
} else {
tmp = 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 (x <= 190.0d0) then
tmp = (y / z_m) / x
else
tmp = 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 (x <= 190.0) {
tmp = (y / z_m) / x;
} else {
tmp = 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 x <= 190.0: tmp = (y / z_m) / x else: tmp = 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 (x <= 190.0) tmp = Float64(Float64(y / z_m) / x); else tmp = 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 (x <= 190.0) tmp = (y / z_m) / x; else tmp = 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[x, 190.0], N[(N[(y / z$95$m), $MachinePrecision] / x), $MachinePrecision], N[(0.5 * N[(N[(x * y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 190:\\
\;\;\;\;\frac{\frac{y}{z\_m}}{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{z\_m}\\
\end{array}
\end{array}
if x < 190Initial program 92.6%
associate-*l/92.6%
Simplified92.6%
Taylor expanded in x around 0 69.0%
associate-*r/69.6%
associate-*l/69.6%
*-un-lft-identity69.6%
Applied egg-rr69.6%
if 190 < x Initial program 78.9%
associate-*l/78.9%
Simplified78.9%
Taylor expanded in x around 0 32.5%
Taylor expanded in x around inf 32.5%
Final simplification61.4%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (/ (* y (+ (* x 0.5) (/ 1.0 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) {
return z_s * ((y * ((x * 0.5) + (1.0 / x))) / z_m);
}
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 * 0.5d0) + (1.0d0 / x))) / z_m)
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 * 0.5) + (1.0 / x))) / z_m);
}
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 * 0.5) + (1.0 / x))) / z_m)
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(Float64(x * 0.5) + Float64(1.0 / x))) / z_m)) 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 * 0.5) + (1.0 / x))) / z_m); 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[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z\_m}
\end{array}
Initial program 89.6%
Taylor expanded in x around 0 68.4%
Taylor expanded in y around 0 68.3%
Final simplification68.3%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (/ (+ (/ y 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) {
return z_s * (((y / x) + (0.5 * (x * y))) / z_m);
}
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) + (0.5d0 * (x * y))) / z_m)
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) + (0.5 * (x * y))) / z_m);
}
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) + (0.5 * (x * y))) / z_m)
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m) return Float64(z_s * Float64(Float64(Float64(y / x) + Float64(0.5 * Float64(x * y))) / z_m)) 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) + (0.5 * (x * y))) / z_m); 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[(N[(y / x), $MachinePrecision] + N[(0.5 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \frac{\frac{y}{x} + 0.5 \cdot \left(x \cdot y\right)}{z\_m}
\end{array}
Initial program 89.6%
Taylor expanded in x around 0 68.4%
Final simplification68.4%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (if (<= y 4.5e+32) (/ (/ 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 <= 4.5e+32) {
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 <= 4.5d+32) 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 <= 4.5e+32) {
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 <= 4.5e+32: 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 <= 4.5e+32) 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 <= 4.5e+32) 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, 4.5e+32], 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 4.5 \cdot 10^{+32}:\\
\;\;\;\;\frac{\frac{y}{x}}{z\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z\_m \cdot x}\\
\end{array}
\end{array}
if y < 4.5000000000000003e32Initial program 88.7%
Taylor expanded in x around 0 56.1%
if 4.5000000000000003e32 < y Initial program 92.2%
associate-*l/92.1%
Simplified92.1%
Taylor expanded in x around 0 57.9%
Final simplification56.5%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (if (<= y 7e+15) (/ (/ 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 <= 7e+15) {
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 <= 7d+15) 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 <= 7e+15) {
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 <= 7e+15: 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 <= 7e+15) tmp = Float64(Float64(y / x) / z_m); else tmp = Float64(Float64(y / 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 <= 7e+15) 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, 7e+15], N[(N[(y / x), $MachinePrecision] / z$95$m), $MachinePrecision], N[(N[(y / z$95$m), $MachinePrecision] / x), $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 7 \cdot 10^{+15}:\\
\;\;\;\;\frac{\frac{y}{x}}{z\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z\_m}}{x}\\
\end{array}
\end{array}
if y < 7e15Initial program 88.4%
Taylor expanded in x around 0 55.7%
if 7e15 < y Initial program 92.8%
associate-*l/92.8%
Simplified92.8%
Taylor expanded in x around 0 51.7%
associate-*r/61.6%
associate-*l/61.6%
*-un-lft-identity61.6%
Applied egg-rr61.6%
Final simplification57.2%
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 89.6%
associate-*l/89.5%
Simplified89.5%
Taylor expanded in x around 0 53.0%
Final simplification53.0%
(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 2024026
(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))