
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) y)))
double code(double x, double y) {
return sin(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / y)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) y)))
double code(double x, double y) {
return sin(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / y)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{y}
\end{array}
(FPCore (x y) :precision binary64 (/ (sin x) (/ y (sinh y))))
double code(double x, double y) {
return sin(x) / (y / sinh(y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) / (y / sinh(y))
end function
public static double code(double x, double y) {
return Math.sin(x) / (y / Math.sinh(y));
}
def code(x, y): return math.sin(x) / (y / math.sinh(y))
function code(x, y) return Float64(sin(x) / Float64(y / sinh(y))) end
function tmp = code(x, y) tmp = sin(x) / (y / sinh(y)); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] / N[(y / N[Sinh[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x}{\frac{y}{\sinh y}}
\end{array}
Initial program 100.0%
clear-num100.0%
un-div-inv100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ (sinh y) y))) (if (<= t_0 1e+36) (sin x) (* x t_0))))
double code(double x, double y) {
double t_0 = sinh(y) / y;
double tmp;
if (t_0 <= 1e+36) {
tmp = sin(x);
} else {
tmp = x * t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = sinh(y) / y
if (t_0 <= 1d+36) then
tmp = sin(x)
else
tmp = x * t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.sinh(y) / y;
double tmp;
if (t_0 <= 1e+36) {
tmp = Math.sin(x);
} else {
tmp = x * t_0;
}
return tmp;
}
def code(x, y): t_0 = math.sinh(y) / y tmp = 0 if t_0 <= 1e+36: tmp = math.sin(x) else: tmp = x * t_0 return tmp
function code(x, y) t_0 = Float64(sinh(y) / y) tmp = 0.0 if (t_0 <= 1e+36) tmp = sin(x); else tmp = Float64(x * t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = sinh(y) / y; tmp = 0.0; if (t_0 <= 1e+36) tmp = sin(x); else tmp = x * t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+36], N[Sin[x], $MachinePrecision], N[(x * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sinh y}{y}\\
\mathbf{if}\;t_0 \leq 10^{+36}:\\
\;\;\;\;\sin x\\
\mathbf{else}:\\
\;\;\;\;x \cdot t_0\\
\end{array}
\end{array}
if (/.f64 (sinh.f64 y) y) < 1.00000000000000004e36Initial program 100.0%
Taylor expanded in y around 0 96.7%
if 1.00000000000000004e36 < (/.f64 (sinh.f64 y) y) Initial program 100.0%
associate-*r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 65.5%
associate-/r*65.5%
associate-*r/65.5%
*-commutative65.5%
associate-/r/65.5%
rec-exp65.5%
sinh-def65.5%
Simplified65.5%
associate-/r/65.5%
clear-num65.5%
Applied egg-rr65.5%
Final simplification79.7%
(FPCore (x y) :precision binary64 (if (<= (/ (sinh y) y) 1e+36) (sin x) (/ (* x (sinh y)) y)))
double code(double x, double y) {
double tmp;
if ((sinh(y) / y) <= 1e+36) {
tmp = sin(x);
} else {
tmp = (x * sinh(y)) / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((sinh(y) / y) <= 1d+36) then
tmp = sin(x)
else
tmp = (x * sinh(y)) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((Math.sinh(y) / y) <= 1e+36) {
tmp = Math.sin(x);
} else {
tmp = (x * Math.sinh(y)) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if (math.sinh(y) / y) <= 1e+36: tmp = math.sin(x) else: tmp = (x * math.sinh(y)) / y return tmp
function code(x, y) tmp = 0.0 if (Float64(sinh(y) / y) <= 1e+36) tmp = sin(x); else tmp = Float64(Float64(x * sinh(y)) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((sinh(y) / y) <= 1e+36) tmp = sin(x); else tmp = (x * sinh(y)) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision], 1e+36], N[Sin[x], $MachinePrecision], N[(N[(x * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sinh y}{y} \leq 10^{+36}:\\
\;\;\;\;\sin x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \sinh y}{y}\\
\end{array}
\end{array}
if (/.f64 (sinh.f64 y) y) < 1.00000000000000004e36Initial program 100.0%
Taylor expanded in y around 0 96.7%
if 1.00000000000000004e36 < (/.f64 (sinh.f64 y) y) Initial program 100.0%
associate-*r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 65.5%
associate-/r*65.5%
associate-*r/65.5%
*-commutative65.5%
associate-/r/65.5%
rec-exp65.5%
sinh-def65.5%
Simplified65.5%
associate-/r/65.5%
clear-num65.5%
Applied egg-rr65.5%
associate-*l/65.5%
Applied egg-rr65.5%
Final simplification79.7%
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) y)))
double code(double x, double y) {
return sin(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / y)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{y}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y 90.0)
(sin x)
(if (<= y 2.85e+69)
(/ (* x (sinh y)) y)
(if (<= y 7e+87)
(+ x (* -0.16666666666666666 (pow x 3.0)))
(if (<= y 1.35e+154)
(* x (/ (sinh y) y))
(* 0.16666666666666666 (* (sin x) (* y y))))))))
double code(double x, double y) {
double tmp;
if (y <= 90.0) {
tmp = sin(x);
} else if (y <= 2.85e+69) {
tmp = (x * sinh(y)) / y;
} else if (y <= 7e+87) {
tmp = x + (-0.16666666666666666 * pow(x, 3.0));
} else if (y <= 1.35e+154) {
tmp = x * (sinh(y) / y);
} else {
tmp = 0.16666666666666666 * (sin(x) * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 90.0d0) then
tmp = sin(x)
else if (y <= 2.85d+69) then
tmp = (x * sinh(y)) / y
else if (y <= 7d+87) then
tmp = x + ((-0.16666666666666666d0) * (x ** 3.0d0))
else if (y <= 1.35d+154) then
tmp = x * (sinh(y) / y)
else
tmp = 0.16666666666666666d0 * (sin(x) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 90.0) {
tmp = Math.sin(x);
} else if (y <= 2.85e+69) {
tmp = (x * Math.sinh(y)) / y;
} else if (y <= 7e+87) {
tmp = x + (-0.16666666666666666 * Math.pow(x, 3.0));
} else if (y <= 1.35e+154) {
tmp = x * (Math.sinh(y) / y);
} else {
tmp = 0.16666666666666666 * (Math.sin(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 90.0: tmp = math.sin(x) elif y <= 2.85e+69: tmp = (x * math.sinh(y)) / y elif y <= 7e+87: tmp = x + (-0.16666666666666666 * math.pow(x, 3.0)) elif y <= 1.35e+154: tmp = x * (math.sinh(y) / y) else: tmp = 0.16666666666666666 * (math.sin(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 90.0) tmp = sin(x); elseif (y <= 2.85e+69) tmp = Float64(Float64(x * sinh(y)) / y); elseif (y <= 7e+87) tmp = Float64(x + Float64(-0.16666666666666666 * (x ^ 3.0))); elseif (y <= 1.35e+154) tmp = Float64(x * Float64(sinh(y) / y)); else tmp = Float64(0.16666666666666666 * Float64(sin(x) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 90.0) tmp = sin(x); elseif (y <= 2.85e+69) tmp = (x * sinh(y)) / y; elseif (y <= 7e+87) tmp = x + (-0.16666666666666666 * (x ^ 3.0)); elseif (y <= 1.35e+154) tmp = x * (sinh(y) / y); else tmp = 0.16666666666666666 * (sin(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 90.0], N[Sin[x], $MachinePrecision], If[LessEqual[y, 2.85e+69], N[(N[(x * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 7e+87], N[(x + N[(-0.16666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(x * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Sin[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 90:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 2.85 \cdot 10^{+69}:\\
\;\;\;\;\frac{x \cdot \sinh y}{y}\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+87}:\\
\;\;\;\;x + -0.16666666666666666 \cdot {x}^{3}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x \cdot \frac{\sinh y}{y}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 90Initial program 100.0%
Taylor expanded in y around 0 59.1%
if 90 < y < 2.85e69Initial program 99.9%
associate-*r/100.0%
clear-num99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 73.2%
associate-/r*73.2%
associate-*r/73.2%
*-commutative73.2%
associate-/r/73.2%
rec-exp73.2%
sinh-def73.2%
Simplified73.2%
associate-/r/73.2%
clear-num73.2%
Applied egg-rr73.2%
associate-*l/73.3%
Applied egg-rr73.3%
if 2.85e69 < y < 6.99999999999999972e87Initial program 100.0%
associate-*r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 3.1%
Taylor expanded in x around 0 75.9%
if 6.99999999999999972e87 < y < 1.35000000000000003e154Initial program 100.0%
associate-*r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 76.5%
associate-/r*76.5%
associate-*r/76.5%
*-commutative76.5%
associate-/r/76.5%
rec-exp76.5%
sinh-def76.5%
Simplified76.5%
associate-/r/76.5%
clear-num76.5%
Applied egg-rr76.5%
if 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
Simplified100.0%
Final simplification65.3%
(FPCore (x y)
:precision binary64
(if (<= y 90.0)
(* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(if (<= y 2.85e+69)
(/ (* x (sinh y)) y)
(if (<= y 7e+87)
(+ x (* -0.16666666666666666 (pow x 3.0)))
(if (<= y 1.35e+154)
(* x (/ (sinh y) y))
(* 0.16666666666666666 (* (sin x) (* y y))))))))
double code(double x, double y) {
double tmp;
if (y <= 90.0) {
tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 2.85e+69) {
tmp = (x * sinh(y)) / y;
} else if (y <= 7e+87) {
tmp = x + (-0.16666666666666666 * pow(x, 3.0));
} else if (y <= 1.35e+154) {
tmp = x * (sinh(y) / y);
} else {
tmp = 0.16666666666666666 * (sin(x) * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 90.0d0) then
tmp = sin(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else if (y <= 2.85d+69) then
tmp = (x * sinh(y)) / y
else if (y <= 7d+87) then
tmp = x + ((-0.16666666666666666d0) * (x ** 3.0d0))
else if (y <= 1.35d+154) then
tmp = x * (sinh(y) / y)
else
tmp = 0.16666666666666666d0 * (sin(x) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 90.0) {
tmp = Math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 2.85e+69) {
tmp = (x * Math.sinh(y)) / y;
} else if (y <= 7e+87) {
tmp = x + (-0.16666666666666666 * Math.pow(x, 3.0));
} else if (y <= 1.35e+154) {
tmp = x * (Math.sinh(y) / y);
} else {
tmp = 0.16666666666666666 * (Math.sin(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 90.0: tmp = math.sin(x) * (1.0 + (0.16666666666666666 * (y * y))) elif y <= 2.85e+69: tmp = (x * math.sinh(y)) / y elif y <= 7e+87: tmp = x + (-0.16666666666666666 * math.pow(x, 3.0)) elif y <= 1.35e+154: tmp = x * (math.sinh(y) / y) else: tmp = 0.16666666666666666 * (math.sin(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 90.0) tmp = Float64(sin(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); elseif (y <= 2.85e+69) tmp = Float64(Float64(x * sinh(y)) / y); elseif (y <= 7e+87) tmp = Float64(x + Float64(-0.16666666666666666 * (x ^ 3.0))); elseif (y <= 1.35e+154) tmp = Float64(x * Float64(sinh(y) / y)); else tmp = Float64(0.16666666666666666 * Float64(sin(x) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 90.0) tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y))); elseif (y <= 2.85e+69) tmp = (x * sinh(y)) / y; elseif (y <= 7e+87) tmp = x + (-0.16666666666666666 * (x ^ 3.0)); elseif (y <= 1.35e+154) tmp = x * (sinh(y) / y); else tmp = 0.16666666666666666 * (sin(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 90.0], N[(N[Sin[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.85e+69], N[(N[(x * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 7e+87], N[(x + N[(-0.16666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(x * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Sin[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 90:\\
\;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 2.85 \cdot 10^{+69}:\\
\;\;\;\;\frac{x \cdot \sinh y}{y}\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+87}:\\
\;\;\;\;x + -0.16666666666666666 \cdot {x}^{3}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x \cdot \frac{\sinh y}{y}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 90Initial program 100.0%
Taylor expanded in y around 0 84.4%
unpow284.4%
Simplified84.4%
if 90 < y < 2.85e69Initial program 99.9%
associate-*r/100.0%
clear-num99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 73.2%
associate-/r*73.2%
associate-*r/73.2%
*-commutative73.2%
associate-/r/73.2%
rec-exp73.2%
sinh-def73.2%
Simplified73.2%
associate-/r/73.2%
clear-num73.2%
Applied egg-rr73.2%
associate-*l/73.3%
Applied egg-rr73.3%
if 2.85e69 < y < 6.99999999999999972e87Initial program 100.0%
associate-*r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 3.1%
Taylor expanded in x around 0 75.9%
if 6.99999999999999972e87 < y < 1.35000000000000003e154Initial program 100.0%
associate-*r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 76.5%
associate-/r*76.5%
associate-*r/76.5%
*-commutative76.5%
associate-/r/76.5%
rec-exp76.5%
sinh-def76.5%
Simplified76.5%
associate-/r/76.5%
clear-num76.5%
Applied egg-rr76.5%
if 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
Simplified100.0%
Final simplification84.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* x y) (* y -0.16666666666666666))))
(if (<= y 1.45e+38)
(sin x)
(if (<= y 3.3e+159)
t_0
(if (<= y 7.6e+242)
(* x (+ 1.0 (* 0.16666666666666666 (* y y))))
(if (or (<= y 5.8e+270) (not (<= y 2.9e+292)))
t_0
(* 0.16666666666666666 (* x (* y y)))))))))
double code(double x, double y) {
double t_0 = (x * y) * (y * -0.16666666666666666);
double tmp;
if (y <= 1.45e+38) {
tmp = sin(x);
} else if (y <= 3.3e+159) {
tmp = t_0;
} else if (y <= 7.6e+242) {
tmp = x * (1.0 + (0.16666666666666666 * (y * y)));
} else if ((y <= 5.8e+270) || !(y <= 2.9e+292)) {
tmp = t_0;
} else {
tmp = 0.16666666666666666 * (x * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x * y) * (y * (-0.16666666666666666d0))
if (y <= 1.45d+38) then
tmp = sin(x)
else if (y <= 3.3d+159) then
tmp = t_0
else if (y <= 7.6d+242) then
tmp = x * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else if ((y <= 5.8d+270) .or. (.not. (y <= 2.9d+292))) then
tmp = t_0
else
tmp = 0.16666666666666666d0 * (x * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * y) * (y * -0.16666666666666666);
double tmp;
if (y <= 1.45e+38) {
tmp = Math.sin(x);
} else if (y <= 3.3e+159) {
tmp = t_0;
} else if (y <= 7.6e+242) {
tmp = x * (1.0 + (0.16666666666666666 * (y * y)));
} else if ((y <= 5.8e+270) || !(y <= 2.9e+292)) {
tmp = t_0;
} else {
tmp = 0.16666666666666666 * (x * (y * y));
}
return tmp;
}
def code(x, y): t_0 = (x * y) * (y * -0.16666666666666666) tmp = 0 if y <= 1.45e+38: tmp = math.sin(x) elif y <= 3.3e+159: tmp = t_0 elif y <= 7.6e+242: tmp = x * (1.0 + (0.16666666666666666 * (y * y))) elif (y <= 5.8e+270) or not (y <= 2.9e+292): tmp = t_0 else: tmp = 0.16666666666666666 * (x * (y * y)) return tmp
function code(x, y) t_0 = Float64(Float64(x * y) * Float64(y * -0.16666666666666666)) tmp = 0.0 if (y <= 1.45e+38) tmp = sin(x); elseif (y <= 3.3e+159) tmp = t_0; elseif (y <= 7.6e+242) tmp = Float64(x * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); elseif ((y <= 5.8e+270) || !(y <= 2.9e+292)) tmp = t_0; else tmp = Float64(0.16666666666666666 * Float64(x * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) t_0 = (x * y) * (y * -0.16666666666666666); tmp = 0.0; if (y <= 1.45e+38) tmp = sin(x); elseif (y <= 3.3e+159) tmp = t_0; elseif (y <= 7.6e+242) tmp = x * (1.0 + (0.16666666666666666 * (y * y))); elseif ((y <= 5.8e+270) || ~((y <= 2.9e+292))) tmp = t_0; else tmp = 0.16666666666666666 * (x * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * y), $MachinePrecision] * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.45e+38], N[Sin[x], $MachinePrecision], If[LessEqual[y, 3.3e+159], t$95$0, If[LessEqual[y, 7.6e+242], N[(x * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 5.8e+270], N[Not[LessEqual[y, 2.9e+292]], $MachinePrecision]], t$95$0, N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot y\right) \cdot \left(y \cdot -0.16666666666666666\right)\\
\mathbf{if}\;y \leq 1.45 \cdot 10^{+38}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+159}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{+242}:\\
\;\;\;\;x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+270} \lor \neg \left(y \leq 2.9 \cdot 10^{+292}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 1.45000000000000003e38Initial program 100.0%
Taylor expanded in y around 0 56.4%
if 1.45000000000000003e38 < y < 3.2999999999999999e159 or 7.60000000000000015e242 < y < 5.7999999999999998e270 or 2.89999999999999991e292 < y Initial program 100.0%
Taylor expanded in y around 0 33.2%
unpow233.2%
Simplified33.2%
Taylor expanded in x around 0 15.6%
+-commutative15.6%
unpow215.6%
Simplified15.6%
Taylor expanded in y around inf 15.6%
*-commutative15.6%
unpow215.6%
*-commutative15.6%
associate-*r*15.6%
*-commutative15.6%
Simplified15.6%
expm1-log1p-u6.5%
expm1-udef6.3%
add-sqr-sqrt6.3%
sqrt-unprod24.5%
swap-sqr24.5%
metadata-eval24.5%
metadata-eval24.5%
swap-sqr24.5%
*-commutative24.5%
*-commutative24.5%
sqrt-unprod0.0%
add-sqr-sqrt22.3%
associate-*l*22.3%
Applied egg-rr22.3%
expm1-def22.2%
expm1-log1p30.7%
associate-*r*30.7%
Simplified30.7%
if 3.2999999999999999e159 < y < 7.60000000000000015e242Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 91.7%
+-commutative91.7%
unpow291.7%
Simplified91.7%
if 5.7999999999999998e270 < y < 2.89999999999999991e292Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 50.0%
unpow250.0%
*-commutative50.0%
Simplified50.0%
Final simplification54.3%
(FPCore (x y)
:precision binary64
(if (<= y 5e-5)
x
(if (or (<= y 3.4e+159)
(not
(or (<= y 7.6e+242) (and (not (<= y 6e+270)) (<= y 2.2e+292)))))
(* (* x y) (* y -0.16666666666666666))
(* 0.16666666666666666 (* x (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 5e-5) {
tmp = x;
} else if ((y <= 3.4e+159) || !((y <= 7.6e+242) || (!(y <= 6e+270) && (y <= 2.2e+292)))) {
tmp = (x * y) * (y * -0.16666666666666666);
} else {
tmp = 0.16666666666666666 * (x * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 5d-5) then
tmp = x
else if ((y <= 3.4d+159) .or. (.not. (y <= 7.6d+242) .or. (.not. (y <= 6d+270)) .and. (y <= 2.2d+292))) then
tmp = (x * y) * (y * (-0.16666666666666666d0))
else
tmp = 0.16666666666666666d0 * (x * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 5e-5) {
tmp = x;
} else if ((y <= 3.4e+159) || !((y <= 7.6e+242) || (!(y <= 6e+270) && (y <= 2.2e+292)))) {
tmp = (x * y) * (y * -0.16666666666666666);
} else {
tmp = 0.16666666666666666 * (x * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 5e-5: tmp = x elif (y <= 3.4e+159) or not ((y <= 7.6e+242) or (not (y <= 6e+270) and (y <= 2.2e+292))): tmp = (x * y) * (y * -0.16666666666666666) else: tmp = 0.16666666666666666 * (x * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 5e-5) tmp = x; elseif ((y <= 3.4e+159) || !((y <= 7.6e+242) || (!(y <= 6e+270) && (y <= 2.2e+292)))) tmp = Float64(Float64(x * y) * Float64(y * -0.16666666666666666)); else tmp = Float64(0.16666666666666666 * Float64(x * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 5e-5) tmp = x; elseif ((y <= 3.4e+159) || ~(((y <= 7.6e+242) || (~((y <= 6e+270)) && (y <= 2.2e+292))))) tmp = (x * y) * (y * -0.16666666666666666); else tmp = 0.16666666666666666 * (x * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 5e-5], x, If[Or[LessEqual[y, 3.4e+159], N[Not[Or[LessEqual[y, 7.6e+242], And[N[Not[LessEqual[y, 6e+270]], $MachinePrecision], LessEqual[y, 2.2e+292]]]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5 \cdot 10^{-5}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{+159} \lor \neg \left(y \leq 7.6 \cdot 10^{+242} \lor \neg \left(y \leq 6 \cdot 10^{+270}\right) \land y \leq 2.2 \cdot 10^{+292}\right):\\
\;\;\;\;\left(x \cdot y\right) \cdot \left(y \cdot -0.16666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 5.00000000000000024e-5Initial program 100.0%
associate-*r/87.4%
clear-num87.3%
Applied egg-rr87.3%
Taylor expanded in x around 0 29.9%
associate-/r*29.9%
associate-*r/29.9%
*-commutative29.9%
associate-/r/29.9%
rec-exp29.9%
sinh-def57.6%
Simplified57.6%
Taylor expanded in y around 0 32.0%
if 5.00000000000000024e-5 < y < 3.39999999999999991e159 or 7.60000000000000015e242 < y < 6.00000000000000028e270 or 2.19999999999999985e292 < y Initial program 100.0%
Taylor expanded in y around 0 26.2%
unpow226.2%
Simplified26.2%
Taylor expanded in x around 0 12.4%
+-commutative12.4%
unpow212.4%
Simplified12.4%
Taylor expanded in y around inf 12.4%
*-commutative12.4%
unpow212.4%
*-commutative12.4%
associate-*r*12.4%
*-commutative12.4%
Simplified12.4%
expm1-log1p-u5.4%
expm1-udef5.1%
add-sqr-sqrt5.1%
sqrt-unprod18.8%
swap-sqr18.8%
metadata-eval18.8%
metadata-eval18.8%
swap-sqr18.8%
*-commutative18.8%
*-commutative18.8%
sqrt-unprod0.0%
add-sqr-sqrt17.2%
associate-*l*17.2%
Applied egg-rr17.2%
expm1-def17.1%
expm1-log1p23.9%
associate-*r*23.9%
Simplified23.9%
if 3.39999999999999991e159 < y < 7.60000000000000015e242 or 6.00000000000000028e270 < y < 2.19999999999999985e292Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 85.7%
unpow285.7%
*-commutative85.7%
Simplified85.7%
Final simplification33.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* x y) (* y -0.16666666666666666))))
(if (<= x -2.95e+134)
t_0
(if (<= x -6.7e+72)
(* 0.16666666666666666 (* x (* y y)))
(if (or (<= x -1.6e+22) (not (<= x 6.5e+57)))
t_0
(* x (+ 1.0 (* 0.16666666666666666 (* y y)))))))))
double code(double x, double y) {
double t_0 = (x * y) * (y * -0.16666666666666666);
double tmp;
if (x <= -2.95e+134) {
tmp = t_0;
} else if (x <= -6.7e+72) {
tmp = 0.16666666666666666 * (x * (y * y));
} else if ((x <= -1.6e+22) || !(x <= 6.5e+57)) {
tmp = t_0;
} else {
tmp = x * (1.0 + (0.16666666666666666 * (y * y)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x * y) * (y * (-0.16666666666666666d0))
if (x <= (-2.95d+134)) then
tmp = t_0
else if (x <= (-6.7d+72)) then
tmp = 0.16666666666666666d0 * (x * (y * y))
else if ((x <= (-1.6d+22)) .or. (.not. (x <= 6.5d+57))) then
tmp = t_0
else
tmp = x * (1.0d0 + (0.16666666666666666d0 * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * y) * (y * -0.16666666666666666);
double tmp;
if (x <= -2.95e+134) {
tmp = t_0;
} else if (x <= -6.7e+72) {
tmp = 0.16666666666666666 * (x * (y * y));
} else if ((x <= -1.6e+22) || !(x <= 6.5e+57)) {
tmp = t_0;
} else {
tmp = x * (1.0 + (0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): t_0 = (x * y) * (y * -0.16666666666666666) tmp = 0 if x <= -2.95e+134: tmp = t_0 elif x <= -6.7e+72: tmp = 0.16666666666666666 * (x * (y * y)) elif (x <= -1.6e+22) or not (x <= 6.5e+57): tmp = t_0 else: tmp = x * (1.0 + (0.16666666666666666 * (y * y))) return tmp
function code(x, y) t_0 = Float64(Float64(x * y) * Float64(y * -0.16666666666666666)) tmp = 0.0 if (x <= -2.95e+134) tmp = t_0; elseif (x <= -6.7e+72) tmp = Float64(0.16666666666666666 * Float64(x * Float64(y * y))); elseif ((x <= -1.6e+22) || !(x <= 6.5e+57)) tmp = t_0; else tmp = Float64(x * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y) t_0 = (x * y) * (y * -0.16666666666666666); tmp = 0.0; if (x <= -2.95e+134) tmp = t_0; elseif (x <= -6.7e+72) tmp = 0.16666666666666666 * (x * (y * y)); elseif ((x <= -1.6e+22) || ~((x <= 6.5e+57))) tmp = t_0; else tmp = x * (1.0 + (0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * y), $MachinePrecision] * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.95e+134], t$95$0, If[LessEqual[x, -6.7e+72], N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.6e+22], N[Not[LessEqual[x, 6.5e+57]], $MachinePrecision]], t$95$0, N[(x * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot y\right) \cdot \left(y \cdot -0.16666666666666666\right)\\
\mathbf{if}\;x \leq -2.95 \cdot 10^{+134}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -6.7 \cdot 10^{+72}:\\
\;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{+22} \lor \neg \left(x \leq 6.5 \cdot 10^{+57}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if x < -2.95000000000000004e134 or -6.6999999999999998e72 < x < -1.6e22 or 6.4999999999999997e57 < x Initial program 99.9%
Taylor expanded in y around 0 81.0%
unpow281.0%
Simplified81.0%
Taylor expanded in x around 0 17.3%
+-commutative17.3%
unpow217.3%
Simplified17.3%
Taylor expanded in y around inf 17.5%
*-commutative17.5%
unpow217.5%
*-commutative17.5%
associate-*r*17.5%
*-commutative17.5%
Simplified17.5%
expm1-log1p-u9.3%
expm1-udef9.1%
add-sqr-sqrt9.1%
sqrt-unprod9.2%
swap-sqr9.2%
metadata-eval9.2%
metadata-eval9.2%
swap-sqr9.2%
*-commutative9.2%
*-commutative9.2%
sqrt-unprod0.5%
add-sqr-sqrt22.2%
associate-*l*22.2%
Applied egg-rr22.2%
expm1-def22.3%
expm1-log1p36.9%
associate-*r*36.9%
Simplified36.9%
if -2.95000000000000004e134 < x < -6.6999999999999998e72Initial program 100.0%
Taylor expanded in y around 0 75.7%
unpow275.7%
Simplified75.7%
Taylor expanded in y around inf 40.3%
unpow240.3%
Simplified40.3%
Taylor expanded in x around 0 34.0%
unpow234.0%
*-commutative34.0%
Simplified34.0%
if -1.6e22 < x < 6.4999999999999997e57Initial program 100.0%
Taylor expanded in y around 0 69.9%
unpow269.9%
Simplified69.9%
Taylor expanded in x around 0 63.7%
+-commutative63.7%
unpow263.7%
Simplified63.7%
Final simplification51.0%
(FPCore (x y) :precision binary64 (if (<= y 90.0) x (* 0.16666666666666666 (* x (* y y)))))
double code(double x, double y) {
double tmp;
if (y <= 90.0) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (x * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 90.0d0) then
tmp = x
else
tmp = 0.16666666666666666d0 * (x * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 90.0) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (x * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 90.0: tmp = x else: tmp = 0.16666666666666666 * (x * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 90.0) tmp = x; else tmp = Float64(0.16666666666666666 * Float64(x * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 90.0) tmp = x; else tmp = 0.16666666666666666 * (x * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 90.0], x, N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 90:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 90Initial program 100.0%
associate-*r/87.6%
clear-num87.4%
Applied egg-rr87.4%
Taylor expanded in x around 0 29.6%
associate-/r*29.6%
associate-*r/29.6%
*-commutative29.6%
associate-/r/29.6%
rec-exp29.7%
sinh-def57.0%
Simplified57.0%
Taylor expanded in y around 0 31.7%
if 90 < y Initial program 100.0%
Taylor expanded in y around 0 43.6%
unpow243.6%
Simplified43.6%
Taylor expanded in y around inf 43.6%
unpow243.6%
Simplified43.6%
Taylor expanded in x around 0 29.5%
unpow229.5%
*-commutative29.5%
Simplified29.5%
Final simplification31.2%
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
return x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x
end function
public static double code(double x, double y) {
return x;
}
def code(x, y): return x
function code(x, y) return x end
function tmp = code(x, y) tmp = x; end
code[x_, y_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
associate-*r/90.5%
clear-num90.4%
Applied egg-rr90.4%
Taylor expanded in x around 0 38.2%
associate-/r*38.2%
associate-*r/38.2%
*-commutative38.2%
associate-/r/38.2%
rec-exp38.2%
sinh-def59.0%
Simplified59.0%
Taylor expanded in y around 0 24.6%
Final simplification24.6%
herbie shell --seed 2023207
(FPCore (x y)
:name "Linear.Quaternion:$ccos from linear-1.19.1.3"
:precision binary64
(* (sin x) (/ (sinh y) y)))