
(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}
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 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 2e+177) (/ t_0 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 t_0 = cosh(x_m) * (y_m / x_m);
double tmp;
if (t_0 <= 2e+177) {
tmp = t_0 / 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) :: t_0
real(8) :: tmp
t_0 = cosh(x_m) * (y_m / x_m)
if (t_0 <= 2d+177) then
tmp = t_0 / 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 t_0 = Math.cosh(x_m) * (y_m / x_m);
double tmp;
if (t_0 <= 2e+177) {
tmp = t_0 / 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): t_0 = math.cosh(x_m) * (y_m / x_m) tmp = 0 if t_0 <= 2e+177: tmp = t_0 / 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) t_0 = Float64(cosh(x_m) * Float64(y_m / x_m)) tmp = 0.0 if (t_0 <= 2e+177) tmp = Float64(t_0 / 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) t_0 = cosh(x_m) * (y_m / x_m); tmp = 0.0; if (t_0 <= 2e+177) tmp = t_0 / 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_] := 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, 2e+177], N[(t$95$0 / 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)
\\
\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 2 \cdot 10^{+177}:\\
\;\;\;\;\frac{t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m \cdot \frac{\cosh x\_m}{z}}{x\_m}\\
\end{array}\right)
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 2e177Initial program 95.5%
if 2e177 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 67.5%
associate-/l*61.9%
associate-/l/67.2%
Simplified67.2%
associate-*r/74.7%
frac-times67.5%
*-commutative67.5%
associate-*l/100.0%
Applied egg-rr100.0%
Final simplification97.3%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(let* ((t_0 (/ y_m (* x_m z))))
(*
y_s
(*
x_s
(if (<= y_m 2.15e-122)
(* (cosh x_m) t_0)
(if (<= y_m 6.5e+202)
(* (/ y_m x_m) (/ (cosh x_m) z))
(+ t_0 (* 0.5 (/ (* x_m y_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 = y_m / (x_m * z);
double tmp;
if (y_m <= 2.15e-122) {
tmp = cosh(x_m) * t_0;
} else if (y_m <= 6.5e+202) {
tmp = (y_m / x_m) * (cosh(x_m) / z);
} else {
tmp = t_0 + (0.5 * ((x_m * y_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 = y_m / (x_m * z)
if (y_m <= 2.15d-122) then
tmp = cosh(x_m) * t_0
else if (y_m <= 6.5d+202) then
tmp = (y_m / x_m) * (cosh(x_m) / z)
else
tmp = t_0 + (0.5d0 * ((x_m * y_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 = y_m / (x_m * z);
double tmp;
if (y_m <= 2.15e-122) {
tmp = Math.cosh(x_m) * t_0;
} else if (y_m <= 6.5e+202) {
tmp = (y_m / x_m) * (Math.cosh(x_m) / z);
} else {
tmp = t_0 + (0.5 * ((x_m * y_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 = y_m / (x_m * z) tmp = 0 if y_m <= 2.15e-122: tmp = math.cosh(x_m) * t_0 elif y_m <= 6.5e+202: tmp = (y_m / x_m) * (math.cosh(x_m) / z) else: tmp = t_0 + (0.5 * ((x_m * y_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(y_m / Float64(x_m * z)) tmp = 0.0 if (y_m <= 2.15e-122) tmp = Float64(cosh(x_m) * t_0); elseif (y_m <= 6.5e+202) tmp = Float64(Float64(y_m / x_m) * Float64(cosh(x_m) / z)); else tmp = Float64(t_0 + Float64(0.5 * Float64(Float64(x_m * y_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 = y_m / (x_m * z); tmp = 0.0; if (y_m <= 2.15e-122) tmp = cosh(x_m) * t_0; elseif (y_m <= 6.5e+202) tmp = (y_m / x_m) * (cosh(x_m) / z); else tmp = t_0 + (0.5 * ((x_m * y_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[(y$95$m / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[y$95$m, 2.15e-122], N[(N[Cosh[x$95$m], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[y$95$m, 6.5e+202], N[(N[(y$95$m / x$95$m), $MachinePrecision] * N[(N[Cosh[x$95$m], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(0.5 * N[(N[(x$95$m * y$95$m), $MachinePrecision] / z), $MachinePrecision]), $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{y\_m}{x\_m \cdot z}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 2.15 \cdot 10^{-122}:\\
\;\;\;\;\cosh x\_m \cdot t\_0\\
\mathbf{elif}\;y\_m \leq 6.5 \cdot 10^{+202}:\\
\;\;\;\;\frac{y\_m}{x\_m} \cdot \frac{\cosh x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + 0.5 \cdot \frac{x\_m \cdot y\_m}{z}\\
\end{array}\right)
\end{array}
\end{array}
if y < 2.15000000000000009e-122Initial program 78.4%
associate-/l*74.0%
associate-/l/75.7%
Simplified75.7%
if 2.15000000000000009e-122 < y < 6.4999999999999996e202Initial program 93.2%
*-commutative93.2%
associate-/l*93.3%
Simplified93.3%
if 6.4999999999999996e202 < y Initial program 91.4%
associate-/l*91.4%
associate-/l/77.3%
Simplified77.3%
Taylor expanded in x around 0 100.0%
Final simplification82.9%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(let* ((t_0 (/ y_m (* x_m z))))
(*
y_s
(*
x_s
(if (<= y_m 6.5e+180)
(* (cosh x_m) t_0)
(+ t_0 (* 0.5 (/ (* x_m y_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 = y_m / (x_m * z);
double tmp;
if (y_m <= 6.5e+180) {
tmp = cosh(x_m) * t_0;
} else {
tmp = t_0 + (0.5 * ((x_m * y_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 = y_m / (x_m * z)
if (y_m <= 6.5d+180) then
tmp = cosh(x_m) * t_0
else
tmp = t_0 + (0.5d0 * ((x_m * y_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 = y_m / (x_m * z);
double tmp;
if (y_m <= 6.5e+180) {
tmp = Math.cosh(x_m) * t_0;
} else {
tmp = t_0 + (0.5 * ((x_m * y_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 = y_m / (x_m * z) tmp = 0 if y_m <= 6.5e+180: tmp = math.cosh(x_m) * t_0 else: tmp = t_0 + (0.5 * ((x_m * y_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(y_m / Float64(x_m * z)) tmp = 0.0 if (y_m <= 6.5e+180) tmp = Float64(cosh(x_m) * t_0); else tmp = Float64(t_0 + Float64(0.5 * Float64(Float64(x_m * y_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 = y_m / (x_m * z); tmp = 0.0; if (y_m <= 6.5e+180) tmp = cosh(x_m) * t_0; else tmp = t_0 + (0.5 * ((x_m * y_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[(y$95$m / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[y$95$m, 6.5e+180], N[(N[Cosh[x$95$m], $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$0 + N[(0.5 * N[(N[(x$95$m * y$95$m), $MachinePrecision] / z), $MachinePrecision]), $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{y\_m}{x\_m \cdot z}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 6.5 \cdot 10^{+180}:\\
\;\;\;\;\cosh x\_m \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 + 0.5 \cdot \frac{x\_m \cdot y\_m}{z}\\
\end{array}\right)
\end{array}
\end{array}
if y < 6.5e180Initial program 82.5%
associate-/l*75.0%
associate-/l/76.7%
Simplified76.7%
if 6.5e180 < y Initial program 93.4%
associate-/l*93.4%
associate-/l/75.8%
Simplified75.8%
Taylor expanded in x around 0 96.5%
Final simplification79.0%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= z 5e-42)
(/ (cosh x_m) (* x_m (/ z y_m)))
(* (/ y_m x_m) (/ (cosh 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 <= 5e-42) {
tmp = cosh(x_m) / (x_m * (z / y_m));
} else {
tmp = (y_m / x_m) * (cosh(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 <= 5d-42) then
tmp = cosh(x_m) / (x_m * (z / y_m))
else
tmp = (y_m / x_m) * (cosh(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 <= 5e-42) {
tmp = Math.cosh(x_m) / (x_m * (z / y_m));
} else {
tmp = (y_m / x_m) * (Math.cosh(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 <= 5e-42: tmp = math.cosh(x_m) / (x_m * (z / y_m)) else: tmp = (y_m / x_m) * (math.cosh(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 <= 5e-42) tmp = Float64(cosh(x_m) / Float64(x_m * Float64(z / y_m))); else tmp = Float64(Float64(y_m / x_m) * Float64(cosh(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 <= 5e-42) tmp = cosh(x_m) / (x_m * (z / y_m)); else tmp = (y_m / x_m) * (cosh(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, 5e-42], N[(N[Cosh[x$95$m], $MachinePrecision] / N[(x$95$m * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m / x$95$m), $MachinePrecision] * N[(N[Cosh[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 5 \cdot 10^{-42}:\\
\;\;\;\;\frac{\cosh x\_m}{x\_m \cdot \frac{z}{y\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{x\_m} \cdot \frac{\cosh x\_m}{z}\\
\end{array}\right)
\end{array}
if z < 5.00000000000000003e-42Initial program 85.8%
associate-/l*80.2%
associate-/l/82.7%
Simplified82.7%
clear-num81.7%
un-div-inv81.7%
*-commutative81.7%
associate-/l*85.2%
Applied egg-rr85.2%
if 5.00000000000000003e-42 < z Initial program 79.0%
*-commutative79.0%
associate-/l*78.9%
Simplified78.9%
Final simplification83.3%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= x_m 1.7e-99) (/ y_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 (x_m <= 1.7e-99) {
tmp = y_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 (x_m <= 1.7d-99) then
tmp = y_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 (x_m <= 1.7e-99) {
tmp = y_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 x_m <= 1.7e-99: tmp = y_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 (x_m <= 1.7e-99) tmp = Float64(y_m / Float64(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 (x_m <= 1.7e-99) tmp = y_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[x$95$m, 1.7e-99], N[(y$95$m / N[(x$95$m * z), $MachinePrecision]), $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}\;x\_m \leq 1.7 \cdot 10^{-99}:\\
\;\;\;\;\frac{y\_m}{x\_m \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m \cdot \frac{\cosh x\_m}{z}}{x\_m}\\
\end{array}\right)
\end{array}
if x < 1.70000000000000003e-99Initial program 87.4%
associate-/l*82.6%
associate-/l/80.6%
Simplified80.6%
Taylor expanded in x around 0 58.3%
if 1.70000000000000003e-99 < x Initial program 77.2%
associate-/l*67.4%
associate-/l/69.6%
Simplified69.6%
associate-*r/76.1%
frac-times77.2%
*-commutative77.2%
associate-*l/99.9%
Applied egg-rr99.9%
Final simplification73.3%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(let* ((t_0 (/ (/ z x_m) (* y_m 0.5))))
(*
y_s
(*
x_s
(if (<= z 1.4e-71)
(/ (+ z (* (/ y_m x_m) t_0)) (* z t_0))
(if (<= z 1e+52)
(/ (+ y_m (* x_m (* x_m (* y_m 0.5)))) (* x_m z))
(+ (/ y_m (* x_m z)) (* 0.5 (/ (* x_m y_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 = (z / x_m) / (y_m * 0.5);
double tmp;
if (z <= 1.4e-71) {
tmp = (z + ((y_m / x_m) * t_0)) / (z * t_0);
} else if (z <= 1e+52) {
tmp = (y_m + (x_m * (x_m * (y_m * 0.5)))) / (x_m * z);
} else {
tmp = (y_m / (x_m * z)) + (0.5 * ((x_m * y_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 = (z / x_m) / (y_m * 0.5d0)
if (z <= 1.4d-71) then
tmp = (z + ((y_m / x_m) * t_0)) / (z * t_0)
else if (z <= 1d+52) then
tmp = (y_m + (x_m * (x_m * (y_m * 0.5d0)))) / (x_m * z)
else
tmp = (y_m / (x_m * z)) + (0.5d0 * ((x_m * y_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 = (z / x_m) / (y_m * 0.5);
double tmp;
if (z <= 1.4e-71) {
tmp = (z + ((y_m / x_m) * t_0)) / (z * t_0);
} else if (z <= 1e+52) {
tmp = (y_m + (x_m * (x_m * (y_m * 0.5)))) / (x_m * z);
} else {
tmp = (y_m / (x_m * z)) + (0.5 * ((x_m * y_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 = (z / x_m) / (y_m * 0.5) tmp = 0 if z <= 1.4e-71: tmp = (z + ((y_m / x_m) * t_0)) / (z * t_0) elif z <= 1e+52: tmp = (y_m + (x_m * (x_m * (y_m * 0.5)))) / (x_m * z) else: tmp = (y_m / (x_m * z)) + (0.5 * ((x_m * y_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(Float64(z / x_m) / Float64(y_m * 0.5)) tmp = 0.0 if (z <= 1.4e-71) tmp = Float64(Float64(z + Float64(Float64(y_m / x_m) * t_0)) / Float64(z * t_0)); elseif (z <= 1e+52) tmp = Float64(Float64(y_m + Float64(x_m * Float64(x_m * Float64(y_m * 0.5)))) / Float64(x_m * z)); else tmp = Float64(Float64(y_m / Float64(x_m * z)) + Float64(0.5 * Float64(Float64(x_m * y_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 = (z / x_m) / (y_m * 0.5); tmp = 0.0; if (z <= 1.4e-71) tmp = (z + ((y_m / x_m) * t_0)) / (z * t_0); elseif (z <= 1e+52) tmp = (y_m + (x_m * (x_m * (y_m * 0.5)))) / (x_m * z); else tmp = (y_m / (x_m * z)) + (0.5 * ((x_m * y_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[(z / x$95$m), $MachinePrecision] / N[(y$95$m * 0.5), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[z, 1.4e-71], N[(N[(z + N[(N[(y$95$m / x$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(z * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e+52], N[(N[(y$95$m + N[(x$95$m * N[(x$95$m * N[(y$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(x$95$m * y$95$m), $MachinePrecision] / z), $MachinePrecision]), $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{\frac{z}{x\_m}}{y\_m \cdot 0.5}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1.4 \cdot 10^{-71}:\\
\;\;\;\;\frac{z + \frac{y\_m}{x\_m} \cdot t\_0}{z \cdot t\_0}\\
\mathbf{elif}\;z \leq 10^{+52}:\\
\;\;\;\;\frac{y\_m + x\_m \cdot \left(x\_m \cdot \left(y\_m \cdot 0.5\right)\right)}{x\_m \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{x\_m \cdot z} + 0.5 \cdot \frac{x\_m \cdot y\_m}{z}\\
\end{array}\right)
\end{array}
\end{array}
if z < 1.4e-71Initial program 86.5%
associate-/l*80.6%
associate-/l/83.3%
Simplified83.3%
Taylor expanded in x around 0 70.8%
associate-*r/70.8%
clear-num70.8%
associate-*r*70.8%
*-commutative70.8%
associate-*r*70.8%
*-commutative70.8%
Applied egg-rr70.8%
associate-/r*71.1%
frac-add57.5%
*-un-lft-identity57.5%
associate-/r*57.6%
associate-/r*58.2%
Applied egg-rr58.2%
if 1.4e-71 < z < 9.9999999999999999e51Initial program 82.1%
associate-/l*78.6%
associate-/l/76.8%
Simplified76.8%
Taylor expanded in x around 0 57.4%
+-commutative57.4%
associate-/l/62.7%
associate-*r/62.7%
frac-add63.5%
associate-*r*63.5%
*-commutative63.5%
associate-*r*63.5%
*-commutative63.5%
Applied egg-rr63.5%
Taylor expanded in y around 0 63.5%
if 9.9999999999999999e51 < z Initial program 76.7%
associate-/l*66.5%
associate-/l/57.5%
Simplified57.5%
Taylor expanded in x around 0 53.9%
Final simplification57.8%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(let* ((t_0 (/ y_m (* x_m z))))
(*
y_s
(*
x_s
(if (<= z 4e-103)
(+ t_0 (* y_m (/ 0.5 (/ z x_m))))
(if (<= z 1.65e+44)
(/ (+ y_m (* x_m (* x_m (* y_m 0.5)))) (* x_m z))
(+ t_0 (* 0.5 (/ (* x_m y_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 = y_m / (x_m * z);
double tmp;
if (z <= 4e-103) {
tmp = t_0 + (y_m * (0.5 / (z / x_m)));
} else if (z <= 1.65e+44) {
tmp = (y_m + (x_m * (x_m * (y_m * 0.5)))) / (x_m * z);
} else {
tmp = t_0 + (0.5 * ((x_m * y_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 = y_m / (x_m * z)
if (z <= 4d-103) then
tmp = t_0 + (y_m * (0.5d0 / (z / x_m)))
else if (z <= 1.65d+44) then
tmp = (y_m + (x_m * (x_m * (y_m * 0.5d0)))) / (x_m * z)
else
tmp = t_0 + (0.5d0 * ((x_m * y_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 = y_m / (x_m * z);
double tmp;
if (z <= 4e-103) {
tmp = t_0 + (y_m * (0.5 / (z / x_m)));
} else if (z <= 1.65e+44) {
tmp = (y_m + (x_m * (x_m * (y_m * 0.5)))) / (x_m * z);
} else {
tmp = t_0 + (0.5 * ((x_m * y_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 = y_m / (x_m * z) tmp = 0 if z <= 4e-103: tmp = t_0 + (y_m * (0.5 / (z / x_m))) elif z <= 1.65e+44: tmp = (y_m + (x_m * (x_m * (y_m * 0.5)))) / (x_m * z) else: tmp = t_0 + (0.5 * ((x_m * y_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(y_m / Float64(x_m * z)) tmp = 0.0 if (z <= 4e-103) tmp = Float64(t_0 + Float64(y_m * Float64(0.5 / Float64(z / x_m)))); elseif (z <= 1.65e+44) tmp = Float64(Float64(y_m + Float64(x_m * Float64(x_m * Float64(y_m * 0.5)))) / Float64(x_m * z)); else tmp = Float64(t_0 + Float64(0.5 * Float64(Float64(x_m * y_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 = y_m / (x_m * z); tmp = 0.0; if (z <= 4e-103) tmp = t_0 + (y_m * (0.5 / (z / x_m))); elseif (z <= 1.65e+44) tmp = (y_m + (x_m * (x_m * (y_m * 0.5)))) / (x_m * z); else tmp = t_0 + (0.5 * ((x_m * y_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[(y$95$m / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[z, 4e-103], N[(t$95$0 + N[(y$95$m * N[(0.5 / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.65e+44], N[(N[(y$95$m + N[(x$95$m * N[(x$95$m * N[(y$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(0.5 * N[(N[(x$95$m * y$95$m), $MachinePrecision] / z), $MachinePrecision]), $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{y\_m}{x\_m \cdot z}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 4 \cdot 10^{-103}:\\
\;\;\;\;t\_0 + y\_m \cdot \frac{0.5}{\frac{z}{x\_m}}\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+44}:\\
\;\;\;\;\frac{y\_m + x\_m \cdot \left(x\_m \cdot \left(y\_m \cdot 0.5\right)\right)}{x\_m \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + 0.5 \cdot \frac{x\_m \cdot y\_m}{z}\\
\end{array}\right)
\end{array}
\end{array}
if z < 3.99999999999999983e-103Initial program 86.9%
associate-/l*80.9%
associate-/l/83.0%
Simplified83.0%
Taylor expanded in x around 0 70.9%
associate-*r/70.9%
clear-num70.9%
associate-*r*70.9%
*-commutative70.9%
associate-*r*70.9%
*-commutative70.9%
Applied egg-rr70.9%
clear-num70.9%
*-commutative70.9%
associate-*r/71.9%
associate-*l*71.9%
clear-num71.9%
un-div-inv71.9%
Applied egg-rr71.9%
if 3.99999999999999983e-103 < z < 1.65000000000000007e44Initial program 80.6%
associate-/l*77.4%
associate-/l/79.0%
Simplified79.0%
Taylor expanded in x around 0 58.4%
+-commutative58.4%
associate-/l/63.2%
associate-*r/63.2%
frac-add63.9%
associate-*r*63.9%
*-commutative63.9%
associate-*r*63.9%
*-commutative63.9%
Applied egg-rr63.9%
Taylor expanded in y around 0 63.9%
if 1.65000000000000007e44 < z Initial program 76.7%
associate-/l*66.5%
associate-/l/57.5%
Simplified57.5%
Taylor expanded in x around 0 53.9%
Final simplification66.8%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= y_m 4.8e-71)
(/ (+ (/ y_m x_m) (* 0.5 (* x_m y_m))) z)
(+ (/ y_m (* x_m z)) (* 0.5 (/ (* x_m y_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 (y_m <= 4.8e-71) {
tmp = ((y_m / x_m) + (0.5 * (x_m * y_m))) / z;
} else {
tmp = (y_m / (x_m * z)) + (0.5 * ((x_m * y_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 (y_m <= 4.8d-71) then
tmp = ((y_m / x_m) + (0.5d0 * (x_m * y_m))) / z
else
tmp = (y_m / (x_m * z)) + (0.5d0 * ((x_m * y_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 (y_m <= 4.8e-71) {
tmp = ((y_m / x_m) + (0.5 * (x_m * y_m))) / z;
} else {
tmp = (y_m / (x_m * z)) + (0.5 * ((x_m * y_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 y_m <= 4.8e-71: tmp = ((y_m / x_m) + (0.5 * (x_m * y_m))) / z else: tmp = (y_m / (x_m * z)) + (0.5 * ((x_m * y_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 (y_m <= 4.8e-71) tmp = Float64(Float64(Float64(y_m / x_m) + Float64(0.5 * Float64(x_m * y_m))) / z); else tmp = Float64(Float64(y_m / Float64(x_m * z)) + Float64(0.5 * Float64(Float64(x_m * y_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 (y_m <= 4.8e-71) tmp = ((y_m / x_m) + (0.5 * (x_m * y_m))) / z; else tmp = (y_m / (x_m * z)) + (0.5 * ((x_m * y_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[y$95$m, 4.8e-71], N[(N[(N[(y$95$m / x$95$m), $MachinePrecision] + N[(0.5 * N[(x$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y$95$m / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(x$95$m * y$95$m), $MachinePrecision] / z), $MachinePrecision]), $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}\;y\_m \leq 4.8 \cdot 10^{-71}:\\
\;\;\;\;\frac{\frac{y\_m}{x\_m} + 0.5 \cdot \left(x\_m \cdot y\_m\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{x\_m \cdot z} + 0.5 \cdot \frac{x\_m \cdot y\_m}{z}\\
\end{array}\right)
\end{array}
if y < 4.8e-71Initial program 78.9%
Taylor expanded in x around 0 59.7%
if 4.8e-71 < y Initial program 94.1%
associate-/l*86.7%
associate-/l/82.8%
Simplified82.8%
Taylor expanded in x around 0 79.1%
Final simplification65.9%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= x_m 3.7e-178)
(/ y_m (* x_m z))
(/ (* y_m (+ (* x_m 0.5) (/ 1.0 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 <= 3.7e-178) {
tmp = y_m / (x_m * z);
} else {
tmp = (y_m * ((x_m * 0.5) + (1.0 / 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 <= 3.7d-178) then
tmp = y_m / (x_m * z)
else
tmp = (y_m * ((x_m * 0.5d0) + (1.0d0 / 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 <= 3.7e-178) {
tmp = y_m / (x_m * z);
} else {
tmp = (y_m * ((x_m * 0.5) + (1.0 / 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 <= 3.7e-178: tmp = y_m / (x_m * z) else: tmp = (y_m * ((x_m * 0.5) + (1.0 / 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 <= 3.7e-178) tmp = Float64(y_m / Float64(x_m * z)); else tmp = Float64(Float64(y_m * Float64(Float64(x_m * 0.5) + Float64(1.0 / 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 <= 3.7e-178) tmp = y_m / (x_m * z); else tmp = (y_m * ((x_m * 0.5) + (1.0 / 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, 3.7e-178], N[(y$95$m / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m * N[(N[(x$95$m * 0.5), $MachinePrecision] + N[(1.0 / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $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 3.7 \cdot 10^{-178}:\\
\;\;\;\;\frac{y\_m}{x\_m \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m \cdot \left(x\_m \cdot 0.5 + \frac{1}{x\_m}\right)}{z}\\
\end{array}\right)
\end{array}
if x < 3.70000000000000004e-178Initial program 86.3%
associate-/l*81.0%
associate-/l/79.4%
Simplified79.4%
Taylor expanded in x around 0 55.1%
if 3.70000000000000004e-178 < x Initial program 80.2%
Taylor expanded in x around 0 60.1%
Taylor expanded in y around 0 60.1%
Final simplification57.2%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= x_m 5.2e-180)
(/ y_m (* x_m z))
(/ (+ (/ y_m x_m) (* 0.5 (* x_m y_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 <= 5.2e-180) {
tmp = y_m / (x_m * z);
} else {
tmp = ((y_m / x_m) + (0.5 * (x_m * y_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 <= 5.2d-180) then
tmp = y_m / (x_m * z)
else
tmp = ((y_m / x_m) + (0.5d0 * (x_m * y_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 <= 5.2e-180) {
tmp = y_m / (x_m * z);
} else {
tmp = ((y_m / x_m) + (0.5 * (x_m * y_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 <= 5.2e-180: tmp = y_m / (x_m * z) else: tmp = ((y_m / x_m) + (0.5 * (x_m * y_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 <= 5.2e-180) tmp = Float64(y_m / Float64(x_m * z)); else tmp = Float64(Float64(Float64(y_m / x_m) + Float64(0.5 * Float64(x_m * y_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 <= 5.2e-180) tmp = y_m / (x_m * z); else tmp = ((y_m / x_m) + (0.5 * (x_m * y_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, 5.2e-180], N[(y$95$m / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y$95$m / x$95$m), $MachinePrecision] + N[(0.5 * N[(x$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $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 5.2 \cdot 10^{-180}:\\
\;\;\;\;\frac{y\_m}{x\_m \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y\_m}{x\_m} + 0.5 \cdot \left(x\_m \cdot y\_m\right)}{z}\\
\end{array}\right)
\end{array}
if x < 5.1999999999999998e-180Initial program 86.3%
associate-/l*81.0%
associate-/l/79.4%
Simplified79.4%
Taylor expanded in x around 0 55.1%
if 5.1999999999999998e-180 < x Initial program 80.2%
Taylor expanded in x around 0 60.1%
Final simplification57.2%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= x_m 0.001) (/ y_m (* x_m z)) (* x_m (* 0.5 (/ y_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 <= 0.001) {
tmp = y_m / (x_m * z);
} else {
tmp = x_m * (0.5 * (y_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 <= 0.001d0) then
tmp = y_m / (x_m * z)
else
tmp = x_m * (0.5d0 * (y_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 <= 0.001) {
tmp = y_m / (x_m * z);
} else {
tmp = x_m * (0.5 * (y_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 <= 0.001: tmp = y_m / (x_m * z) else: tmp = x_m * (0.5 * (y_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 <= 0.001) tmp = Float64(y_m / Float64(x_m * z)); else tmp = Float64(x_m * Float64(0.5 * Float64(y_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 <= 0.001) tmp = y_m / (x_m * z); else tmp = x_m * (0.5 * (y_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, 0.001], N[(y$95$m / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(0.5 * N[(y$95$m / z), $MachinePrecision]), $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 0.001:\\
\;\;\;\;\frac{y\_m}{x\_m \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(0.5 \cdot \frac{y\_m}{z}\right)\\
\end{array}\right)
\end{array}
if x < 1e-3Initial program 88.2%
associate-/l*83.9%
associate-/l/81.5%
Simplified81.5%
Taylor expanded in x around 0 61.6%
if 1e-3 < x Initial program 72.6%
Taylor expanded in x around 0 43.4%
Taylor expanded in x around inf 43.4%
*-commutative43.4%
associate-/l*34.3%
associate-*l*34.3%
Simplified34.3%
Final simplification53.8%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= x_m 0.001) (/ y_m (* x_m z)) (* y_m (* x_m (/ 0.5 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 <= 0.001) {
tmp = y_m / (x_m * z);
} else {
tmp = y_m * (x_m * (0.5 / 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 <= 0.001d0) then
tmp = y_m / (x_m * z)
else
tmp = y_m * (x_m * (0.5d0 / 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 <= 0.001) {
tmp = y_m / (x_m * z);
} else {
tmp = y_m * (x_m * (0.5 / 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 <= 0.001: tmp = y_m / (x_m * z) else: tmp = y_m * (x_m * (0.5 / 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 <= 0.001) tmp = Float64(y_m / Float64(x_m * z)); else tmp = Float64(y_m * Float64(x_m * Float64(0.5 / 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 <= 0.001) tmp = y_m / (x_m * z); else tmp = y_m * (x_m * (0.5 / 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, 0.001], N[(y$95$m / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(x$95$m * N[(0.5 / z), $MachinePrecision]), $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 0.001:\\
\;\;\;\;\frac{y\_m}{x\_m \cdot z}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(x\_m \cdot \frac{0.5}{z}\right)\\
\end{array}\right)
\end{array}
if x < 1e-3Initial program 88.2%
associate-/l*83.9%
associate-/l/81.5%
Simplified81.5%
Taylor expanded in x around 0 61.6%
if 1e-3 < x Initial program 72.6%
Taylor expanded in x around 0 43.4%
Taylor expanded in x around inf 43.4%
associate-*r*43.4%
*-commutative43.4%
Simplified43.4%
associate-/l*40.8%
*-commutative40.8%
*-commutative40.8%
associate-/l*40.8%
Applied egg-rr40.8%
Final simplification55.6%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= x_m 0.001) (/ y_m (* x_m z)) (/ (* y_m (* x_m 0.5)) 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 <= 0.001) {
tmp = y_m / (x_m * z);
} else {
tmp = (y_m * (x_m * 0.5)) / 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 <= 0.001d0) then
tmp = y_m / (x_m * z)
else
tmp = (y_m * (x_m * 0.5d0)) / 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 <= 0.001) {
tmp = y_m / (x_m * z);
} else {
tmp = (y_m * (x_m * 0.5)) / 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 <= 0.001: tmp = y_m / (x_m * z) else: tmp = (y_m * (x_m * 0.5)) / 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 <= 0.001) tmp = Float64(y_m / Float64(x_m * z)); else tmp = Float64(Float64(y_m * Float64(x_m * 0.5)) / 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 <= 0.001) tmp = y_m / (x_m * z); else tmp = (y_m * (x_m * 0.5)) / 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, 0.001], N[(y$95$m / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m * N[(x$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / z), $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 0.001:\\
\;\;\;\;\frac{y\_m}{x\_m \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m \cdot \left(x\_m \cdot 0.5\right)}{z}\\
\end{array}\right)
\end{array}
if x < 1e-3Initial program 88.2%
associate-/l*83.9%
associate-/l/81.5%
Simplified81.5%
Taylor expanded in x around 0 61.6%
if 1e-3 < x Initial program 72.6%
Taylor expanded in x around 0 43.4%
Taylor expanded in x around inf 43.4%
associate-*r*43.4%
*-commutative43.4%
Simplified43.4%
Final simplification56.4%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= y_m 4.8e-71) (/ (/ 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 (y_m <= 4.8e-71) {
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 (y_m <= 4.8d-71) 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 (y_m <= 4.8e-71) {
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 y_m <= 4.8e-71: 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 (y_m <= 4.8e-71) 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 (y_m <= 4.8e-71) 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[y$95$m, 4.8e-71], 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}\;y\_m \leq 4.8 \cdot 10^{-71}:\\
\;\;\;\;\frac{\frac{y\_m}{x\_m}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{x\_m \cdot z}\\
\end{array}\right)
\end{array}
if y < 4.8e-71Initial program 78.9%
Taylor expanded in x around 0 48.0%
if 4.8e-71 < y Initial program 94.1%
associate-/l*86.7%
associate-/l/82.8%
Simplified82.8%
Taylor expanded in x around 0 45.1%
Final simplification47.1%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= y_m 400000000.0) (/ (/ 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 <= 400000000.0) {
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 <= 400000000.0d0) 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 <= 400000000.0) {
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 <= 400000000.0: 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 <= 400000000.0) 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 <= 400000000.0) 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, 400000000.0], 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 400000000:\\
\;\;\;\;\frac{\frac{y\_m}{x\_m}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x\_m}\\
\end{array}\right)
\end{array}
if y < 4e8Initial program 80.1%
Taylor expanded in x around 0 47.1%
if 4e8 < y Initial program 94.2%
associate-/l*88.2%
associate-/l/81.7%
Simplified81.7%
associate-*r/81.7%
frac-times94.2%
*-commutative94.2%
associate-*l/100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 52.7%
Final simplification48.5%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 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 83.8%
associate-/l*77.1%
associate-/l/76.6%
Simplified76.6%
Taylor expanded in x around 0 46.6%
Final simplification46.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ (/ y z) x) (cosh x))))
(if (< y -4.618902267687042e-52)
t_0
(if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) t_0))))
double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((y / z) / x) * cosh(x)
if (y < (-4.618902267687042d-52)) then
tmp = t_0
else if (y < 1.038530535935153d-39) then
tmp = ((cosh(x) * y) / x) / z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * Math.cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((Math.cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y / z) / x) * math.cosh(x) tmp = 0 if y < -4.618902267687042e-52: tmp = t_0 elif y < 1.038530535935153e-39: tmp = ((math.cosh(x) * y) / x) / z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y / z) / x) * cosh(x)) tmp = 0.0 if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = Float64(Float64(Float64(cosh(x) * y) / x) / z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y / z) / x) * cosh(x); tmp = 0.0; if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = ((cosh(x) * y) / x) / z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision]}, If[Less[y, -4.618902267687042e-52], t$95$0, If[Less[y, 1.038530535935153e-39], N[(N[(N[(N[Cosh[x], $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{z}}{x} \cdot \cosh x\\
\mathbf{if}\;y < -4.618902267687042 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y < 1.038530535935153 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
herbie shell --seed 2024044
(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))