
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 1e+104)
(/ (* y_m (/ (cosh x) x)) z)
(/ (cosh x) (* x (/ z y_m))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1e+104) {
tmp = (y_m * (cosh(x) / x)) / z;
} else {
tmp = cosh(x) / (x * (z / y_m));
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 1d+104) then
tmp = (y_m * (cosh(x) / x)) / z
else
tmp = cosh(x) / (x * (z / y_m))
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1e+104) {
tmp = (y_m * (Math.cosh(x) / x)) / z;
} else {
tmp = Math.cosh(x) / (x * (z / y_m));
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 1e+104: tmp = (y_m * (math.cosh(x) / x)) / z else: tmp = math.cosh(x) / (x * (z / y_m)) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 1e+104) tmp = Float64(Float64(y_m * Float64(cosh(x) / x)) / z); else tmp = Float64(cosh(x) / Float64(x * Float64(z / y_m))); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 1e+104) tmp = (y_m * (cosh(x) / x)) / z; else tmp = cosh(x) / (x * (z / y_m)); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1e+104], N[(N[(y$95$m * N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[Cosh[x], $MachinePrecision] / N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 10^{+104}:\\
\;\;\;\;\frac{y_m \cdot \frac{\cosh x}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x \cdot \frac{z}{y_m}}\\
\end{array}
\end{array}
if y < 1e104Initial program 85.1%
expm1-log1p-u50.0%
expm1-udef38.8%
Applied egg-rr38.8%
expm1-def50.0%
expm1-log1p85.1%
associate-*r/97.6%
associate-*l/97.5%
*-commutative97.5%
Simplified97.5%
if 1e104 < y Initial program 88.0%
associate-/l*88.0%
Simplified88.0%
associate-/r/99.8%
Applied egg-rr99.8%
Final simplification98.0%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 1.2e+190)
(* (/ (cosh x) z) (/ y_m x))
(+ (* 0.5 (/ (* y_m x) z)) (/ y_m (* x z))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.2e+190) {
tmp = (cosh(x) / z) * (y_m / x);
} else {
tmp = (0.5 * ((y_m * x) / z)) + (y_m / (x * z));
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 1.2d+190) then
tmp = (cosh(x) / z) * (y_m / x)
else
tmp = (0.5d0 * ((y_m * x) / z)) + (y_m / (x * z))
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.2e+190) {
tmp = (Math.cosh(x) / z) * (y_m / x);
} else {
tmp = (0.5 * ((y_m * x) / z)) + (y_m / (x * z));
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 1.2e+190: tmp = (math.cosh(x) / z) * (y_m / x) else: tmp = (0.5 * ((y_m * x) / z)) + (y_m / (x * z)) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 1.2e+190) tmp = Float64(Float64(cosh(x) / z) * Float64(y_m / x)); else tmp = Float64(Float64(0.5 * Float64(Float64(y_m * x) / z)) + Float64(y_m / Float64(x * z))); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 1.2e+190) tmp = (cosh(x) / z) * (y_m / x); else tmp = (0.5 * ((y_m * x) / z)) + (y_m / (x * z)); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1.2e+190], N[(N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(N[(y$95$m * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + N[(y$95$m / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 1.2 \cdot 10^{+190}:\\
\;\;\;\;\frac{\cosh x}{z} \cdot \frac{y_m}{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y_m \cdot x}{z} + \frac{y_m}{x \cdot z}\\
\end{array}
\end{array}
if y < 1.1999999999999999e190Initial program 85.4%
associate-*l/85.3%
Simplified85.3%
if 1.1999999999999999e190 < y Initial program 88.4%
associate-*l/88.4%
Simplified88.4%
Taylor expanded in x around 0 99.9%
Final simplification86.8%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 1.18e+104)
(* (/ (cosh x) z) (/ y_m x))
(/ (cosh x) (* x (/ z y_m))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.18e+104) {
tmp = (cosh(x) / z) * (y_m / x);
} else {
tmp = cosh(x) / (x * (z / y_m));
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 1.18d+104) then
tmp = (cosh(x) / z) * (y_m / x)
else
tmp = cosh(x) / (x * (z / y_m))
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.18e+104) {
tmp = (Math.cosh(x) / z) * (y_m / x);
} else {
tmp = Math.cosh(x) / (x * (z / y_m));
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 1.18e+104: tmp = (math.cosh(x) / z) * (y_m / x) else: tmp = math.cosh(x) / (x * (z / y_m)) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 1.18e+104) tmp = Float64(Float64(cosh(x) / z) * Float64(y_m / x)); else tmp = Float64(cosh(x) / Float64(x * Float64(z / y_m))); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 1.18e+104) tmp = (cosh(x) / z) * (y_m / x); else tmp = cosh(x) / (x * (z / y_m)); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1.18e+104], N[(N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision], N[(N[Cosh[x], $MachinePrecision] / N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 1.18 \cdot 10^{+104}:\\
\;\;\;\;\frac{\cosh x}{z} \cdot \frac{y_m}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x \cdot \frac{z}{y_m}}\\
\end{array}
\end{array}
if y < 1.18e104Initial program 85.1%
associate-*l/85.1%
Simplified85.1%
if 1.18e104 < y Initial program 88.0%
associate-/l*88.0%
Simplified88.0%
associate-/r/99.8%
Applied egg-rr99.8%
Final simplification87.8%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (/ z (* y_m x))))
(*
y_s
(if (<= x 6.6e-9)
(/ (/ y_m z) x)
(/ (+ (* (/ y_m x) t_0) (* z 0.5)) (* z t_0))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = z / (y_m * x);
double tmp;
if (x <= 6.6e-9) {
tmp = (y_m / z) / x;
} else {
tmp = (((y_m / x) * t_0) + (z * 0.5)) / (z * t_0);
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z / (y_m * x)
if (x <= 6.6d-9) then
tmp = (y_m / z) / x
else
tmp = (((y_m / x) * t_0) + (z * 0.5d0)) / (z * t_0)
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double t_0 = z / (y_m * x);
double tmp;
if (x <= 6.6e-9) {
tmp = (y_m / z) / x;
} else {
tmp = (((y_m / x) * t_0) + (z * 0.5)) / (z * t_0);
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): t_0 = z / (y_m * x) tmp = 0 if x <= 6.6e-9: tmp = (y_m / z) / x else: tmp = (((y_m / x) * t_0) + (z * 0.5)) / (z * t_0) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = Float64(z / Float64(y_m * x)) tmp = 0.0 if (x <= 6.6e-9) tmp = Float64(Float64(y_m / z) / x); else tmp = Float64(Float64(Float64(Float64(y_m / x) * t_0) + Float64(z * 0.5)) / Float64(z * t_0)); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) t_0 = z / (y_m * x); tmp = 0.0; if (x <= 6.6e-9) tmp = (y_m / z) / x; else tmp = (((y_m / x) * t_0) + (z * 0.5)) / (z * t_0); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(z / N[(y$95$m * x), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[x, 6.6e-9], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(y$95$m / x), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(z * 0.5), $MachinePrecision]), $MachinePrecision] / N[(z * t$95$0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{z}{y_m \cdot x}\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 6.6 \cdot 10^{-9}:\\
\;\;\;\;\frac{\frac{y_m}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y_m}{x} \cdot t_0 + z \cdot 0.5}{z \cdot t_0}\\
\end{array}
\end{array}
\end{array}
if x < 6.60000000000000037e-9Initial program 87.5%
associate-*l/87.4%
Simplified87.4%
Taylor expanded in x around 0 62.2%
*-un-lft-identity62.2%
times-frac68.3%
Applied egg-rr68.3%
associate-*l/68.3%
*-un-lft-identity68.3%
Applied egg-rr68.3%
if 6.60000000000000037e-9 < x Initial program 80.6%
associate-*l/80.6%
Simplified80.6%
Taylor expanded in x around 0 41.0%
clear-num41.0%
un-div-inv41.0%
*-commutative41.0%
associate-/r*36.7%
Applied egg-rr36.7%
associate-/l/36.7%
clear-num36.7%
associate-/r*36.7%
+-commutative36.7%
associate-/r*36.7%
clear-num36.7%
associate-/l/36.7%
associate-/r*36.7%
frac-add41.9%
associate-/l/42.1%
*-commutative42.1%
associate-/l/46.4%
*-commutative46.4%
Applied egg-rr46.4%
Final simplification62.6%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 1.5e+180)
(/ (+ (/ y_m x) (* 0.5 (* y_m x))) z)
(+ (/ y_m (* x z)) (* 0.5 (* y_m (/ x z)))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.5e+180) {
tmp = ((y_m / x) + (0.5 * (y_m * x))) / z;
} else {
tmp = (y_m / (x * z)) + (0.5 * (y_m * (x / z)));
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 1.5d+180) then
tmp = ((y_m / x) + (0.5d0 * (y_m * x))) / z
else
tmp = (y_m / (x * z)) + (0.5d0 * (y_m * (x / z)))
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.5e+180) {
tmp = ((y_m / x) + (0.5 * (y_m * x))) / z;
} else {
tmp = (y_m / (x * z)) + (0.5 * (y_m * (x / z)));
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 1.5e+180: tmp = ((y_m / x) + (0.5 * (y_m * x))) / z else: tmp = (y_m / (x * z)) + (0.5 * (y_m * (x / z))) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 1.5e+180) tmp = Float64(Float64(Float64(y_m / x) + Float64(0.5 * Float64(y_m * x))) / z); else tmp = Float64(Float64(y_m / Float64(x * z)) + Float64(0.5 * Float64(y_m * Float64(x / z)))); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 1.5e+180) tmp = ((y_m / x) + (0.5 * (y_m * x))) / z; else tmp = (y_m / (x * z)) + (0.5 * (y_m * (x / z))); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1.5e+180], N[(N[(N[(y$95$m / x), $MachinePrecision] + N[(0.5 * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y$95$m / N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(y$95$m * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 1.5 \cdot 10^{+180}:\\
\;\;\;\;\frac{\frac{y_m}{x} + 0.5 \cdot \left(y_m \cdot x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y_m}{x \cdot z} + 0.5 \cdot \left(y_m \cdot \frac{x}{z}\right)\\
\end{array}
\end{array}
if y < 1.50000000000000001e180Initial program 85.4%
Taylor expanded in x around 0 65.2%
if 1.50000000000000001e180 < y Initial program 87.6%
associate-*l/87.6%
Simplified87.6%
Taylor expanded in x around 0 93.7%
associate-/l*90.7%
associate-/r/90.7%
Applied egg-rr90.7%
Final simplification68.3%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= z 2.15e-38)
(/ (+ (/ y_m x) (* 0.5 (* y_m x))) z)
(+ (* 0.5 (/ (* y_m x) z)) (/ y_m (* x z))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 2.15e-38) {
tmp = ((y_m / x) + (0.5 * (y_m * x))) / z;
} else {
tmp = (0.5 * ((y_m * x) / z)) + (y_m / (x * z));
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 2.15d-38) then
tmp = ((y_m / x) + (0.5d0 * (y_m * x))) / z
else
tmp = (0.5d0 * ((y_m * x) / z)) + (y_m / (x * z))
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 2.15e-38) {
tmp = ((y_m / x) + (0.5 * (y_m * x))) / z;
} else {
tmp = (0.5 * ((y_m * x) / z)) + (y_m / (x * z));
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if z <= 2.15e-38: tmp = ((y_m / x) + (0.5 * (y_m * x))) / z else: tmp = (0.5 * ((y_m * x) / z)) + (y_m / (x * z)) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (z <= 2.15e-38) tmp = Float64(Float64(Float64(y_m / x) + Float64(0.5 * Float64(y_m * x))) / z); else tmp = Float64(Float64(0.5 * Float64(Float64(y_m * x) / z)) + Float64(y_m / Float64(x * z))); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (z <= 2.15e-38) tmp = ((y_m / x) + (0.5 * (y_m * x))) / z; else tmp = (0.5 * ((y_m * x) / z)) + (y_m / (x * z)); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[z, 2.15e-38], N[(N[(N[(y$95$m / x), $MachinePrecision] + N[(0.5 * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(0.5 * N[(N[(y$95$m * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + N[(y$95$m / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 2.15 \cdot 10^{-38}:\\
\;\;\;\;\frac{\frac{y_m}{x} + 0.5 \cdot \left(y_m \cdot x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y_m \cdot x}{z} + \frac{y_m}{x \cdot z}\\
\end{array}
\end{array}
if z < 2.1500000000000001e-38Initial program 87.9%
Taylor expanded in x around 0 75.6%
if 2.1500000000000001e-38 < z Initial program 79.3%
associate-*l/79.2%
Simplified79.2%
Taylor expanded in x around 0 52.8%
Final simplification69.7%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= z 7.8e+210)
(/ (* y_m (+ (* x 0.5) (/ 1.0 x))) z)
(if (<= z 1.55e+299) (/ y_m (* x z)) (/ (* 0.5 (* y_m x)) z)))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 7.8e+210) {
tmp = (y_m * ((x * 0.5) + (1.0 / x))) / z;
} else if (z <= 1.55e+299) {
tmp = y_m / (x * z);
} else {
tmp = (0.5 * (y_m * x)) / z;
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 7.8d+210) then
tmp = (y_m * ((x * 0.5d0) + (1.0d0 / x))) / z
else if (z <= 1.55d+299) then
tmp = y_m / (x * z)
else
tmp = (0.5d0 * (y_m * x)) / z
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 7.8e+210) {
tmp = (y_m * ((x * 0.5) + (1.0 / x))) / z;
} else if (z <= 1.55e+299) {
tmp = y_m / (x * z);
} else {
tmp = (0.5 * (y_m * x)) / z;
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if z <= 7.8e+210: tmp = (y_m * ((x * 0.5) + (1.0 / x))) / z elif z <= 1.55e+299: tmp = y_m / (x * z) else: tmp = (0.5 * (y_m * x)) / z return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (z <= 7.8e+210) tmp = Float64(Float64(y_m * Float64(Float64(x * 0.5) + Float64(1.0 / x))) / z); elseif (z <= 1.55e+299) tmp = Float64(y_m / Float64(x * z)); else tmp = Float64(Float64(0.5 * Float64(y_m * x)) / z); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (z <= 7.8e+210) tmp = (y_m * ((x * 0.5) + (1.0 / x))) / z; elseif (z <= 1.55e+299) tmp = y_m / (x * z); else tmp = (0.5 * (y_m * x)) / z; end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[z, 7.8e+210], N[(N[(y$95$m * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.55e+299], N[(y$95$m / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 7.8 \cdot 10^{+210}:\\
\;\;\;\;\frac{y_m \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z}\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+299}:\\
\;\;\;\;\frac{y_m}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \left(y_m \cdot x\right)}{z}\\
\end{array}
\end{array}
if z < 7.8e210Initial program 88.0%
expm1-log1p-u50.7%
expm1-udef40.6%
Applied egg-rr40.6%
expm1-def50.7%
expm1-log1p88.0%
associate-*r/97.5%
associate-*l/97.4%
*-commutative97.4%
Simplified97.4%
Taylor expanded in x around 0 71.0%
if 7.8e210 < z < 1.55e299Initial program 58.2%
associate-*l/58.2%
Simplified58.2%
Taylor expanded in x around 0 48.2%
if 1.55e299 < z Initial program 100.0%
Taylor expanded in x around 0 51.3%
Taylor expanded in x around inf 51.3%
*-commutative51.3%
Simplified51.3%
Final simplification69.0%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (* 0.5 (* y_m x))))
(*
y_s
(if (<= z 3.5e+211)
(/ (+ (/ y_m x) t_0) z)
(if (<= z 1.8e+299) (/ y_m (* x z)) (/ t_0 z))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = 0.5 * (y_m * x);
double tmp;
if (z <= 3.5e+211) {
tmp = ((y_m / x) + t_0) / z;
} else if (z <= 1.8e+299) {
tmp = y_m / (x * z);
} else {
tmp = t_0 / z;
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (y_m * x)
if (z <= 3.5d+211) then
tmp = ((y_m / x) + t_0) / z
else if (z <= 1.8d+299) then
tmp = y_m / (x * z)
else
tmp = t_0 / z
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double t_0 = 0.5 * (y_m * x);
double tmp;
if (z <= 3.5e+211) {
tmp = ((y_m / x) + t_0) / z;
} else if (z <= 1.8e+299) {
tmp = y_m / (x * z);
} else {
tmp = t_0 / z;
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): t_0 = 0.5 * (y_m * x) tmp = 0 if z <= 3.5e+211: tmp = ((y_m / x) + t_0) / z elif z <= 1.8e+299: tmp = y_m / (x * z) else: tmp = t_0 / z return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = Float64(0.5 * Float64(y_m * x)) tmp = 0.0 if (z <= 3.5e+211) tmp = Float64(Float64(Float64(y_m / x) + t_0) / z); elseif (z <= 1.8e+299) tmp = Float64(y_m / Float64(x * z)); else tmp = Float64(t_0 / z); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) t_0 = 0.5 * (y_m * x); tmp = 0.0; if (z <= 3.5e+211) tmp = ((y_m / x) + t_0) / z; elseif (z <= 1.8e+299) tmp = y_m / (x * z); else tmp = t_0 / z; end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(0.5 * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[z, 3.5e+211], N[(N[(N[(y$95$m / x), $MachinePrecision] + t$95$0), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.8e+299], N[(y$95$m / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / z), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(y_m \cdot x\right)\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 3.5 \cdot 10^{+211}:\\
\;\;\;\;\frac{\frac{y_m}{x} + t_0}{z}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+299}:\\
\;\;\;\;\frac{y_m}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{z}\\
\end{array}
\end{array}
\end{array}
if z < 3.49999999999999996e211Initial program 88.0%
Taylor expanded in x around 0 71.0%
if 3.49999999999999996e211 < z < 1.80000000000000002e299Initial program 58.2%
associate-*l/58.2%
Simplified58.2%
Taylor expanded in x around 0 48.2%
if 1.80000000000000002e299 < z Initial program 100.0%
Taylor expanded in x around 0 51.3%
Taylor expanded in x around inf 51.3%
*-commutative51.3%
Simplified51.3%
Final simplification69.0%
y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= x 1.45) (/ (/ y_m z) x) (* y_m (* 0.5 (/ x z))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.45) {
tmp = (y_m / z) / x;
} else {
tmp = y_m * (0.5 * (x / z));
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 1.45d0) then
tmp = (y_m / z) / x
else
tmp = y_m * (0.5d0 * (x / z))
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.45) {
tmp = (y_m / z) / x;
} else {
tmp = y_m * (0.5 * (x / z));
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if x <= 1.45: tmp = (y_m / z) / x else: tmp = y_m * (0.5 * (x / z)) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 1.45) tmp = Float64(Float64(y_m / z) / x); else tmp = Float64(y_m * Float64(0.5 * Float64(x / z))); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (x <= 1.45) tmp = (y_m / z) / x; else tmp = y_m * (0.5 * (x / z)); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 1.45], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], N[(y$95$m * N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.45:\\
\;\;\;\;\frac{\frac{y_m}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;y_m \cdot \left(0.5 \cdot \frac{x}{z}\right)\\
\end{array}
\end{array}
if x < 1.44999999999999996Initial program 87.6%
associate-*l/87.6%
Simplified87.6%
Taylor expanded in x around 0 62.5%
*-un-lft-identity62.5%
times-frac68.4%
Applied egg-rr68.4%
associate-*l/68.5%
*-un-lft-identity68.5%
Applied egg-rr68.5%
if 1.44999999999999996 < x Initial program 80.0%
expm1-log1p-u38.5%
expm1-udef37.0%
Applied egg-rr37.0%
expm1-def38.5%
expm1-log1p80.0%
associate-*r/100.0%
associate-*l/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 39.2%
Taylor expanded in x around inf 39.2%
associate-*l/37.7%
associate-*l*37.7%
*-commutative37.7%
Simplified37.7%
Final simplification60.7%
y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= x 1.45) (/ (/ y_m z) x) (/ (* 0.5 (* y_m x)) z))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.45) {
tmp = (y_m / z) / x;
} else {
tmp = (0.5 * (y_m * x)) / z;
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 1.45d0) then
tmp = (y_m / z) / x
else
tmp = (0.5d0 * (y_m * x)) / z
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.45) {
tmp = (y_m / z) / x;
} else {
tmp = (0.5 * (y_m * x)) / z;
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if x <= 1.45: tmp = (y_m / z) / x else: tmp = (0.5 * (y_m * x)) / z return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 1.45) tmp = Float64(Float64(y_m / z) / x); else tmp = Float64(Float64(0.5 * Float64(y_m * x)) / z); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (x <= 1.45) tmp = (y_m / z) / x; else tmp = (0.5 * (y_m * x)) / z; end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 1.45], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], N[(N[(0.5 * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.45:\\
\;\;\;\;\frac{\frac{y_m}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \left(y_m \cdot x\right)}{z}\\
\end{array}
\end{array}
if x < 1.44999999999999996Initial program 87.6%
associate-*l/87.6%
Simplified87.6%
Taylor expanded in x around 0 62.5%
*-un-lft-identity62.5%
times-frac68.4%
Applied egg-rr68.4%
associate-*l/68.5%
*-un-lft-identity68.5%
Applied egg-rr68.5%
if 1.44999999999999996 < x Initial program 80.0%
Taylor expanded in x around 0 39.2%
Taylor expanded in x around inf 39.2%
*-commutative39.2%
Simplified39.2%
Final simplification61.1%
y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= y_m 1e+29) (/ (/ y_m x) z) (/ y_m (* x z)))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1e+29) {
tmp = (y_m / x) / z;
} else {
tmp = y_m / (x * z);
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 1d+29) then
tmp = (y_m / x) / z
else
tmp = y_m / (x * z)
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1e+29) {
tmp = (y_m / x) / z;
} else {
tmp = y_m / (x * z);
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 1e+29: tmp = (y_m / x) / z else: tmp = y_m / (x * z) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 1e+29) tmp = Float64(Float64(y_m / x) / z); else tmp = Float64(y_m / Float64(x * z)); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 1e+29) tmp = (y_m / x) / z; else tmp = y_m / (x * z); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1e+29], N[(N[(y$95$m / x), $MachinePrecision] / z), $MachinePrecision], N[(y$95$m / N[(x * z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 10^{+29}:\\
\;\;\;\;\frac{\frac{y_m}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y_m}{x \cdot z}\\
\end{array}
\end{array}
if y < 9.99999999999999914e28Initial program 83.7%
Taylor expanded in x around 0 50.0%
if 9.99999999999999914e28 < y Initial program 90.7%
associate-*l/90.6%
Simplified90.6%
Taylor expanded in x around 0 56.7%
Final simplification51.9%
y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= z 2e-25) (/ (/ y_m z) x) (/ y_m (* x z)))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 2e-25) {
tmp = (y_m / z) / x;
} else {
tmp = y_m / (x * z);
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 2d-25) then
tmp = (y_m / z) / x
else
tmp = y_m / (x * z)
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 2e-25) {
tmp = (y_m / z) / x;
} else {
tmp = y_m / (x * z);
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if z <= 2e-25: tmp = (y_m / z) / x else: tmp = y_m / (x * z) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (z <= 2e-25) tmp = Float64(Float64(y_m / z) / x); else tmp = Float64(y_m / Float64(x * z)); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (z <= 2e-25) tmp = (y_m / z) / x; else tmp = y_m / (x * z); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[z, 2e-25], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], N[(y$95$m / N[(x * z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{-25}:\\
\;\;\;\;\frac{\frac{y_m}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y_m}{x \cdot z}\\
\end{array}
\end{array}
if z < 2.00000000000000008e-25Initial program 88.1%
associate-*l/88.1%
Simplified88.1%
Taylor expanded in x around 0 49.3%
*-un-lft-identity49.3%
times-frac58.1%
Applied egg-rr58.1%
associate-*l/58.2%
*-un-lft-identity58.2%
Applied egg-rr58.2%
if 2.00000000000000008e-25 < z Initial program 78.0%
associate-*l/77.9%
Simplified77.9%
Taylor expanded in x around 0 47.2%
Final simplification55.5%
y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (/ y_m (* x z))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
return y_s * (y_m / (x * z));
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (y_m / (x * z))
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
return y_s * (y_m / (x * z));
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): return y_s * (y_m / (x * z))
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) return Float64(y_s * Float64(y_m / Float64(x * z))) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m, z) tmp = y_s * (y_m / (x * z)); end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(y$95$m / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \frac{y_m}{x \cdot z}
\end{array}
Initial program 85.7%
associate-*l/85.6%
Simplified85.6%
Taylor expanded in x around 0 48.8%
Final simplification48.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ (/ y z) x) (cosh x))))
(if (< y -4.618902267687042e-52)
t_0
(if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) t_0))))
double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((y / z) / x) * cosh(x)
if (y < (-4.618902267687042d-52)) then
tmp = t_0
else if (y < 1.038530535935153d-39) then
tmp = ((cosh(x) * y) / x) / z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * Math.cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((Math.cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y / z) / x) * math.cosh(x) tmp = 0 if y < -4.618902267687042e-52: tmp = t_0 elif y < 1.038530535935153e-39: tmp = ((math.cosh(x) * y) / x) / z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y / z) / x) * cosh(x)) tmp = 0.0 if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = Float64(Float64(Float64(cosh(x) * y) / x) / z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y / z) / x) * cosh(x); tmp = 0.0; if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = ((cosh(x) * y) / x) / z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision]}, If[Less[y, -4.618902267687042e-52], t$95$0, If[Less[y, 1.038530535935153e-39], N[(N[(N[(N[Cosh[x], $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{z}}{x} \cdot \cosh x\\
\mathbf{if}\;y < -4.618902267687042 \cdot 10^{-52}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y < 1.038530535935153 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
herbie shell --seed 2023332
(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))