
(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 12 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 4.4e-45)
(/ (* y_m (/ (cosh x) x)) z)
(/ (/ (cosh x) (/ z y_m)) x))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 4.4e-45) {
tmp = (y_m * (cosh(x) / x)) / z;
} else {
tmp = (cosh(x) / (z / y_m)) / x;
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 4.4d-45) then
tmp = (y_m * (cosh(x) / x)) / z
else
tmp = (cosh(x) / (z / y_m)) / x
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 4.4e-45) {
tmp = (y_m * (Math.cosh(x) / x)) / z;
} else {
tmp = (Math.cosh(x) / (z / y_m)) / x;
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 4.4e-45: tmp = (y_m * (math.cosh(x) / x)) / z else: tmp = (math.cosh(x) / (z / y_m)) / x return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 4.4e-45) tmp = Float64(Float64(y_m * Float64(cosh(x) / x)) / z); else tmp = Float64(Float64(cosh(x) / Float64(z / y_m)) / x); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 4.4e-45) tmp = (y_m * (cosh(x) / x)) / z; else tmp = (cosh(x) / (z / y_m)) / x; end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 4.4e-45], N[(N[(y$95$m * N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[Cosh[x], $MachinePrecision] / N[(z / y$95$m), $MachinePrecision]), $MachinePrecision] / x), $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 4.4 \cdot 10^{-45}:\\
\;\;\;\;\frac{y_m \cdot \frac{\cosh x}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cosh x}{\frac{z}{y_m}}}{x}\\
\end{array}
\end{array}
if y < 4.39999999999999987e-45Initial program 78.8%
expm1-log1p-u41.1%
expm1-udef32.3%
Applied egg-rr32.3%
expm1-def41.1%
expm1-log1p78.8%
associate-*r/96.3%
associate-*l/96.3%
*-commutative96.3%
Simplified96.3%
if 4.39999999999999987e-45 < y Initial program 94.4%
associate-*l/94.4%
Simplified94.4%
associate-/r/89.9%
associate-/r/95.5%
associate-/r*99.9%
Applied egg-rr99.9%
Final simplification97.3%
y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= x 2.45e-213) (/ (/ y_m z) x) (* (/ (cosh x) z) (/ y_m x)))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 2.45e-213) {
tmp = (y_m / z) / x;
} else {
tmp = (cosh(x) / z) * (y_m / x);
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 2.45d-213) then
tmp = (y_m / z) / x
else
tmp = (cosh(x) / z) * (y_m / x)
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 2.45e-213) {
tmp = (y_m / z) / x;
} else {
tmp = (Math.cosh(x) / z) * (y_m / x);
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if x <= 2.45e-213: tmp = (y_m / z) / x else: tmp = (math.cosh(x) / z) * (y_m / x) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 2.45e-213) tmp = Float64(Float64(y_m / z) / x); else tmp = Float64(Float64(cosh(x) / z) * Float64(y_m / x)); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (x <= 2.45e-213) tmp = (y_m / z) / x; else tmp = (cosh(x) / z) * (y_m / x); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 2.45e-213], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 2.45 \cdot 10^{-213}:\\
\;\;\;\;\frac{\frac{y_m}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{z} \cdot \frac{y_m}{x}\\
\end{array}
\end{array}
if x < 2.4499999999999999e-213Initial program 79.5%
associate-*l/79.5%
Simplified79.5%
Taylor expanded in x around 0 49.0%
associate-*r/58.7%
associate-*l/58.7%
*-un-lft-identity58.7%
Applied egg-rr58.7%
if 2.4499999999999999e-213 < x Initial program 88.2%
associate-*l/88.1%
Simplified88.1%
Final simplification70.4%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= z 8.2e+34)
(/ (cosh x) (* x (/ z y_m)))
(* (/ (cosh x) z) (/ y_m x)))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 8.2e+34) {
tmp = cosh(x) / (x * (z / y_m));
} else {
tmp = (cosh(x) / z) * (y_m / x);
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 8.2d+34) then
tmp = cosh(x) / (x * (z / y_m))
else
tmp = (cosh(x) / z) * (y_m / x)
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 8.2e+34) {
tmp = Math.cosh(x) / (x * (z / y_m));
} else {
tmp = (Math.cosh(x) / z) * (y_m / x);
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if z <= 8.2e+34: tmp = math.cosh(x) / (x * (z / y_m)) else: tmp = (math.cosh(x) / z) * (y_m / x) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (z <= 8.2e+34) tmp = Float64(cosh(x) / Float64(x * Float64(z / y_m))); else tmp = Float64(Float64(cosh(x) / z) * Float64(y_m / x)); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (z <= 8.2e+34) tmp = cosh(x) / (x * (z / y_m)); else tmp = (cosh(x) / z) * (y_m / x); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[z, 8.2e+34], N[(N[Cosh[x], $MachinePrecision] / N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 8.2 \cdot 10^{+34}:\\
\;\;\;\;\frac{\cosh x}{x \cdot \frac{z}{y_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{z} \cdot \frac{y_m}{x}\\
\end{array}
\end{array}
if z < 8.1999999999999997e34Initial program 83.4%
associate-/l*79.9%
Simplified79.9%
associate-/r/84.9%
Applied egg-rr84.9%
if 8.1999999999999997e34 < z Initial program 81.2%
associate-*l/81.2%
Simplified81.2%
Final simplification84.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 9.5e+91)
(/ (* 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 <= 9.5e+91) {
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 <= 9.5d+91) 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 <= 9.5e+91) {
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 <= 9.5e+91: 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 <= 9.5e+91) 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 <= 9.5e+91) 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, 9.5e+91], 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 9.5 \cdot 10^{+91}:\\
\;\;\;\;\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 < 9.5000000000000001e91Initial program 81.4%
expm1-log1p-u42.4%
expm1-udef34.5%
Applied egg-rr34.5%
expm1-def42.4%
expm1-log1p81.4%
associate-*r/96.8%
associate-*l/96.8%
*-commutative96.8%
Simplified96.8%
if 9.5000000000000001e91 < y Initial program 91.1%
associate-/l*91.0%
Simplified91.0%
associate-/r/99.9%
Applied egg-rr99.9%
Final simplification97.3%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (/ (/ y_m z) x)))
(*
y_s
(if (<= x 7e-213)
t_0
(if (<= x 1.02e-126)
(/ (/ y_m x) z)
(if (<= x 0.0005)
t_0
(if (<= x 1.45e+147)
(* y_m (* 0.5 (/ x z)))
(* (* y_m x) (/ 0.5 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 = (y_m / z) / x;
double tmp;
if (x <= 7e-213) {
tmp = t_0;
} else if (x <= 1.02e-126) {
tmp = (y_m / x) / z;
} else if (x <= 0.0005) {
tmp = t_0;
} else if (x <= 1.45e+147) {
tmp = y_m * (0.5 * (x / z));
} else {
tmp = (y_m * x) * (0.5 / 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 = (y_m / z) / x
if (x <= 7d-213) then
tmp = t_0
else if (x <= 1.02d-126) then
tmp = (y_m / x) / z
else if (x <= 0.0005d0) then
tmp = t_0
else if (x <= 1.45d+147) then
tmp = y_m * (0.5d0 * (x / z))
else
tmp = (y_m * x) * (0.5d0 / 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 = (y_m / z) / x;
double tmp;
if (x <= 7e-213) {
tmp = t_0;
} else if (x <= 1.02e-126) {
tmp = (y_m / x) / z;
} else if (x <= 0.0005) {
tmp = t_0;
} else if (x <= 1.45e+147) {
tmp = y_m * (0.5 * (x / z));
} else {
tmp = (y_m * x) * (0.5 / 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 = (y_m / z) / x tmp = 0 if x <= 7e-213: tmp = t_0 elif x <= 1.02e-126: tmp = (y_m / x) / z elif x <= 0.0005: tmp = t_0 elif x <= 1.45e+147: tmp = y_m * (0.5 * (x / z)) else: tmp = (y_m * x) * (0.5 / 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(Float64(y_m / z) / x) tmp = 0.0 if (x <= 7e-213) tmp = t_0; elseif (x <= 1.02e-126) tmp = Float64(Float64(y_m / x) / z); elseif (x <= 0.0005) tmp = t_0; elseif (x <= 1.45e+147) tmp = Float64(y_m * Float64(0.5 * Float64(x / z))); else tmp = Float64(Float64(y_m * x) * Float64(0.5 / 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 = (y_m / z) / x; tmp = 0.0; if (x <= 7e-213) tmp = t_0; elseif (x <= 1.02e-126) tmp = (y_m / x) / z; elseif (x <= 0.0005) tmp = t_0; elseif (x <= 1.45e+147) tmp = y_m * (0.5 * (x / z)); else tmp = (y_m * x) * (0.5 / 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[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision]}, N[(y$95$s * If[LessEqual[x, 7e-213], t$95$0, If[LessEqual[x, 1.02e-126], N[(N[(y$95$m / x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[x, 0.0005], t$95$0, If[LessEqual[x, 1.45e+147], N[(y$95$m * N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m * x), $MachinePrecision] * N[(0.5 / z), $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{\frac{y_m}{z}}{x}\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{-213}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{-126}:\\
\;\;\;\;\frac{\frac{y_m}{x}}{z}\\
\mathbf{elif}\;x \leq 0.0005:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+147}:\\
\;\;\;\;y_m \cdot \left(0.5 \cdot \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y_m \cdot x\right) \cdot \frac{0.5}{z}\\
\end{array}
\end{array}
\end{array}
if x < 7.00000000000000034e-213 or 1.02000000000000004e-126 < x < 5.0000000000000001e-4Initial program 80.9%
associate-*l/80.9%
Simplified80.9%
Taylor expanded in x around 0 54.2%
associate-*r/63.8%
associate-*l/63.8%
*-un-lft-identity63.8%
Applied egg-rr63.8%
if 7.00000000000000034e-213 < x < 1.02000000000000004e-126Initial program 99.8%
Taylor expanded in x around 0 99.8%
if 5.0000000000000001e-4 < x < 1.4499999999999999e147Initial program 94.1%
Taylor expanded in x around 0 34.7%
Taylor expanded in x around inf 34.7%
associate-/l*29.0%
associate-*r/29.0%
Simplified29.0%
associate-/r/37.4%
*-un-lft-identity37.4%
times-frac37.4%
metadata-eval37.4%
Applied egg-rr37.4%
if 1.4499999999999999e147 < x Initial program 70.4%
Taylor expanded in x around 0 60.7%
Taylor expanded in x around inf 60.7%
associate-/l*39.7%
associate-*r/39.7%
Simplified39.7%
associate-/l*39.7%
associate-/r*60.7%
associate-/r/60.7%
*-commutative60.7%
Applied egg-rr60.7%
Final simplification62.7%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (/ (/ y_m z) x)))
(*
y_s
(if (<= x 7e-213)
t_0
(if (<= x 1.05e-125)
(/ (/ y_m x) z)
(if (<= x 0.0005)
t_0
(if (<= x 6.3e+146)
(* y_m (/ 0.5 (/ 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 t_0 = (y_m / z) / x;
double tmp;
if (x <= 7e-213) {
tmp = t_0;
} else if (x <= 1.05e-125) {
tmp = (y_m / x) / z;
} else if (x <= 0.0005) {
tmp = t_0;
} else if (x <= 6.3e+146) {
tmp = y_m * (0.5 / (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) :: t_0
real(8) :: tmp
t_0 = (y_m / z) / x
if (x <= 7d-213) then
tmp = t_0
else if (x <= 1.05d-125) then
tmp = (y_m / x) / z
else if (x <= 0.0005d0) then
tmp = t_0
else if (x <= 6.3d+146) then
tmp = y_m * (0.5d0 / (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 t_0 = (y_m / z) / x;
double tmp;
if (x <= 7e-213) {
tmp = t_0;
} else if (x <= 1.05e-125) {
tmp = (y_m / x) / z;
} else if (x <= 0.0005) {
tmp = t_0;
} else if (x <= 6.3e+146) {
tmp = y_m * (0.5 / (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): t_0 = (y_m / z) / x tmp = 0 if x <= 7e-213: tmp = t_0 elif x <= 1.05e-125: tmp = (y_m / x) / z elif x <= 0.0005: tmp = t_0 elif x <= 6.3e+146: tmp = y_m * (0.5 / (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) t_0 = Float64(Float64(y_m / z) / x) tmp = 0.0 if (x <= 7e-213) tmp = t_0; elseif (x <= 1.05e-125) tmp = Float64(Float64(y_m / x) / z); elseif (x <= 0.0005) tmp = t_0; elseif (x <= 6.3e+146) tmp = Float64(y_m * Float64(0.5 / Float64(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) t_0 = (y_m / z) / x; tmp = 0.0; if (x <= 7e-213) tmp = t_0; elseif (x <= 1.05e-125) tmp = (y_m / x) / z; elseif (x <= 0.0005) tmp = t_0; elseif (x <= 6.3e+146) tmp = y_m * (0.5 / (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_] := Block[{t$95$0 = N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision]}, N[(y$95$s * If[LessEqual[x, 7e-213], t$95$0, If[LessEqual[x, 1.05e-125], N[(N[(y$95$m / x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[x, 0.0005], t$95$0, If[LessEqual[x, 6.3e+146], N[(y$95$m * N[(0.5 / N[(z / x), $MachinePrecision]), $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)
\\
\begin{array}{l}
t_0 := \frac{\frac{y_m}{z}}{x}\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{-213}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-125}:\\
\;\;\;\;\frac{\frac{y_m}{x}}{z}\\
\mathbf{elif}\;x \leq 0.0005:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6.3 \cdot 10^{+146}:\\
\;\;\;\;y_m \cdot \frac{0.5}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \left(y_m \cdot x\right)}{z}\\
\end{array}
\end{array}
\end{array}
if x < 7.00000000000000034e-213 or 1.05e-125 < x < 5.0000000000000001e-4Initial program 80.9%
associate-*l/80.9%
Simplified80.9%
Taylor expanded in x around 0 54.2%
associate-*r/63.8%
associate-*l/63.8%
*-un-lft-identity63.8%
Applied egg-rr63.8%
if 7.00000000000000034e-213 < x < 1.05e-125Initial program 99.8%
Taylor expanded in x around 0 99.8%
if 5.0000000000000001e-4 < x < 6.3000000000000002e146Initial program 94.1%
Taylor expanded in x around 0 34.7%
Taylor expanded in x around inf 34.7%
associate-/l*29.0%
associate-*r/29.0%
Simplified29.0%
associate-/r/37.4%
*-un-lft-identity37.4%
times-frac37.4%
metadata-eval37.4%
Applied egg-rr37.4%
clear-num37.4%
un-div-inv37.4%
Applied egg-rr37.4%
if 6.3000000000000002e146 < x Initial program 70.4%
Taylor expanded in x around 0 60.7%
Taylor expanded in x around inf 60.7%
associate-*r/60.7%
*-commutative60.7%
Simplified60.7%
Final simplification62.7%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (/ (/ y_m z) x)))
(*
y_s
(if (<= x 6.8e-213)
t_0
(if (<= x 1.5e-133)
(/ (/ y_m x) z)
(if (<= x 0.0005) t_0 (* 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 t_0 = (y_m / z) / x;
double tmp;
if (x <= 6.8e-213) {
tmp = t_0;
} else if (x <= 1.5e-133) {
tmp = (y_m / x) / z;
} else if (x <= 0.0005) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = (y_m / z) / x
if (x <= 6.8d-213) then
tmp = t_0
else if (x <= 1.5d-133) then
tmp = (y_m / x) / z
else if (x <= 0.0005d0) then
tmp = t_0
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 t_0 = (y_m / z) / x;
double tmp;
if (x <= 6.8e-213) {
tmp = t_0;
} else if (x <= 1.5e-133) {
tmp = (y_m / x) / z;
} else if (x <= 0.0005) {
tmp = t_0;
} 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): t_0 = (y_m / z) / x tmp = 0 if x <= 6.8e-213: tmp = t_0 elif x <= 1.5e-133: tmp = (y_m / x) / z elif x <= 0.0005: tmp = t_0 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) t_0 = Float64(Float64(y_m / z) / x) tmp = 0.0 if (x <= 6.8e-213) tmp = t_0; elseif (x <= 1.5e-133) tmp = Float64(Float64(y_m / x) / z); elseif (x <= 0.0005) tmp = t_0; 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) t_0 = (y_m / z) / x; tmp = 0.0; if (x <= 6.8e-213) tmp = t_0; elseif (x <= 1.5e-133) tmp = (y_m / x) / z; elseif (x <= 0.0005) tmp = t_0; 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_] := Block[{t$95$0 = N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision]}, N[(y$95$s * If[LessEqual[x, 6.8e-213], t$95$0, If[LessEqual[x, 1.5e-133], N[(N[(y$95$m / x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[x, 0.0005], t$95$0, 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)
\\
\begin{array}{l}
t_0 := \frac{\frac{y_m}{z}}{x}\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 6.8 \cdot 10^{-213}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-133}:\\
\;\;\;\;\frac{\frac{y_m}{x}}{z}\\
\mathbf{elif}\;x \leq 0.0005:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;y_m \cdot \left(0.5 \cdot \frac{x}{z}\right)\\
\end{array}
\end{array}
\end{array}
if x < 6.8000000000000005e-213 or 1.5000000000000001e-133 < x < 5.0000000000000001e-4Initial program 80.9%
associate-*l/80.9%
Simplified80.9%
Taylor expanded in x around 0 54.2%
associate-*r/63.8%
associate-*l/63.8%
*-un-lft-identity63.8%
Applied egg-rr63.8%
if 6.8000000000000005e-213 < x < 1.5000000000000001e-133Initial program 99.8%
Taylor expanded in x around 0 99.8%
if 5.0000000000000001e-4 < x Initial program 83.6%
Taylor expanded in x around 0 46.2%
Taylor expanded in x around inf 46.2%
associate-/l*33.7%
associate-*r/33.7%
Simplified33.7%
associate-/r/41.6%
*-un-lft-identity41.6%
times-frac41.6%
metadata-eval41.6%
Applied egg-rr41.6%
Final simplification61.2%
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 4.8e-250)
(/ (- y_m) (/ z (+ (* x -0.5) (/ -1.0 x))))
(/ (+ (/ y_m 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 (y_m <= 4.8e-250) {
tmp = -y_m / (z / ((x * -0.5) + (-1.0 / x)));
} else {
tmp = ((y_m / x) + (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 <= 4.8d-250) then
tmp = -y_m / (z / ((x * (-0.5d0)) + ((-1.0d0) / x)))
else
tmp = ((y_m / x) + (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 <= 4.8e-250) {
tmp = -y_m / (z / ((x * -0.5) + (-1.0 / x)));
} else {
tmp = ((y_m / x) + (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 <= 4.8e-250: tmp = -y_m / (z / ((x * -0.5) + (-1.0 / x))) else: tmp = ((y_m / x) + (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 <= 4.8e-250) tmp = Float64(Float64(-y_m) / Float64(z / Float64(Float64(x * -0.5) + Float64(-1.0 / x)))); else tmp = Float64(Float64(Float64(y_m / x) + 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 (y_m <= 4.8e-250) tmp = -y_m / (z / ((x * -0.5) + (-1.0 / x))); else tmp = ((y_m / x) + (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, 4.8e-250], N[((-y$95$m) / N[(z / N[(N[(x * -0.5), $MachinePrecision] + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y$95$m / x), $MachinePrecision] + N[(0.5 * N[(y$95$m * x), $MachinePrecision]), $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}\;y_m \leq 4.8 \cdot 10^{-250}:\\
\;\;\;\;\frac{-y_m}{\frac{z}{x \cdot -0.5 + \frac{-1}{x}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y_m}{x} + 0.5 \cdot \left(y_m \cdot x\right)}{z}\\
\end{array}
\end{array}
if y < 4.7999999999999998e-250Initial program 75.8%
Taylor expanded in x around 0 63.5%
Taylor expanded in y around -inf 63.5%
mul-1-neg63.5%
associate-/l*63.6%
*-commutative63.6%
Simplified63.6%
if 4.7999999999999998e-250 < y Initial program 92.7%
Taylor expanded in x around 0 70.6%
Final simplification66.6%
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) (* 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) {
return y_s * (((y_m / x) + (0.5 * (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) + (0.5d0 * (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) + (0.5 * (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) + (0.5 * (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(Float64(Float64(y_m / x) + Float64(0.5 * Float64(y_m * 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) + (0.5 * (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[(N[(N[(y$95$m / x), $MachinePrecision] + N[(0.5 * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \frac{\frac{y_m}{x} + 0.5 \cdot \left(y_m \cdot x\right)}{z}
\end{array}
Initial program 82.9%
Taylor expanded in x around 0 66.5%
Final simplification66.5%
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 5e-20) (/ (/ 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 <= 5e-20) {
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 <= 5d-20) 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 <= 5e-20) {
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 <= 5e-20: 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 <= 5e-20) 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 <= 5e-20) 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, 5e-20], 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 5 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{y_m}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y_m}{x \cdot z}\\
\end{array}
\end{array}
if y < 4.9999999999999999e-20Initial program 79.5%
Taylor expanded in x around 0 48.8%
if 4.9999999999999999e-20 < y Initial program 93.9%
associate-*l/93.8%
Simplified93.8%
Taylor expanded in x around 0 45.3%
Final simplification48.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 1e-40) (/ (/ y_m x) z) (/ (/ y_m z) x))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1e-40) {
tmp = (y_m / x) / z;
} else {
tmp = (y_m / z) / x;
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 1d-40) then
tmp = (y_m / x) / z
else
tmp = (y_m / z) / x
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1e-40) {
tmp = (y_m / x) / z;
} else {
tmp = (y_m / z) / x;
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 1e-40: tmp = (y_m / x) / z else: tmp = (y_m / z) / x return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 1e-40) tmp = Float64(Float64(y_m / x) / z); else tmp = Float64(Float64(y_m / z) / x); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 1e-40) tmp = (y_m / x) / z; else tmp = (y_m / z) / x; end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1e-40], N[(N[(y$95$m / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(y$95$m / z), $MachinePrecision] / x), $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^{-40}:\\
\;\;\;\;\frac{\frac{y_m}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y_m}{z}}{x}\\
\end{array}
\end{array}
if y < 9.9999999999999993e-41Initial program 78.9%
Taylor expanded in x around 0 47.5%
if 9.9999999999999993e-41 < y Initial program 94.3%
associate-*l/94.3%
Simplified94.3%
Taylor expanded in x around 0 43.9%
associate-*r/60.7%
associate-*l/60.8%
*-un-lft-identity60.8%
Applied egg-rr60.8%
Final simplification50.9%
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 82.9%
associate-*l/82.9%
Simplified82.9%
Taylor expanded in x around 0 45.2%
Final simplification45.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ (/ y z) x) (cosh x))))
(if (< y -4.618902267687042e-52)
t_0
(if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) t_0))))
double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((y / z) / x) * cosh(x)
if (y < (-4.618902267687042d-52)) then
tmp = t_0
else if (y < 1.038530535935153d-39) then
tmp = ((cosh(x) * y) / x) / z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * Math.cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((Math.cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y / z) / x) * math.cosh(x) tmp = 0 if y < -4.618902267687042e-52: tmp = t_0 elif y < 1.038530535935153e-39: tmp = ((math.cosh(x) * y) / x) / z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y / z) / x) * cosh(x)) tmp = 0.0 if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = Float64(Float64(Float64(cosh(x) * y) / x) / z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y / z) / x) * cosh(x); tmp = 0.0; if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = ((cosh(x) * y) / x) / z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision]}, If[Less[y, -4.618902267687042e-52], t$95$0, If[Less[y, 1.038530535935153e-39], N[(N[(N[(N[Cosh[x], $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{z}}{x} \cdot \cosh x\\
\mathbf{if}\;y < -4.618902267687042 \cdot 10^{-52}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y < 1.038530535935153 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
herbie shell --seed 2024014
(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))