
(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 9 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}
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 1e+85)
(/ (/ (* y_m (cosh x)) x) z)
(* (/ (cosh x) x) (/ y_m z)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1e+85) {
tmp = ((y_m * cosh(x)) / x) / z;
} else {
tmp = (cosh(x) / x) * (y_m / z);
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 1d+85) then
tmp = ((y_m * cosh(x)) / x) / z
else
tmp = (cosh(x) / x) * (y_m / z)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1e+85) {
tmp = ((y_m * Math.cosh(x)) / x) / z;
} else {
tmp = (Math.cosh(x) / x) * (y_m / z);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 1e+85: tmp = ((y_m * math.cosh(x)) / x) / z else: tmp = (math.cosh(x) / x) * (y_m / z) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 1e+85) tmp = Float64(Float64(Float64(y_m * cosh(x)) / x) / z); else tmp = Float64(Float64(cosh(x) / x) * Float64(y_m / z)); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 1e+85) tmp = ((y_m * cosh(x)) / x) / z; else tmp = (cosh(x) / x) * (y_m / z); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1e+85], N[(N[(N[(y$95$m * N[Cosh[x], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 10^{+85}:\\
\;\;\;\;\frac{\frac{y\_m \cdot \cosh x}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x} \cdot \frac{y\_m}{z}\\
\end{array}
\end{array}
if y < 1e85Initial program 86.7%
associate-*r/97.7%
Applied egg-rr97.7%
if 1e85 < y Initial program 87.5%
associate-*r/87.5%
Applied egg-rr87.5%
associate-/r*86.8%
times-frac99.9%
Applied egg-rr99.9%
Final simplification98.0%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= (/ (* (cosh x) (/ y_m x)) z) 5e-16)
(/ y_m (* x z))
(* (/ (cosh x) x) (/ y_m z)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (((cosh(x) * (y_m / x)) / z) <= 5e-16) {
tmp = y_m / (x * z);
} else {
tmp = (cosh(x) / x) * (y_m / z);
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (((cosh(x) * (y_m / x)) / z) <= 5d-16) then
tmp = y_m / (x * z)
else
tmp = (cosh(x) / x) * (y_m / z)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (((Math.cosh(x) * (y_m / x)) / z) <= 5e-16) {
tmp = y_m / (x * z);
} else {
tmp = (Math.cosh(x) / x) * (y_m / z);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if ((math.cosh(x) * (y_m / x)) / z) <= 5e-16: tmp = y_m / (x * z) else: tmp = (math.cosh(x) / x) * (y_m / z) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (Float64(Float64(cosh(x) * Float64(y_m / x)) / z) <= 5e-16) tmp = Float64(y_m / Float64(x * z)); else tmp = Float64(Float64(cosh(x) / x) * Float64(y_m / z)); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (((cosh(x) * (y_m / x)) / z) <= 5e-16) tmp = y_m / (x * z); else tmp = (cosh(x) / x) * (y_m / z); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(N[(N[Cosh[x], $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 5e-16], N[(y$95$m / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\cosh x \cdot \frac{y\_m}{x}}{z} \leq 5 \cdot 10^{-16}:\\
\;\;\;\;\frac{y\_m}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x} \cdot \frac{y\_m}{z}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 5.0000000000000004e-16Initial program 95.3%
associate-/l*87.1%
Simplified87.1%
Taylor expanded in x around 0 57.6%
if 5.0000000000000004e-16 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 78.9%
associate-*r/97.0%
Applied egg-rr97.0%
associate-/r*81.5%
times-frac92.3%
Applied egg-rr92.3%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= z 3.1e-68)
(* (cosh x) (/ (/ y_m z) x))
(if (<= z 5.8e+82)
(* y_m (/ (cosh x) (* x z)))
(* (/ y_m x) (/ (cosh x) z))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 3.1e-68) {
tmp = cosh(x) * ((y_m / z) / x);
} else if (z <= 5.8e+82) {
tmp = y_m * (cosh(x) / (x * z));
} else {
tmp = (y_m / x) * (cosh(x) / z);
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 3.1d-68) then
tmp = cosh(x) * ((y_m / z) / x)
else if (z <= 5.8d+82) then
tmp = y_m * (cosh(x) / (x * z))
else
tmp = (y_m / x) * (cosh(x) / z)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 3.1e-68) {
tmp = Math.cosh(x) * ((y_m / z) / x);
} else if (z <= 5.8e+82) {
tmp = y_m * (Math.cosh(x) / (x * z));
} else {
tmp = (y_m / x) * (Math.cosh(x) / z);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if z <= 3.1e-68: tmp = math.cosh(x) * ((y_m / z) / x) elif z <= 5.8e+82: tmp = y_m * (math.cosh(x) / (x * z)) else: tmp = (y_m / x) * (math.cosh(x) / z) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (z <= 3.1e-68) tmp = Float64(cosh(x) * Float64(Float64(y_m / z) / x)); elseif (z <= 5.8e+82) tmp = Float64(y_m * Float64(cosh(x) / Float64(x * z))); else tmp = Float64(Float64(y_m / x) * Float64(cosh(x) / z)); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (z <= 3.1e-68) tmp = cosh(x) * ((y_m / z) / x); elseif (z <= 5.8e+82) tmp = y_m * (cosh(x) / (x * z)); else tmp = (y_m / x) * (cosh(x) / z); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[z, 3.1e-68], N[(N[Cosh[x], $MachinePrecision] * N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.8e+82], N[(y$95$m * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m / x), $MachinePrecision] * N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 3.1 \cdot 10^{-68}:\\
\;\;\;\;\cosh x \cdot \frac{\frac{y\_m}{z}}{x}\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{+82}:\\
\;\;\;\;y\_m \cdot \frac{\cosh x}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{x} \cdot \frac{\cosh x}{z}\\
\end{array}
\end{array}
if z < 3.0999999999999999e-68Initial program 90.9%
associate-/l*87.6%
Simplified87.6%
associate-/l/81.9%
associate-/r*90.4%
Applied egg-rr90.4%
if 3.0999999999999999e-68 < z < 5.8000000000000003e82Initial program 79.8%
associate-/l*76.5%
Simplified76.5%
add-log-exp41.7%
*-un-lft-identity41.7%
log-prod41.7%
metadata-eval41.7%
add-log-exp76.5%
div-inv76.5%
frac-times76.5%
*-commutative76.5%
*-un-lft-identity76.5%
Applied egg-rr76.5%
+-lft-identity76.5%
*-commutative76.5%
associate-*l/96.6%
associate-/l*96.5%
Simplified96.5%
if 5.8000000000000003e82 < z Initial program 75.9%
associate-/l*54.9%
Simplified54.9%
associate-*r/75.9%
*-commutative75.9%
associate-/l*77.8%
Applied egg-rr77.8%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 2.6e-215)
(* y_m (/ (cosh x) (* x z)))
(* (cosh x) (/ (/ y_m z) x)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 2.6e-215) {
tmp = y_m * (cosh(x) / (x * z));
} else {
tmp = cosh(x) * ((y_m / z) / x);
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 2.6d-215) then
tmp = y_m * (cosh(x) / (x * z))
else
tmp = cosh(x) * ((y_m / z) / x)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 2.6e-215) {
tmp = y_m * (Math.cosh(x) / (x * z));
} else {
tmp = Math.cosh(x) * ((y_m / z) / x);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 2.6e-215: tmp = y_m * (math.cosh(x) / (x * z)) else: tmp = math.cosh(x) * ((y_m / z) / x) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 2.6e-215) tmp = Float64(y_m * Float64(cosh(x) / Float64(x * z))); else tmp = Float64(cosh(x) * Float64(Float64(y_m / z) / x)); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 2.6e-215) tmp = y_m * (cosh(x) / (x * z)); else tmp = cosh(x) * ((y_m / z) / x); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 2.6e-215], N[(y$95$m * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cosh[x], $MachinePrecision] * N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 2.6 \cdot 10^{-215}:\\
\;\;\;\;y\_m \cdot \frac{\cosh x}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\cosh x \cdot \frac{\frac{y\_m}{z}}{x}\\
\end{array}
\end{array}
if y < 2.6e-215Initial program 83.5%
associate-/l*75.5%
Simplified75.5%
add-log-exp51.2%
*-un-lft-identity51.2%
log-prod51.2%
metadata-eval51.2%
add-log-exp75.5%
div-inv75.5%
frac-times73.2%
*-commutative73.2%
*-un-lft-identity73.2%
Applied egg-rr73.2%
+-lft-identity73.2%
*-commutative73.2%
associate-*l/80.5%
associate-/l*80.6%
Simplified80.6%
if 2.6e-215 < y Initial program 90.7%
associate-/l*85.6%
Simplified85.6%
associate-/l/81.9%
associate-/r*88.9%
Applied egg-rr88.9%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= z 5.6e-188)
(* (cosh x) (/ (/ y_m x) z))
(* y_m (/ (cosh x) (* x z))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 5.6e-188) {
tmp = cosh(x) * ((y_m / x) / z);
} else {
tmp = y_m * (cosh(x) / (x * z));
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 5.6d-188) then
tmp = cosh(x) * ((y_m / x) / z)
else
tmp = y_m * (cosh(x) / (x * z))
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 5.6e-188) {
tmp = Math.cosh(x) * ((y_m / x) / z);
} else {
tmp = y_m * (Math.cosh(x) / (x * z));
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if z <= 5.6e-188: tmp = math.cosh(x) * ((y_m / x) / z) else: tmp = y_m * (math.cosh(x) / (x * z)) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (z <= 5.6e-188) tmp = Float64(cosh(x) * Float64(Float64(y_m / x) / z)); else tmp = Float64(y_m * Float64(cosh(x) / Float64(x * z))); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (z <= 5.6e-188) tmp = cosh(x) * ((y_m / x) / z); else tmp = y_m * (cosh(x) / (x * z)); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[z, 5.6e-188], N[(N[Cosh[x], $MachinePrecision] * N[(N[(y$95$m / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 5.6 \cdot 10^{-188}:\\
\;\;\;\;\cosh x \cdot \frac{\frac{y\_m}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \frac{\cosh x}{x \cdot z}\\
\end{array}
\end{array}
if z < 5.6000000000000002e-188Initial program 90.8%
associate-/l*86.9%
Simplified86.9%
if 5.6000000000000002e-188 < z Initial program 80.7%
associate-/l*69.8%
Simplified69.8%
add-log-exp42.2%
*-un-lft-identity42.2%
log-prod42.2%
metadata-eval42.2%
add-log-exp69.8%
div-inv69.8%
frac-times74.4%
*-commutative74.4%
*-un-lft-identity74.4%
Applied egg-rr74.4%
+-lft-identity74.4%
*-commutative74.4%
associate-*l/83.3%
associate-/l*84.0%
Simplified84.0%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= x 2.2e-37) (/ (/ y_m z) x) (* y_m (/ (cosh x) (* x z))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 2.2e-37) {
tmp = (y_m / z) / x;
} else {
tmp = y_m * (cosh(x) / (x * z));
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 2.2d-37) then
tmp = (y_m / z) / x
else
tmp = y_m * (cosh(x) / (x * z))
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 2.2e-37) {
tmp = (y_m / z) / x;
} else {
tmp = y_m * (Math.cosh(x) / (x * z));
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if x <= 2.2e-37: tmp = (y_m / z) / x else: tmp = y_m * (math.cosh(x) / (x * z)) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 2.2e-37) tmp = Float64(Float64(y_m / z) / x); else tmp = Float64(y_m * Float64(cosh(x) / Float64(x * z))); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (x <= 2.2e-37) tmp = (y_m / z) / x; else tmp = y_m * (cosh(x) / (x * z)); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 2.2e-37], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], N[(y$95$m * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 2.2 \cdot 10^{-37}:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \frac{\cosh x}{x \cdot z}\\
\end{array}
\end{array}
if x < 2.20000000000000002e-37Initial program 88.1%
associate-/l*82.7%
Simplified82.7%
Taylor expanded in x around 0 59.6%
*-commutative59.6%
associate-/r*65.0%
Applied egg-rr65.0%
if 2.20000000000000002e-37 < x Initial program 83.4%
associate-/l*73.5%
Simplified73.5%
add-log-exp64.4%
*-un-lft-identity64.4%
log-prod64.4%
metadata-eval64.4%
add-log-exp73.5%
div-inv73.5%
frac-times72.2%
*-commutative72.2%
*-un-lft-identity72.2%
Applied egg-rr72.2%
+-lft-identity72.2%
*-commutative72.2%
associate-*l/79.2%
associate-/l*79.2%
Simplified79.2%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= z 1e-29) (/ (/ y_m z) x) (/ y_m (* x z)))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 1e-29) {
tmp = (y_m / z) / x;
} else {
tmp = y_m / (x * z);
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1d-29) then
tmp = (y_m / z) / x
else
tmp = y_m / (x * z)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 1e-29) {
tmp = (y_m / z) / x;
} else {
tmp = y_m / (x * z);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if z <= 1e-29: tmp = (y_m / z) / x else: tmp = y_m / (x * z) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (z <= 1e-29) tmp = Float64(Float64(y_m / z) / x); else tmp = Float64(y_m / Float64(x * z)); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (z <= 1e-29) tmp = (y_m / z) / x; else tmp = y_m / (x * z); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[z, 1e-29], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], N[(y$95$m / N[(x * z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 10^{-29}:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{x \cdot z}\\
\end{array}
\end{array}
if z < 9.99999999999999943e-30Initial program 90.1%
associate-/l*86.9%
Simplified86.9%
Taylor expanded in x around 0 49.8%
*-commutative49.8%
associate-/r*59.9%
Applied egg-rr59.9%
if 9.99999999999999943e-30 < z Initial program 78.3%
associate-/l*62.9%
Simplified62.9%
Taylor expanded in x around 0 42.7%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= z 1e+120) (/ (/ y_m x) z) (/ y_m (* x z)))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 1e+120) {
tmp = (y_m / x) / z;
} else {
tmp = y_m / (x * z);
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1d+120) then
tmp = (y_m / x) / z
else
tmp = y_m / (x * z)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 1e+120) {
tmp = (y_m / x) / z;
} else {
tmp = y_m / (x * z);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if z <= 1e+120: tmp = (y_m / x) / z else: tmp = y_m / (x * z) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (z <= 1e+120) tmp = Float64(Float64(y_m / x) / z); else tmp = Float64(y_m / Float64(x * z)); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (z <= 1e+120) tmp = (y_m / x) / z; else tmp = y_m / (x * z); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[z, 1e+120], N[(N[(y$95$m / x), $MachinePrecision] / z), $MachinePrecision], N[(y$95$m / N[(x * z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 10^{+120}:\\
\;\;\;\;\frac{\frac{y\_m}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{x \cdot z}\\
\end{array}
\end{array}
if z < 9.9999999999999998e119Initial program 89.6%
Taylor expanded in x around 0 53.1%
if 9.9999999999999998e119 < z Initial program 73.1%
associate-/l*51.9%
Simplified51.9%
Taylor expanded in x around 0 45.2%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (/ y_m (* x z))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
return y_s * (y_m / (x * z));
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (y_m / (x * z))
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
return y_s * (y_m / (x * z));
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): return y_s * (y_m / (x * z))
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) return Float64(y_s * Float64(y_m / Float64(x * z))) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m, z) tmp = y_s * (y_m / (x * z)); end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(y$95$m / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \frac{y\_m}{x \cdot z}
\end{array}
Initial program 86.8%
associate-/l*80.1%
Simplified80.1%
Taylor expanded in x around 0 47.8%
(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 2024096
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:precision binary64
:alt
(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))