
(FPCore (x y z) :precision binary64 (/ (* x (/ (sin y) y)) z))
double code(double x, double y, double z) {
return (x * (sin(y) / y)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * (sin(y) / y)) / z
end function
public static double code(double x, double y, double z) {
return (x * (Math.sin(y) / y)) / z;
}
def code(x, y, z): return (x * (math.sin(y) / y)) / z
function code(x, y, z) return Float64(Float64(x * Float64(sin(y) / y)) / z) end
function tmp = code(x, y, z) tmp = (x * (sin(y) / y)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{\sin y}{y}}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (/ (sin y) y)) z))
double code(double x, double y, double z) {
return (x * (sin(y) / y)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * (sin(y) / y)) / z
end function
public static double code(double x, double y, double z) {
return (x * (Math.sin(y) / y)) / z;
}
def code(x, y, z): return (x * (math.sin(y) / y)) / z
function code(x, y, z) return Float64(Float64(x * Float64(sin(y) / y)) / z) end
function tmp = code(x, y, z) tmp = (x * (sin(y) / y)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{\sin y}{y}}{z}
\end{array}
z\_m = (fabs.f64 z) z\_s = (copysign.f64 #s(literal 1 binary64) z) (FPCore (z_s x y z_m) :precision binary64 (let* ((t_0 (/ (sin y) y))) (* z_s (if (<= z_m 2e-116) (* (/ t_0 z_m) x) (/ (* t_0 x) z_m)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double t_0 = sin(y) / y;
double tmp;
if (z_m <= 2e-116) {
tmp = (t_0 / z_m) * x;
} else {
tmp = (t_0 * x) / z_m;
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: t_0
real(8) :: tmp
t_0 = sin(y) / y
if (z_m <= 2d-116) then
tmp = (t_0 / z_m) * x
else
tmp = (t_0 * x) / z_m
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double t_0 = Math.sin(y) / y;
double tmp;
if (z_m <= 2e-116) {
tmp = (t_0 / z_m) * x;
} else {
tmp = (t_0 * x) / z_m;
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): t_0 = math.sin(y) / y tmp = 0 if z_m <= 2e-116: tmp = (t_0 / z_m) * x else: tmp = (t_0 * x) / z_m return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m) t_0 = Float64(sin(y) / y) tmp = 0.0 if (z_m <= 2e-116) tmp = Float64(Float64(t_0 / z_m) * x); else tmp = Float64(Float64(t_0 * x) / z_m); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) t_0 = sin(y) / y; tmp = 0.0; if (z_m <= 2e-116) tmp = (t_0 / z_m) * x; else tmp = (t_0 * x) / z_m; end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, N[(z$95$s * If[LessEqual[z$95$m, 2e-116], N[(N[(t$95$0 / z$95$m), $MachinePrecision] * x), $MachinePrecision], N[(N[(t$95$0 * x), $MachinePrecision] / z$95$m), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 2 \cdot 10^{-116}:\\
\;\;\;\;\frac{t\_0}{z\_m} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot x}{z\_m}\\
\end{array}
\end{array}
\end{array}
if z < 2e-116Initial program 93.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-/l/N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
*-commutativeN/A
*-lowering-*.f6488.4
Applied egg-rr88.4%
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f6496.5
Applied egg-rr96.5%
if 2e-116 < z Initial program 99.8%
Final simplification97.5%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
:precision binary64
(let* ((t_0 (/ (sin y) y)))
(*
z_s
(if (<= (* t_0 x) -2e-188)
(* (/ (sin y) z_m) (/ x y))
(* (/ t_0 z_m) x)))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double t_0 = sin(y) / y;
double tmp;
if ((t_0 * x) <= -2e-188) {
tmp = (sin(y) / z_m) * (x / y);
} else {
tmp = (t_0 / z_m) * x;
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: t_0
real(8) :: tmp
t_0 = sin(y) / y
if ((t_0 * x) <= (-2d-188)) then
tmp = (sin(y) / z_m) * (x / y)
else
tmp = (t_0 / z_m) * x
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double t_0 = Math.sin(y) / y;
double tmp;
if ((t_0 * x) <= -2e-188) {
tmp = (Math.sin(y) / z_m) * (x / y);
} else {
tmp = (t_0 / z_m) * x;
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): t_0 = math.sin(y) / y tmp = 0 if (t_0 * x) <= -2e-188: tmp = (math.sin(y) / z_m) * (x / y) else: tmp = (t_0 / z_m) * x return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m) t_0 = Float64(sin(y) / y) tmp = 0.0 if (Float64(t_0 * x) <= -2e-188) tmp = Float64(Float64(sin(y) / z_m) * Float64(x / y)); else tmp = Float64(Float64(t_0 / z_m) * x); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) t_0 = sin(y) / y; tmp = 0.0; if ((t_0 * x) <= -2e-188) tmp = (sin(y) / z_m) * (x / y); else tmp = (t_0 / z_m) * x; end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, N[(z$95$s * If[LessEqual[N[(t$95$0 * x), $MachinePrecision], -2e-188], N[(N[(N[Sin[y], $MachinePrecision] / z$95$m), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / z$95$m), $MachinePrecision] * x), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \cdot x \leq -2 \cdot 10^{-188}:\\
\;\;\;\;\frac{\sin y}{z\_m} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{z\_m} \cdot x\\
\end{array}
\end{array}
\end{array}
if (*.f64 x (/.f64 (sin.f64 y) y)) < -1.9999999999999999e-188Initial program 99.7%
*-commutativeN/A
div-invN/A
associate-*l*N/A
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f6487.5
Applied egg-rr87.5%
if -1.9999999999999999e-188 < (*.f64 x (/.f64 (sin.f64 y) y)) Initial program 92.4%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-/l/N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
*-commutativeN/A
*-lowering-*.f6491.6
Applied egg-rr91.6%
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f6496.7
Applied egg-rr96.7%
Final simplification93.4%
z\_m = (fabs.f64 z) z\_s = (copysign.f64 #s(literal 1 binary64) z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (if (<= (/ (sin y) y) 0.9999999995) (* (/ (sin y) z_m) (/ x y)) (/ x z_m))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if ((sin(y) / y) <= 0.9999999995) {
tmp = (sin(y) / z_m) * (x / y);
} else {
tmp = x / z_m;
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((sin(y) / y) <= 0.9999999995d0) then
tmp = (sin(y) / z_m) * (x / y)
else
tmp = x / z_m
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if ((Math.sin(y) / y) <= 0.9999999995) {
tmp = (Math.sin(y) / z_m) * (x / y);
} else {
tmp = x / z_m;
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if (math.sin(y) / y) <= 0.9999999995: tmp = (math.sin(y) / z_m) * (x / y) else: tmp = x / z_m return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (Float64(sin(y) / y) <= 0.9999999995) tmp = Float64(Float64(sin(y) / z_m) * Float64(x / y)); else tmp = Float64(x / z_m); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if ((sin(y) / y) <= 0.9999999995) tmp = (sin(y) / z_m) * (x / y); else tmp = x / z_m; end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], 0.9999999995], N[(N[(N[Sin[y], $MachinePrecision] / z$95$m), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / z$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\sin y}{y} \leq 0.9999999995:\\
\;\;\;\;\frac{\sin y}{z\_m} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z\_m}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 y) y) < 0.99999999949999996Initial program 90.0%
*-commutativeN/A
div-invN/A
associate-*l*N/A
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f6490.1
Applied egg-rr90.1%
if 0.99999999949999996 < (/.f64 (sin.f64 y) y) Initial program 100.0%
Taylor expanded in y around 0
/-lowering-/.f64100.0
Simplified100.0%
z\_m = (fabs.f64 z) z\_s = (copysign.f64 #s(literal 1 binary64) z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (if (<= (/ (sin y) y) 0.9999999995) (/ (* (sin y) x) (* z_m y)) (/ x z_m))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if ((sin(y) / y) <= 0.9999999995) {
tmp = (sin(y) * x) / (z_m * y);
} else {
tmp = x / z_m;
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((sin(y) / y) <= 0.9999999995d0) then
tmp = (sin(y) * x) / (z_m * y)
else
tmp = x / z_m
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if ((Math.sin(y) / y) <= 0.9999999995) {
tmp = (Math.sin(y) * x) / (z_m * y);
} else {
tmp = x / z_m;
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if (math.sin(y) / y) <= 0.9999999995: tmp = (math.sin(y) * x) / (z_m * y) else: tmp = x / z_m return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (Float64(sin(y) / y) <= 0.9999999995) tmp = Float64(Float64(sin(y) * x) / Float64(z_m * y)); else tmp = Float64(x / z_m); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if ((sin(y) / y) <= 0.9999999995) tmp = (sin(y) * x) / (z_m * y); else tmp = x / z_m; end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], 0.9999999995], N[(N[(N[Sin[y], $MachinePrecision] * x), $MachinePrecision] / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision], N[(x / z$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\sin y}{y} \leq 0.9999999995:\\
\;\;\;\;\frac{\sin y \cdot x}{z\_m \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z\_m}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 y) y) < 0.99999999949999996Initial program 90.0%
associate-*r/N/A
associate-/l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
*-commutativeN/A
*-lowering-*.f6488.5
Applied egg-rr88.5%
if 0.99999999949999996 < (/.f64 (sin.f64 y) y) Initial program 100.0%
Taylor expanded in y around 0
/-lowering-/.f64100.0
Simplified100.0%
Final simplification94.3%
z\_m = (fabs.f64 z) z\_s = (copysign.f64 #s(literal 1 binary64) z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (if (<= (/ (sin y) y) 0.9999999995) (* (sin y) (/ x (* z_m y))) (/ x z_m))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if ((sin(y) / y) <= 0.9999999995) {
tmp = sin(y) * (x / (z_m * y));
} else {
tmp = x / z_m;
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((sin(y) / y) <= 0.9999999995d0) then
tmp = sin(y) * (x / (z_m * y))
else
tmp = x / z_m
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if ((Math.sin(y) / y) <= 0.9999999995) {
tmp = Math.sin(y) * (x / (z_m * y));
} else {
tmp = x / z_m;
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if (math.sin(y) / y) <= 0.9999999995: tmp = math.sin(y) * (x / (z_m * y)) else: tmp = x / z_m return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (Float64(sin(y) / y) <= 0.9999999995) tmp = Float64(sin(y) * Float64(x / Float64(z_m * y))); else tmp = Float64(x / z_m); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if ((sin(y) / y) <= 0.9999999995) tmp = sin(y) * (x / (z_m * y)); else tmp = x / z_m; end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], 0.9999999995], N[(N[Sin[y], $MachinePrecision] * N[(x / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / z$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\sin y}{y} \leq 0.9999999995:\\
\;\;\;\;\sin y \cdot \frac{x}{z\_m \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z\_m}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 y) y) < 0.99999999949999996Initial program 90.0%
*-commutativeN/A
div-invN/A
associate-*l*N/A
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-*l/N/A
*-lft-identityN/A
associate-/l/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sin-lowering-sin.f6488.4
Applied egg-rr88.4%
if 0.99999999949999996 < (/.f64 (sin.f64 y) y) Initial program 100.0%
Taylor expanded in y around 0
/-lowering-/.f64100.0
Simplified100.0%
Final simplification94.3%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
:precision binary64
(*
z_s
(if (<= (/ (* (/ (sin y) y) x) z_m) 1e-312)
(/ (* (* x x) (/ 1.0 (- x (* y (* x (* y -0.16666666666666666)))))) z_m)
(/ x z_m))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if ((((sin(y) / y) * x) / z_m) <= 1e-312) {
tmp = ((x * x) * (1.0 / (x - (y * (x * (y * -0.16666666666666666)))))) / z_m;
} else {
tmp = x / z_m;
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((((sin(y) / y) * x) / z_m) <= 1d-312) then
tmp = ((x * x) * (1.0d0 / (x - (y * (x * (y * (-0.16666666666666666d0))))))) / z_m
else
tmp = x / z_m
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if ((((Math.sin(y) / y) * x) / z_m) <= 1e-312) {
tmp = ((x * x) * (1.0 / (x - (y * (x * (y * -0.16666666666666666)))))) / z_m;
} else {
tmp = x / z_m;
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if (((math.sin(y) / y) * x) / z_m) <= 1e-312: tmp = ((x * x) * (1.0 / (x - (y * (x * (y * -0.16666666666666666)))))) / z_m else: tmp = x / z_m return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (Float64(Float64(Float64(sin(y) / y) * x) / z_m) <= 1e-312) tmp = Float64(Float64(Float64(x * x) * Float64(1.0 / Float64(x - Float64(y * Float64(x * Float64(y * -0.16666666666666666)))))) / z_m); else tmp = Float64(x / z_m); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if ((((sin(y) / y) * x) / z_m) <= 1e-312) tmp = ((x * x) * (1.0 / (x - (y * (x * (y * -0.16666666666666666)))))) / z_m; else tmp = x / z_m; end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[N[(N[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision] / z$95$m), $MachinePrecision], 1e-312], N[(N[(N[(x * x), $MachinePrecision] * N[(1.0 / N[(x - N[(y * N[(x * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], N[(x / z$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\frac{\sin y}{y} \cdot x}{z\_m} \leq 10^{-312}:\\
\;\;\;\;\frac{\left(x \cdot x\right) \cdot \frac{1}{x - y \cdot \left(x \cdot \left(y \cdot -0.16666666666666666\right)\right)}}{z\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (/.f64 (sin.f64 y) y)) z) < 9.9999999999847e-313Initial program 91.9%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
/-lowering-/.f64N/A
Simplified49.6%
flip-+N/A
div-invN/A
*-lowering-*.f64N/A
Applied egg-rr32.1%
Taylor expanded in y around 0
mul-1-negN/A
unpow2N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
neg-lowering-neg.f6454.0
Simplified54.0%
if 9.9999999999847e-313 < (/.f64 (*.f64 x (/.f64 (sin.f64 y) y)) z) Initial program 99.7%
Taylor expanded in y around 0
/-lowering-/.f6459.4
Simplified59.4%
Final simplification56.2%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
:precision binary64
(*
z_s
(if (<= (/ (sin y) y) 1e-5)
(/ y (/ (* z_m y) x))
(/
(*
x
(fma
(* y y)
(fma (* y y) 0.008333333333333333 -0.16666666666666666)
1.0))
z_m))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if ((sin(y) / y) <= 1e-5) {
tmp = y / ((z_m * y) / x);
} else {
tmp = (x * fma((y * y), fma((y * y), 0.008333333333333333, -0.16666666666666666), 1.0)) / z_m;
}
return z_s * tmp;
}
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (Float64(sin(y) / y) <= 1e-5) tmp = Float64(y / Float64(Float64(z_m * y) / x)); else tmp = Float64(Float64(x * fma(Float64(y * y), fma(Float64(y * y), 0.008333333333333333, -0.16666666666666666), 1.0)) / z_m); end return Float64(z_s * tmp) end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], 1e-5], N[(y / N[(N[(z$95$m * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(N[(y * y), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\sin y}{y} \leq 10^{-5}:\\
\;\;\;\;\frac{y}{\frac{z\_m \cdot y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y \cdot y, 0.008333333333333333, -0.16666666666666666\right), 1\right)}{z\_m}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 y) y) < 1.00000000000000008e-5Initial program 89.9%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-/l/N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
*-commutativeN/A
*-lowering-*.f6488.2
Applied egg-rr88.2%
Taylor expanded in y around 0
Simplified16.2%
div-invN/A
associate-*l*N/A
associate-/r/N/A
*-commutativeN/A
associate-*l/N/A
un-div-invN/A
/-lowering-/.f64N/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-lowering-*.f6422.5
Applied egg-rr22.5%
if 1.00000000000000008e-5 < (/.f64 (sin.f64 y) y) Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6499.3
Simplified99.3%
Final simplification61.8%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
:precision binary64
(*
z_s
(if (<= (/ (* (/ (sin y) y) x) z_m) 2e-273)
(* y (/ x (* z_m y)))
(/ x z_m))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if ((((sin(y) / y) * x) / z_m) <= 2e-273) {
tmp = y * (x / (z_m * y));
} else {
tmp = x / z_m;
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((((sin(y) / y) * x) / z_m) <= 2d-273) then
tmp = y * (x / (z_m * y))
else
tmp = x / z_m
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if ((((Math.sin(y) / y) * x) / z_m) <= 2e-273) {
tmp = y * (x / (z_m * y));
} else {
tmp = x / z_m;
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if (((math.sin(y) / y) * x) / z_m) <= 2e-273: tmp = y * (x / (z_m * y)) else: tmp = x / z_m return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (Float64(Float64(Float64(sin(y) / y) * x) / z_m) <= 2e-273) tmp = Float64(y * Float64(x / Float64(z_m * y))); else tmp = Float64(x / z_m); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if ((((sin(y) / y) * x) / z_m) <= 2e-273) tmp = y * (x / (z_m * y)); else tmp = x / z_m; end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[N[(N[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision] / z$95$m), $MachinePrecision], 2e-273], N[(y * N[(x / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / z$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\frac{\sin y}{y} \cdot x}{z\_m} \leq 2 \cdot 10^{-273}:\\
\;\;\;\;y \cdot \frac{x}{z\_m \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (/.f64 (sin.f64 y) y)) z) < 2e-273Initial program 92.2%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-/l/N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
*-commutativeN/A
*-lowering-*.f6488.5
Applied egg-rr88.5%
Taylor expanded in y around 0
Simplified52.0%
*-commutativeN/A
associate-*r/N/A
*-rgt-identityN/A
times-fracN/A
/-rgt-identityN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6453.1
Applied egg-rr53.1%
if 2e-273 < (/.f64 (*.f64 x (/.f64 (sin.f64 y) y)) z) Initial program 99.7%
Taylor expanded in y around 0
/-lowering-/.f6460.7
Simplified60.7%
Final simplification56.0%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
:precision binary64
(*
z_s
(if (<= (/ (sin y) y) 0.02)
(/ y (/ (* z_m y) x))
(* (/ x z_m) (fma y (* y -0.16666666666666666) 1.0)))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if ((sin(y) / y) <= 0.02) {
tmp = y / ((z_m * y) / x);
} else {
tmp = (x / z_m) * fma(y, (y * -0.16666666666666666), 1.0);
}
return z_s * tmp;
}
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (Float64(sin(y) / y) <= 0.02) tmp = Float64(y / Float64(Float64(z_m * y) / x)); else tmp = Float64(Float64(x / z_m) * fma(y, Float64(y * -0.16666666666666666), 1.0)); end return Float64(z_s * tmp) end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], 0.02], N[(y / N[(N[(z$95$m * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] * N[(y * N[(y * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\sin y}{y} \leq 0.02:\\
\;\;\;\;\frac{y}{\frac{z\_m \cdot y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z\_m} \cdot \mathsf{fma}\left(y, y \cdot -0.16666666666666666, 1\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 y) y) < 0.0200000000000000004Initial program 90.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-/l/N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
*-commutativeN/A
*-lowering-*.f6488.3
Applied egg-rr88.3%
Taylor expanded in y around 0
Simplified16.2%
div-invN/A
associate-*l*N/A
associate-/r/N/A
*-commutativeN/A
associate-*l/N/A
un-div-invN/A
/-lowering-/.f64N/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-lowering-*.f6422.5
Applied egg-rr22.5%
if 0.0200000000000000004 < (/.f64 (sin.f64 y) y) Initial program 100.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-/l/N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
*-commutativeN/A
*-lowering-*.f6486.7
Applied egg-rr86.7%
Taylor expanded in y around 0
associate-*r/N/A
*-rgt-identityN/A
associate-*r/N/A
distribute-lft1-inN/A
+-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
/-lowering-/.f6499.7
Simplified99.7%
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
div-invN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64100.0
Applied egg-rr100.0%
Final simplification61.8%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
:precision binary64
(*
z_s
(if (<= (/ (sin y) y) 0.02)
(/ y (* y (/ z_m x)))
(* (/ x z_m) (fma y (* y -0.16666666666666666) 1.0)))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if ((sin(y) / y) <= 0.02) {
tmp = y / (y * (z_m / x));
} else {
tmp = (x / z_m) * fma(y, (y * -0.16666666666666666), 1.0);
}
return z_s * tmp;
}
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (Float64(sin(y) / y) <= 0.02) tmp = Float64(y / Float64(y * Float64(z_m / x))); else tmp = Float64(Float64(x / z_m) * fma(y, Float64(y * -0.16666666666666666), 1.0)); end return Float64(z_s * tmp) end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], 0.02], N[(y / N[(y * N[(z$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] * N[(y * N[(y * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\sin y}{y} \leq 0.02:\\
\;\;\;\;\frac{y}{y \cdot \frac{z\_m}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z\_m} \cdot \mathsf{fma}\left(y, y \cdot -0.16666666666666666, 1\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 y) y) < 0.0200000000000000004Initial program 90.0%
clear-numN/A
associate-/r*N/A
clear-numN/A
associate-/l/N/A
remove-double-divN/A
div-invN/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
div-invN/A
remove-double-divN/A
*-lowering-*.f64N/A
/-lowering-/.f6494.4
Applied egg-rr94.4%
Taylor expanded in y around 0
Simplified22.2%
if 0.0200000000000000004 < (/.f64 (sin.f64 y) y) Initial program 100.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-/l/N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
*-commutativeN/A
*-lowering-*.f6486.7
Applied egg-rr86.7%
Taylor expanded in y around 0
associate-*r/N/A
*-rgt-identityN/A
associate-*r/N/A
distribute-lft1-inN/A
+-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
/-lowering-/.f6499.7
Simplified99.7%
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
div-invN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64100.0
Applied egg-rr100.0%
Final simplification61.7%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
:precision binary64
(*
z_s
(if (<= (/ (sin y) y) 0.02)
(* y (/ x (* z_m y)))
(* (/ x z_m) (fma y (* y -0.16666666666666666) 1.0)))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if ((sin(y) / y) <= 0.02) {
tmp = y * (x / (z_m * y));
} else {
tmp = (x / z_m) * fma(y, (y * -0.16666666666666666), 1.0);
}
return z_s * tmp;
}
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (Float64(sin(y) / y) <= 0.02) tmp = Float64(y * Float64(x / Float64(z_m * y))); else tmp = Float64(Float64(x / z_m) * fma(y, Float64(y * -0.16666666666666666), 1.0)); end return Float64(z_s * tmp) end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], 0.02], N[(y * N[(x / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] * N[(y * N[(y * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\sin y}{y} \leq 0.02:\\
\;\;\;\;y \cdot \frac{x}{z\_m \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z\_m} \cdot \mathsf{fma}\left(y, y \cdot -0.16666666666666666, 1\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 y) y) < 0.0200000000000000004Initial program 90.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-/l/N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
*-commutativeN/A
*-lowering-*.f6488.3
Applied egg-rr88.3%
Taylor expanded in y around 0
Simplified16.2%
*-commutativeN/A
associate-*r/N/A
*-rgt-identityN/A
times-fracN/A
/-rgt-identityN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6422.2
Applied egg-rr22.2%
if 0.0200000000000000004 < (/.f64 (sin.f64 y) y) Initial program 100.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-/l/N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
*-commutativeN/A
*-lowering-*.f6486.7
Applied egg-rr86.7%
Taylor expanded in y around 0
associate-*r/N/A
*-rgt-identityN/A
associate-*r/N/A
distribute-lft1-inN/A
+-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
/-lowering-/.f6499.7
Simplified99.7%
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
div-invN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64100.0
Applied egg-rr100.0%
Final simplification61.7%
z\_m = (fabs.f64 z) z\_s = (copysign.f64 #s(literal 1 binary64) z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (if (<= z_m 5e+84) (* (/ (/ (sin y) y) z_m) x) (/ (sin y) (* y (/ z_m x))))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
double tmp;
if (z_m <= 5e+84) {
tmp = ((sin(y) / y) / z_m) * x;
} else {
tmp = sin(y) / (y * (z_m / x));
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 5d+84) then
tmp = ((sin(y) / y) / z_m) * x
else
tmp = sin(y) / (y * (z_m / x))
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
double tmp;
if (z_m <= 5e+84) {
tmp = ((Math.sin(y) / y) / z_m) * x;
} else {
tmp = Math.sin(y) / (y * (z_m / x));
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): tmp = 0 if z_m <= 5e+84: tmp = ((math.sin(y) / y) / z_m) * x else: tmp = math.sin(y) / (y * (z_m / x)) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m) tmp = 0.0 if (z_m <= 5e+84) tmp = Float64(Float64(Float64(sin(y) / y) / z_m) * x); else tmp = Float64(sin(y) / Float64(y * Float64(z_m / x))); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m) tmp = 0.0; if (z_m <= 5e+84) tmp = ((sin(y) / y) / z_m) * x; else tmp = sin(y) / (y * (z_m / x)); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[z$95$m, 5e+84], N[(N[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] / z$95$m), $MachinePrecision] * x), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] / N[(y * N[(z$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 5 \cdot 10^{+84}:\\
\;\;\;\;\frac{\frac{\sin y}{y}}{z\_m} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin y}{y \cdot \frac{z\_m}{x}}\\
\end{array}
\end{array}
if z < 5.0000000000000001e84Initial program 94.4%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-/l/N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
*-commutativeN/A
*-lowering-*.f6489.2
Applied egg-rr89.2%
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f6496.7
Applied egg-rr96.7%
if 5.0000000000000001e84 < z Initial program 99.8%
clear-numN/A
associate-/r*N/A
clear-numN/A
associate-/l/N/A
remove-double-divN/A
div-invN/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
div-invN/A
remove-double-divN/A
*-lowering-*.f64N/A
/-lowering-/.f6496.5
Applied egg-rr96.5%
Final simplification96.7%
z\_m = (fabs.f64 z) z\_s = (copysign.f64 #s(literal 1 binary64) z) (FPCore (z_s x y z_m) :precision binary64 (* z_s (/ x z_m)))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
return z_s * (x / z_m);
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
code = z_s * (x / z_m)
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
return z_s * (x / z_m);
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m): return z_s * (x / z_m)
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m) return Float64(z_s * Float64(x / z_m)) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp = code(z_s, x, y, z_m) tmp = z_s * (x / z_m); end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * N[(x / z$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \frac{x}{z\_m}
\end{array}
Initial program 95.0%
Taylor expanded in y around 0
/-lowering-/.f6456.7
Simplified56.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ y (sin y))) (t_1 (/ (* x (/ 1.0 t_0)) z)))
(if (< z -4.2173720203427147e-29)
t_1
(if (< z 4.446702369113811e+64) (/ x (* z t_0)) t_1))))
double code(double x, double y, double z) {
double t_0 = y / sin(y);
double t_1 = (x * (1.0 / t_0)) / z;
double tmp;
if (z < -4.2173720203427147e-29) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x / (z * t_0);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = y / sin(y)
t_1 = (x * (1.0d0 / t_0)) / z
if (z < (-4.2173720203427147d-29)) then
tmp = t_1
else if (z < 4.446702369113811d+64) then
tmp = x / (z * t_0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y / Math.sin(y);
double t_1 = (x * (1.0 / t_0)) / z;
double tmp;
if (z < -4.2173720203427147e-29) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x / (z * t_0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y / math.sin(y) t_1 = (x * (1.0 / t_0)) / z tmp = 0 if z < -4.2173720203427147e-29: tmp = t_1 elif z < 4.446702369113811e+64: tmp = x / (z * t_0) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y / sin(y)) t_1 = Float64(Float64(x * Float64(1.0 / t_0)) / z) tmp = 0.0 if (z < -4.2173720203427147e-29) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = Float64(x / Float64(z * t_0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y / sin(y); t_1 = (x * (1.0 / t_0)) / z; tmp = 0.0; if (z < -4.2173720203427147e-29) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = x / (z * t_0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[Less[z, -4.2173720203427147e-29], t$95$1, If[Less[z, 4.446702369113811e+64], N[(x / N[(z * t$95$0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{\sin y}\\
t_1 := \frac{x \cdot \frac{1}{t\_0}}{z}\\
\mathbf{if}\;z < -4.2173720203427147 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\
\;\;\;\;\frac{x}{z \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024198
(FPCore (x y z)
:name "Linear.Quaternion:$ctanh from linear-1.19.1.3"
:precision binary64
:alt
(! :herbie-platform default (if (< z -42173720203427147/1000000000000000000000000000000000000000000000) (/ (* x (/ 1 (/ y (sin y)))) z) (if (< z 44467023691138110000000000000000000000000000000000000000000000000) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1 (/ y (sin y)))) z))))
(/ (* x (/ (sin y) y)) z))