
(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 8 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}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(let* ((t_0 (* (cosh x_m) (/ y_m x_m))))
(*
y_s
(* x_s (if (<= t_0 4e+289) (/ t_0 z) (* y_m (/ (/ (cosh x_m) x_m) z)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double t_0 = cosh(x_m) * (y_m / x_m);
double tmp;
if (t_0 <= 4e+289) {
tmp = t_0 / z;
} else {
tmp = y_m * ((cosh(x_m) / x_m) / z);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = cosh(x_m) * (y_m / x_m)
if (t_0 <= 4d+289) then
tmp = t_0 / z
else
tmp = y_m * ((cosh(x_m) / x_m) / z)
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double t_0 = Math.cosh(x_m) * (y_m / x_m);
double tmp;
if (t_0 <= 4e+289) {
tmp = t_0 / z;
} else {
tmp = y_m * ((Math.cosh(x_m) / x_m) / z);
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): t_0 = math.cosh(x_m) * (y_m / x_m) tmp = 0 if t_0 <= 4e+289: tmp = t_0 / z else: tmp = y_m * ((math.cosh(x_m) / x_m) / z) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) t_0 = Float64(cosh(x_m) * Float64(y_m / x_m)) tmp = 0.0 if (t_0 <= 4e+289) tmp = Float64(t_0 / z); else tmp = Float64(y_m * Float64(Float64(cosh(x_m) / x_m) / z)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_s, x_m, y_m, z) t_0 = cosh(x_m) * (y_m / x_m); tmp = 0.0; if (t_0 <= 4e+289) tmp = t_0 / z; else tmp = y_m * ((cosh(x_m) / x_m) / z); end tmp_2 = y_s * (x_s * tmp); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(N[Cosh[x$95$m], $MachinePrecision] * N[(y$95$m / x$95$m), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[t$95$0, 4e+289], N[(t$95$0 / z), $MachinePrecision], N[(y$95$m * N[(N[(N[Cosh[x$95$m], $MachinePrecision] / x$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \cosh x\_m \cdot \frac{y\_m}{x\_m}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 4 \cdot 10^{+289}:\\
\;\;\;\;\frac{t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \frac{\frac{\cosh x\_m}{x\_m}}{z}\\
\end{array}\right)
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 4.0000000000000002e289Initial program 99.3%
if 4.0000000000000002e289 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 67.0%
associate-/l*56.2%
associate-/l/63.4%
Simplified63.4%
clear-num63.4%
un-div-inv63.4%
*-commutative63.4%
associate-/l*68.8%
Applied egg-rr68.8%
associate-*r/63.4%
associate-/r/78.5%
associate-/l/100.0%
*-commutative100.0%
associate-/l/78.5%
associate-/r*100.0%
Simplified100.0%
Final simplification99.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= x_m 7e-145) (/ (/ y_m z) x_m) (* y_m (/ (/ (cosh x_m) x_m) z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (x_m <= 7e-145) {
tmp = (y_m / z) / x_m;
} else {
tmp = y_m * ((cosh(x_m) / x_m) / z);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x_m <= 7d-145) then
tmp = (y_m / z) / x_m
else
tmp = y_m * ((cosh(x_m) / x_m) / z)
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (x_m <= 7e-145) {
tmp = (y_m / z) / x_m;
} else {
tmp = y_m * ((Math.cosh(x_m) / x_m) / z);
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if x_m <= 7e-145: tmp = (y_m / z) / x_m else: tmp = y_m * ((math.cosh(x_m) / x_m) / z) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (x_m <= 7e-145) tmp = Float64(Float64(y_m / z) / x_m); else tmp = Float64(y_m * Float64(Float64(cosh(x_m) / x_m) / z)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_s, x_m, y_m, z) tmp = 0.0; if (x_m <= 7e-145) tmp = (y_m / z) / x_m; else tmp = y_m * ((cosh(x_m) / x_m) / z); end tmp_2 = y_s * (x_s * tmp); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[x$95$m, 7e-145], N[(N[(y$95$m / z), $MachinePrecision] / x$95$m), $MachinePrecision], N[(y$95$m * N[(N[(N[Cosh[x$95$m], $MachinePrecision] / x$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 7 \cdot 10^{-145}:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \frac{\frac{\cosh x\_m}{x\_m}}{z}\\
\end{array}\right)
\end{array}
if x < 6.99999999999999994e-145Initial program 87.1%
associate-/l*79.4%
associate-/l/76.6%
Simplified76.6%
associate-*r/83.7%
frac-times87.0%
*-commutative87.0%
associate-*l/97.2%
Applied egg-rr97.2%
Taylor expanded in x around 0 62.8%
if 6.99999999999999994e-145 < x Initial program 88.4%
associate-/l*79.2%
associate-/l/75.3%
Simplified75.3%
clear-num75.2%
un-div-inv75.2%
*-commutative75.2%
associate-/l*81.6%
Applied egg-rr81.6%
associate-*r/75.2%
associate-/r/81.5%
associate-/l/98.8%
*-commutative98.8%
associate-/l/81.5%
associate-/r*98.8%
Simplified98.8%
Final simplification75.0%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= z 3.5e-63)
(/ (cosh x_m) (* x_m (/ z y_m)))
(* y_m (/ (/ (cosh x_m) x_m) z))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 3.5e-63) {
tmp = cosh(x_m) / (x_m * (z / y_m));
} else {
tmp = y_m * ((cosh(x_m) / x_m) / z);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 3.5d-63) then
tmp = cosh(x_m) / (x_m * (z / y_m))
else
tmp = y_m * ((cosh(x_m) / x_m) / z)
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 3.5e-63) {
tmp = Math.cosh(x_m) / (x_m * (z / y_m));
} else {
tmp = y_m * ((Math.cosh(x_m) / x_m) / z);
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if z <= 3.5e-63: tmp = math.cosh(x_m) / (x_m * (z / y_m)) else: tmp = y_m * ((math.cosh(x_m) / x_m) / z) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (z <= 3.5e-63) tmp = Float64(cosh(x_m) / Float64(x_m * Float64(z / y_m))); else tmp = Float64(y_m * Float64(Float64(cosh(x_m) / x_m) / z)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_s, x_m, y_m, z) tmp = 0.0; if (z <= 3.5e-63) tmp = cosh(x_m) / (x_m * (z / y_m)); else tmp = y_m * ((cosh(x_m) / x_m) / z); end tmp_2 = y_s * (x_s * tmp); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 3.5e-63], N[(N[Cosh[x$95$m], $MachinePrecision] / N[(x$95$m * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(N[(N[Cosh[x$95$m], $MachinePrecision] / x$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 3.5 \cdot 10^{-63}:\\
\;\;\;\;\frac{\cosh x\_m}{x\_m \cdot \frac{z}{y\_m}}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \frac{\frac{\cosh x\_m}{x\_m}}{z}\\
\end{array}\right)
\end{array}
if z < 3.50000000000000003e-63Initial program 87.2%
associate-/l*79.9%
associate-/l/75.1%
Simplified75.1%
clear-num74.7%
un-div-inv74.7%
*-commutative74.7%
associate-/l*82.3%
Applied egg-rr82.3%
if 3.50000000000000003e-63 < z Initial program 88.4%
associate-/l*77.9%
associate-/l/78.8%
Simplified78.8%
clear-num78.7%
un-div-inv78.7%
*-commutative78.7%
associate-/l*80.4%
Applied egg-rr80.4%
associate-*r/78.7%
associate-/r/85.2%
associate-/l/99.7%
*-commutative99.7%
associate-/l/85.2%
associate-/r*99.8%
Simplified99.8%
Final simplification87.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (let* ((t_0 (/ (cosh x_m) x_m))) (* y_s (* x_s (if (<= y_m 4.5e+19) (/ (* y_m t_0) z) (* y_m (/ t_0 z)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double t_0 = cosh(x_m) / x_m;
double tmp;
if (y_m <= 4.5e+19) {
tmp = (y_m * t_0) / z;
} else {
tmp = y_m * (t_0 / z);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = cosh(x_m) / x_m
if (y_m <= 4.5d+19) then
tmp = (y_m * t_0) / z
else
tmp = y_m * (t_0 / z)
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double t_0 = Math.cosh(x_m) / x_m;
double tmp;
if (y_m <= 4.5e+19) {
tmp = (y_m * t_0) / z;
} else {
tmp = y_m * (t_0 / z);
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): t_0 = math.cosh(x_m) / x_m tmp = 0 if y_m <= 4.5e+19: tmp = (y_m * t_0) / z else: tmp = y_m * (t_0 / z) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) t_0 = Float64(cosh(x_m) / x_m) tmp = 0.0 if (y_m <= 4.5e+19) tmp = Float64(Float64(y_m * t_0) / z); else tmp = Float64(y_m * Float64(t_0 / z)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_s, x_m, y_m, z) t_0 = cosh(x_m) / x_m; tmp = 0.0; if (y_m <= 4.5e+19) tmp = (y_m * t_0) / z; else tmp = y_m * (t_0 / z); end tmp_2 = y_s * (x_s * tmp); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(N[Cosh[x$95$m], $MachinePrecision] / x$95$m), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[y$95$m, 4.5e+19], N[(N[(y$95$m * t$95$0), $MachinePrecision] / z), $MachinePrecision], N[(y$95$m * N[(t$95$0 / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{\cosh x\_m}{x\_m}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 4.5 \cdot 10^{+19}:\\
\;\;\;\;\frac{y\_m \cdot t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \frac{t\_0}{z}\\
\end{array}\right)
\end{array}
\end{array}
if y < 4.5e19Initial program 85.5%
associate-/l*75.3%
associate-/l/72.9%
Simplified72.9%
clear-num72.5%
un-div-inv72.5%
*-commutative72.5%
associate-/l*77.4%
Applied egg-rr77.4%
associate-*r/72.5%
associate-/r/80.9%
associate-/l/93.0%
*-commutative93.0%
associate-/l/80.9%
associate-/r*93.0%
Simplified93.0%
associate-*r/97.5%
Applied egg-rr97.5%
if 4.5e19 < y Initial program 96.0%
associate-/l*96.0%
associate-/l/89.8%
Simplified89.8%
clear-num89.8%
un-div-inv89.8%
*-commutative89.8%
associate-/l*99.8%
Applied egg-rr99.8%
associate-*r/89.8%
associate-/r/89.7%
associate-/l/99.7%
*-commutative99.7%
associate-/l/89.7%
associate-/r*99.8%
Simplified99.8%
Final simplification98.0%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= y_m 7.5e-132)
(/ (* y_m (/ (cosh x_m) x_m)) z)
(/ (* y_m (/ (cosh x_m) z)) x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 7.5e-132) {
tmp = (y_m * (cosh(x_m) / x_m)) / z;
} else {
tmp = (y_m * (cosh(x_m) / z)) / x_m;
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 7.5d-132) then
tmp = (y_m * (cosh(x_m) / x_m)) / z
else
tmp = (y_m * (cosh(x_m) / z)) / x_m
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 7.5e-132) {
tmp = (y_m * (Math.cosh(x_m) / x_m)) / z;
} else {
tmp = (y_m * (Math.cosh(x_m) / z)) / x_m;
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if y_m <= 7.5e-132: tmp = (y_m * (math.cosh(x_m) / x_m)) / z else: tmp = (y_m * (math.cosh(x_m) / z)) / x_m return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (y_m <= 7.5e-132) tmp = Float64(Float64(y_m * Float64(cosh(x_m) / x_m)) / z); else tmp = Float64(Float64(y_m * Float64(cosh(x_m) / z)) / x_m); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_s, x_m, y_m, z) tmp = 0.0; if (y_m <= 7.5e-132) tmp = (y_m * (cosh(x_m) / x_m)) / z; else tmp = (y_m * (cosh(x_m) / z)) / x_m; end tmp_2 = y_s * (x_s * tmp); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[y$95$m, 7.5e-132], N[(N[(y$95$m * N[(N[Cosh[x$95$m], $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y$95$m * N[(N[Cosh[x$95$m], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / x$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 7.5 \cdot 10^{-132}:\\
\;\;\;\;\frac{y\_m \cdot \frac{\cosh x\_m}{x\_m}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m \cdot \frac{\cosh x\_m}{z}}{x\_m}\\
\end{array}\right)
\end{array}
if y < 7.49999999999999989e-132Initial program 84.4%
associate-/l*75.4%
associate-/l/73.7%
Simplified73.7%
clear-num73.2%
un-div-inv73.2%
*-commutative73.2%
associate-/l*77.8%
Applied egg-rr77.8%
associate-*r/73.2%
associate-/r/81.7%
associate-/l/93.5%
*-commutative93.5%
associate-/l/81.7%
associate-/r*93.5%
Simplified93.5%
associate-*r/97.2%
Applied egg-rr97.2%
if 7.49999999999999989e-132 < y Initial program 94.8%
associate-/l*88.4%
associate-/l/81.8%
Simplified81.8%
associate-*r/85.7%
frac-times94.7%
*-commutative94.7%
associate-*l/99.8%
Applied egg-rr99.8%
Final simplification98.0%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= z 2.16e+77) (/ (/ y_m x_m) z) (/ y_m (* x_m z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 2.16e+77) {
tmp = (y_m / x_m) / z;
} else {
tmp = y_m / (x_m * z);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 2.16d+77) then
tmp = (y_m / x_m) / z
else
tmp = y_m / (x_m * z)
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 2.16e+77) {
tmp = (y_m / x_m) / z;
} else {
tmp = y_m / (x_m * z);
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if z <= 2.16e+77: tmp = (y_m / x_m) / z else: tmp = y_m / (x_m * z) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (z <= 2.16e+77) tmp = Float64(Float64(y_m / x_m) / z); else tmp = Float64(y_m / Float64(x_m * z)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_s, x_m, y_m, z) tmp = 0.0; if (z <= 2.16e+77) tmp = (y_m / x_m) / z; else tmp = y_m / (x_m * z); end tmp_2 = y_s * (x_s * tmp); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 2.16e+77], N[(N[(y$95$m / x$95$m), $MachinePrecision] / z), $MachinePrecision], N[(y$95$m / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 2.16 \cdot 10^{+77}:\\
\;\;\;\;\frac{\frac{y\_m}{x\_m}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{x\_m \cdot z}\\
\end{array}\right)
\end{array}
if z < 2.15999999999999992e77Initial program 87.9%
Taylor expanded in x around 0 51.2%
if 2.15999999999999992e77 < z Initial program 85.2%
associate-/l*67.3%
associate-/l/71.6%
Simplified71.6%
Taylor expanded in x around 0 59.6%
Final simplification52.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= y_m 2.4e-132) (/ (/ y_m x_m) z) (/ (/ y_m z) x_m)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 2.4e-132) {
tmp = (y_m / x_m) / z;
} else {
tmp = (y_m / z) / x_m;
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 2.4d-132) then
tmp = (y_m / x_m) / z
else
tmp = (y_m / z) / x_m
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 2.4e-132) {
tmp = (y_m / x_m) / z;
} else {
tmp = (y_m / z) / x_m;
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if y_m <= 2.4e-132: tmp = (y_m / x_m) / z else: tmp = (y_m / z) / x_m return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (y_m <= 2.4e-132) tmp = Float64(Float64(y_m / x_m) / z); else tmp = Float64(Float64(y_m / z) / x_m); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_s, x_m, y_m, z) tmp = 0.0; if (y_m <= 2.4e-132) tmp = (y_m / x_m) / z; else tmp = (y_m / z) / x_m; end tmp_2 = y_s * (x_s * tmp); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[y$95$m, 2.4e-132], N[(N[(y$95$m / x$95$m), $MachinePrecision] / z), $MachinePrecision], N[(N[(y$95$m / z), $MachinePrecision] / x$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 2.4 \cdot 10^{-132}:\\
\;\;\;\;\frac{\frac{y\_m}{x\_m}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x\_m}\\
\end{array}\right)
\end{array}
if y < 2.40000000000000015e-132Initial program 84.4%
Taylor expanded in x around 0 49.3%
if 2.40000000000000015e-132 < y Initial program 94.8%
associate-/l*88.4%
associate-/l/81.8%
Simplified81.8%
associate-*r/85.7%
frac-times94.7%
*-commutative94.7%
associate-*l/99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 61.1%
Final simplification52.9%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ y_m (* x_m z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (y_m / (x_m * z)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (x_s * (y_m / (x_m * z)))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (y_m / (x_m * z)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * (y_m / (x_m * z)))
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(y_m / Float64(x_m * z)))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp = code(y_s, x_s, x_m, y_m, z) tmp = y_s * (x_s * (y_m / (x_m * z))); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(y$95$m / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \frac{y\_m}{x\_m \cdot z}\right)
\end{array}
Initial program 87.5%
associate-/l*79.3%
associate-/l/76.2%
Simplified76.2%
Taylor expanded in x around 0 48.2%
Final simplification48.2%
(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 2024082
(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))