
(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) (/ (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
(let* ((t_0 (* 0.16666666666666666 (* (sin x) (* y y)))))
(if (<= y -1.96e+163)
t_0
(if (<= y -150.0)
(* 0.008333333333333333 (* x (pow y 4.0)))
(if (<= y 6.5e+63)
(sin x)
(if (<= y 1.35e+154)
(+ x (* x (* 0.008333333333333333 (pow y 4.0))))
t_0))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (sin(x) * (y * y));
double tmp;
if (y <= -1.96e+163) {
tmp = t_0;
} else if (y <= -150.0) {
tmp = 0.008333333333333333 * (x * pow(y, 4.0));
} else if (y <= 6.5e+63) {
tmp = sin(x);
} else if (y <= 1.35e+154) {
tmp = x + (x * (0.008333333333333333 * pow(y, 4.0)));
} else {
tmp = 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 = 0.16666666666666666d0 * (sin(x) * (y * y))
if (y <= (-1.96d+163)) then
tmp = t_0
else if (y <= (-150.0d0)) then
tmp = 0.008333333333333333d0 * (x * (y ** 4.0d0))
else if (y <= 6.5d+63) then
tmp = sin(x)
else if (y <= 1.35d+154) then
tmp = x + (x * (0.008333333333333333d0 * (y ** 4.0d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.16666666666666666 * (Math.sin(x) * (y * y));
double tmp;
if (y <= -1.96e+163) {
tmp = t_0;
} else if (y <= -150.0) {
tmp = 0.008333333333333333 * (x * Math.pow(y, 4.0));
} else if (y <= 6.5e+63) {
tmp = Math.sin(x);
} else if (y <= 1.35e+154) {
tmp = x + (x * (0.008333333333333333 * Math.pow(y, 4.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (math.sin(x) * (y * y)) tmp = 0 if y <= -1.96e+163: tmp = t_0 elif y <= -150.0: tmp = 0.008333333333333333 * (x * math.pow(y, 4.0)) elif y <= 6.5e+63: tmp = math.sin(x) elif y <= 1.35e+154: tmp = x + (x * (0.008333333333333333 * math.pow(y, 4.0))) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(sin(x) * Float64(y * y))) tmp = 0.0 if (y <= -1.96e+163) tmp = t_0; elseif (y <= -150.0) tmp = Float64(0.008333333333333333 * Float64(x * (y ^ 4.0))); elseif (y <= 6.5e+63) tmp = sin(x); elseif (y <= 1.35e+154) tmp = Float64(x + Float64(x * Float64(0.008333333333333333 * (y ^ 4.0)))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (sin(x) * (y * y)); tmp = 0.0; if (y <= -1.96e+163) tmp = t_0; elseif (y <= -150.0) tmp = 0.008333333333333333 * (x * (y ^ 4.0)); elseif (y <= 6.5e+63) tmp = sin(x); elseif (y <= 1.35e+154) tmp = x + (x * (0.008333333333333333 * (y ^ 4.0))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(N[Sin[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.96e+163], t$95$0, If[LessEqual[y, -150.0], N[(0.008333333333333333 * N[(x * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.5e+63], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(x + N[(x * N[(0.008333333333333333 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\
\mathbf{if}\;y \leq -1.96 \cdot 10^{+163}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -150:\\
\;\;\;\;0.008333333333333333 \cdot \left(x \cdot {y}^{4}\right)\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+63}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x + x \cdot \left(0.008333333333333333 \cdot {y}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.96000000000000013e163 or 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
if -1.96000000000000013e163 < y < -150Initial program 100.0%
Taylor expanded in y around 0 60.2%
Taylor expanded in x around 0 57.1%
Taylor expanded in y around inf 54.9%
if -150 < y < 6.49999999999999992e63Initial program 100.0%
Taylor expanded in y around 0 93.1%
Taylor expanded in y around 0 92.6%
if 6.49999999999999992e63 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 100.0%
fma-def100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 68.8%
*-commutative68.8%
+-commutative68.8%
associate-+r+68.8%
unpow268.8%
distribute-rgt-in68.8%
+-commutative68.8%
distribute-lft1-in68.8%
associate-*r*68.8%
associate-*r*68.8%
unpow268.8%
+-commutative68.8%
associate-+l+68.8%
+-commutative68.8%
Simplified68.8%
Taylor expanded in y around inf 68.8%
Final simplification87.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* (sin x) (* y y)))))
(if (<= y -1.96e+163)
t_0
(if (<= y -150.0)
(/ (* x (* 0.008333333333333333 (pow y 5.0))) y)
(if (<= y 4.5e+57)
(sin x)
(if (<= y 1.35e+154)
(+ x (* x (* 0.008333333333333333 (pow y 4.0))))
t_0))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (sin(x) * (y * y));
double tmp;
if (y <= -1.96e+163) {
tmp = t_0;
} else if (y <= -150.0) {
tmp = (x * (0.008333333333333333 * pow(y, 5.0))) / y;
} else if (y <= 4.5e+57) {
tmp = sin(x);
} else if (y <= 1.35e+154) {
tmp = x + (x * (0.008333333333333333 * pow(y, 4.0)));
} else {
tmp = 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 = 0.16666666666666666d0 * (sin(x) * (y * y))
if (y <= (-1.96d+163)) then
tmp = t_0
else if (y <= (-150.0d0)) then
tmp = (x * (0.008333333333333333d0 * (y ** 5.0d0))) / y
else if (y <= 4.5d+57) then
tmp = sin(x)
else if (y <= 1.35d+154) then
tmp = x + (x * (0.008333333333333333d0 * (y ** 4.0d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.16666666666666666 * (Math.sin(x) * (y * y));
double tmp;
if (y <= -1.96e+163) {
tmp = t_0;
} else if (y <= -150.0) {
tmp = (x * (0.008333333333333333 * Math.pow(y, 5.0))) / y;
} else if (y <= 4.5e+57) {
tmp = Math.sin(x);
} else if (y <= 1.35e+154) {
tmp = x + (x * (0.008333333333333333 * Math.pow(y, 4.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (math.sin(x) * (y * y)) tmp = 0 if y <= -1.96e+163: tmp = t_0 elif y <= -150.0: tmp = (x * (0.008333333333333333 * math.pow(y, 5.0))) / y elif y <= 4.5e+57: tmp = math.sin(x) elif y <= 1.35e+154: tmp = x + (x * (0.008333333333333333 * math.pow(y, 4.0))) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(sin(x) * Float64(y * y))) tmp = 0.0 if (y <= -1.96e+163) tmp = t_0; elseif (y <= -150.0) tmp = Float64(Float64(x * Float64(0.008333333333333333 * (y ^ 5.0))) / y); elseif (y <= 4.5e+57) tmp = sin(x); elseif (y <= 1.35e+154) tmp = Float64(x + Float64(x * Float64(0.008333333333333333 * (y ^ 4.0)))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (sin(x) * (y * y)); tmp = 0.0; if (y <= -1.96e+163) tmp = t_0; elseif (y <= -150.0) tmp = (x * (0.008333333333333333 * (y ^ 5.0))) / y; elseif (y <= 4.5e+57) tmp = sin(x); elseif (y <= 1.35e+154) tmp = x + (x * (0.008333333333333333 * (y ^ 4.0))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(N[Sin[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.96e+163], t$95$0, If[LessEqual[y, -150.0], N[(N[(x * N[(0.008333333333333333 * N[Power[y, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 4.5e+57], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(x + N[(x * N[(0.008333333333333333 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\
\mathbf{if}\;y \leq -1.96 \cdot 10^{+163}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -150:\\
\;\;\;\;\frac{x \cdot \left(0.008333333333333333 \cdot {y}^{5}\right)}{y}\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+57}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x + x \cdot \left(0.008333333333333333 \cdot {y}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.96000000000000013e163 or 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
if -1.96000000000000013e163 < y < -150Initial program 100.0%
Taylor expanded in y around 0 60.2%
Taylor expanded in x around 0 57.1%
Taylor expanded in y around inf 57.1%
associate-*r*57.1%
*-commutative57.1%
Simplified57.1%
if -150 < y < 4.49999999999999996e57Initial program 100.0%
Taylor expanded in y around 0 93.1%
Taylor expanded in y around 0 92.6%
if 4.49999999999999996e57 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 100.0%
fma-def100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 68.8%
*-commutative68.8%
+-commutative68.8%
associate-+r+68.8%
unpow268.8%
distribute-rgt-in68.8%
+-commutative68.8%
distribute-lft1-in68.8%
associate-*r*68.8%
associate-*r*68.8%
unpow268.8%
+-commutative68.8%
associate-+l+68.8%
+-commutative68.8%
Simplified68.8%
Taylor expanded in y around inf 68.8%
Final simplification87.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* (sin x) (* y y)))))
(if (<= y -1.96e+163)
t_0
(if (<= y -150.0)
(/ (* x (* 0.008333333333333333 (pow y 5.0))) y)
(if (<= y 4.5e+57)
(* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(if (<= y 1.35e+154)
(+ x (* x (* 0.008333333333333333 (pow y 4.0))))
t_0))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (sin(x) * (y * y));
double tmp;
if (y <= -1.96e+163) {
tmp = t_0;
} else if (y <= -150.0) {
tmp = (x * (0.008333333333333333 * pow(y, 5.0))) / y;
} else if (y <= 4.5e+57) {
tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1.35e+154) {
tmp = x + (x * (0.008333333333333333 * pow(y, 4.0)));
} else {
tmp = 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 = 0.16666666666666666d0 * (sin(x) * (y * y))
if (y <= (-1.96d+163)) then
tmp = t_0
else if (y <= (-150.0d0)) then
tmp = (x * (0.008333333333333333d0 * (y ** 5.0d0))) / y
else if (y <= 4.5d+57) then
tmp = sin(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else if (y <= 1.35d+154) then
tmp = x + (x * (0.008333333333333333d0 * (y ** 4.0d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.16666666666666666 * (Math.sin(x) * (y * y));
double tmp;
if (y <= -1.96e+163) {
tmp = t_0;
} else if (y <= -150.0) {
tmp = (x * (0.008333333333333333 * Math.pow(y, 5.0))) / y;
} else if (y <= 4.5e+57) {
tmp = Math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1.35e+154) {
tmp = x + (x * (0.008333333333333333 * Math.pow(y, 4.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (math.sin(x) * (y * y)) tmp = 0 if y <= -1.96e+163: tmp = t_0 elif y <= -150.0: tmp = (x * (0.008333333333333333 * math.pow(y, 5.0))) / y elif y <= 4.5e+57: tmp = math.sin(x) * (1.0 + (0.16666666666666666 * (y * y))) elif y <= 1.35e+154: tmp = x + (x * (0.008333333333333333 * math.pow(y, 4.0))) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(sin(x) * Float64(y * y))) tmp = 0.0 if (y <= -1.96e+163) tmp = t_0; elseif (y <= -150.0) tmp = Float64(Float64(x * Float64(0.008333333333333333 * (y ^ 5.0))) / y); elseif (y <= 4.5e+57) tmp = Float64(sin(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); elseif (y <= 1.35e+154) tmp = Float64(x + Float64(x * Float64(0.008333333333333333 * (y ^ 4.0)))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (sin(x) * (y * y)); tmp = 0.0; if (y <= -1.96e+163) tmp = t_0; elseif (y <= -150.0) tmp = (x * (0.008333333333333333 * (y ^ 5.0))) / y; elseif (y <= 4.5e+57) tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y))); elseif (y <= 1.35e+154) tmp = x + (x * (0.008333333333333333 * (y ^ 4.0))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(N[Sin[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.96e+163], t$95$0, If[LessEqual[y, -150.0], N[(N[(x * N[(0.008333333333333333 * N[Power[y, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 4.5e+57], N[(N[Sin[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(x + N[(x * N[(0.008333333333333333 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\
\mathbf{if}\;y \leq -1.96 \cdot 10^{+163}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -150:\\
\;\;\;\;\frac{x \cdot \left(0.008333333333333333 \cdot {y}^{5}\right)}{y}\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+57}:\\
\;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x + x \cdot \left(0.008333333333333333 \cdot {y}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.96000000000000013e163 or 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
if -1.96000000000000013e163 < y < -150Initial program 100.0%
Taylor expanded in y around 0 60.2%
Taylor expanded in x around 0 57.1%
Taylor expanded in y around inf 57.1%
associate-*r*57.1%
*-commutative57.1%
Simplified57.1%
if -150 < y < 4.49999999999999996e57Initial program 100.0%
Taylor expanded in y around 0 93.1%
Taylor expanded in y around 0 93.0%
unpow293.0%
Simplified93.0%
if 4.49999999999999996e57 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 100.0%
fma-def100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 68.8%
*-commutative68.8%
+-commutative68.8%
associate-+r+68.8%
unpow268.8%
distribute-rgt-in68.8%
+-commutative68.8%
distribute-lft1-in68.8%
associate-*r*68.8%
associate-*r*68.8%
unpow268.8%
+-commutative68.8%
associate-+l+68.8%
+-commutative68.8%
Simplified68.8%
Taylor expanded in y around inf 68.8%
Final simplification87.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* (sin x) (* y y))))
(t_1 (* 0.008333333333333333 (* x (pow y 4.0)))))
(if (<= y -2e+163)
t_0
(if (<= y -122.0)
t_1
(if (<= y 4.5e+57) (sin x) (if (<= y 1.35e+154) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (sin(x) * (y * y));
double t_1 = 0.008333333333333333 * (x * pow(y, 4.0));
double tmp;
if (y <= -2e+163) {
tmp = t_0;
} else if (y <= -122.0) {
tmp = t_1;
} else if (y <= 4.5e+57) {
tmp = sin(x);
} else if (y <= 1.35e+154) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_0 = 0.16666666666666666d0 * (sin(x) * (y * y))
t_1 = 0.008333333333333333d0 * (x * (y ** 4.0d0))
if (y <= (-2d+163)) then
tmp = t_0
else if (y <= (-122.0d0)) then
tmp = t_1
else if (y <= 4.5d+57) then
tmp = sin(x)
else if (y <= 1.35d+154) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.16666666666666666 * (Math.sin(x) * (y * y));
double t_1 = 0.008333333333333333 * (x * Math.pow(y, 4.0));
double tmp;
if (y <= -2e+163) {
tmp = t_0;
} else if (y <= -122.0) {
tmp = t_1;
} else if (y <= 4.5e+57) {
tmp = Math.sin(x);
} else if (y <= 1.35e+154) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (math.sin(x) * (y * y)) t_1 = 0.008333333333333333 * (x * math.pow(y, 4.0)) tmp = 0 if y <= -2e+163: tmp = t_0 elif y <= -122.0: tmp = t_1 elif y <= 4.5e+57: tmp = math.sin(x) elif y <= 1.35e+154: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(sin(x) * Float64(y * y))) t_1 = Float64(0.008333333333333333 * Float64(x * (y ^ 4.0))) tmp = 0.0 if (y <= -2e+163) tmp = t_0; elseif (y <= -122.0) tmp = t_1; elseif (y <= 4.5e+57) tmp = sin(x); elseif (y <= 1.35e+154) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (sin(x) * (y * y)); t_1 = 0.008333333333333333 * (x * (y ^ 4.0)); tmp = 0.0; if (y <= -2e+163) tmp = t_0; elseif (y <= -122.0) tmp = t_1; elseif (y <= 4.5e+57) tmp = sin(x); elseif (y <= 1.35e+154) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(N[Sin[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.008333333333333333 * N[(x * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2e+163], t$95$0, If[LessEqual[y, -122.0], t$95$1, If[LessEqual[y, 4.5e+57], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.35e+154], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\
t_1 := 0.008333333333333333 \cdot \left(x \cdot {y}^{4}\right)\\
\mathbf{if}\;y \leq -2 \cdot 10^{+163}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -122:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+57}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.9999999999999999e163 or 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
if -1.9999999999999999e163 < y < -122 or 4.49999999999999996e57 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0 71.4%
Taylor expanded in x around 0 60.4%
Taylor expanded in y around inf 58.8%
if -122 < y < 4.49999999999999996e57Initial program 100.0%
Taylor expanded in y around 0 93.1%
Taylor expanded in y around 0 92.6%
Final simplification87.2%
(FPCore (x y) :precision binary64 (if (or (<= y -150.0) (not (<= y 4.5e+57))) (* 0.008333333333333333 (* x (pow y 4.0))) (sin x)))
double code(double x, double y) {
double tmp;
if ((y <= -150.0) || !(y <= 4.5e+57)) {
tmp = 0.008333333333333333 * (x * pow(y, 4.0));
} else {
tmp = sin(x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-150.0d0)) .or. (.not. (y <= 4.5d+57))) then
tmp = 0.008333333333333333d0 * (x * (y ** 4.0d0))
else
tmp = sin(x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -150.0) || !(y <= 4.5e+57)) {
tmp = 0.008333333333333333 * (x * Math.pow(y, 4.0));
} else {
tmp = Math.sin(x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -150.0) or not (y <= 4.5e+57): tmp = 0.008333333333333333 * (x * math.pow(y, 4.0)) else: tmp = math.sin(x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -150.0) || !(y <= 4.5e+57)) tmp = Float64(0.008333333333333333 * Float64(x * (y ^ 4.0))); else tmp = sin(x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -150.0) || ~((y <= 4.5e+57))) tmp = 0.008333333333333333 * (x * (y ^ 4.0)); else tmp = sin(x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -150.0], N[Not[LessEqual[y, 4.5e+57]], $MachinePrecision]], N[(0.008333333333333333 * N[(x * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[x], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -150 \lor \neg \left(y \leq 4.5 \cdot 10^{+57}\right):\\
\;\;\;\;0.008333333333333333 \cdot \left(x \cdot {y}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin x\\
\end{array}
\end{array}
if y < -150 or 4.49999999999999996e57 < y Initial program 100.0%
Taylor expanded in y around 0 87.5%
Taylor expanded in x around 0 71.3%
Taylor expanded in y around inf 70.6%
if -150 < y < 4.49999999999999996e57Initial program 100.0%
Taylor expanded in y around 0 93.1%
Taylor expanded in y around 0 92.6%
Final simplification81.4%
(FPCore (x y) :precision binary64 (if (or (<= y -0.00011) (not (<= y 3.4e+82))) (+ x (* x (* y (* y 0.16666666666666666)))) (sin x)))
double code(double x, double y) {
double tmp;
if ((y <= -0.00011) || !(y <= 3.4e+82)) {
tmp = x + (x * (y * (y * 0.16666666666666666)));
} else {
tmp = sin(x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-0.00011d0)) .or. (.not. (y <= 3.4d+82))) then
tmp = x + (x * (y * (y * 0.16666666666666666d0)))
else
tmp = sin(x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -0.00011) || !(y <= 3.4e+82)) {
tmp = x + (x * (y * (y * 0.16666666666666666)));
} else {
tmp = Math.sin(x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -0.00011) or not (y <= 3.4e+82): tmp = x + (x * (y * (y * 0.16666666666666666))) else: tmp = math.sin(x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -0.00011) || !(y <= 3.4e+82)) tmp = Float64(x + Float64(x * Float64(y * Float64(y * 0.16666666666666666)))); else tmp = sin(x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -0.00011) || ~((y <= 3.4e+82))) tmp = x + (x * (y * (y * 0.16666666666666666))); else tmp = sin(x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -0.00011], N[Not[LessEqual[y, 3.4e+82]], $MachinePrecision]], N[(x + N[(x * N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[x], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00011 \lor \neg \left(y \leq 3.4 \cdot 10^{+82}\right):\\
\;\;\;\;x + x \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin x\\
\end{array}
\end{array}
if y < -1.10000000000000004e-4 or 3.39999999999999994e82 < y Initial program 100.0%
Taylor expanded in y around 0 87.3%
Taylor expanded in y around 0 62.3%
unpow262.3%
Simplified62.3%
Taylor expanded in x around 0 56.9%
+-commutative56.9%
unpow256.9%
fma-udef56.9%
Simplified56.9%
*-commutative56.9%
fma-udef56.9%
distribute-rgt-in56.9%
*-commutative56.9%
associate-*r*56.9%
*-un-lft-identity56.9%
Applied egg-rr56.9%
if -1.10000000000000004e-4 < y < 3.39999999999999994e82Initial program 100.0%
Taylor expanded in y around 0 93.2%
Taylor expanded in y around 0 90.8%
Final simplification73.7%
(FPCore (x y) :precision binary64 (if (or (<= y -2.5) (not (<= y 2.5))) (* 0.16666666666666666 (* x (* y y))) x))
double code(double x, double y) {
double tmp;
if ((y <= -2.5) || !(y <= 2.5)) {
tmp = 0.16666666666666666 * (x * (y * y));
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-2.5d0)) .or. (.not. (y <= 2.5d0))) then
tmp = 0.16666666666666666d0 * (x * (y * y))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -2.5) || !(y <= 2.5)) {
tmp = 0.16666666666666666 * (x * (y * y));
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -2.5) or not (y <= 2.5): tmp = 0.16666666666666666 * (x * (y * y)) else: tmp = x return tmp
function code(x, y) tmp = 0.0 if ((y <= -2.5) || !(y <= 2.5)) tmp = Float64(0.16666666666666666 * Float64(x * Float64(y * y))); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -2.5) || ~((y <= 2.5))) tmp = 0.16666666666666666 * (x * (y * y)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -2.5], N[Not[LessEqual[y, 2.5]], $MachinePrecision]], N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \lor \neg \left(y \leq 2.5\right):\\
\;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.5 or 2.5 < y Initial program 100.0%
Taylor expanded in y around 0 82.2%
Taylor expanded in y around 0 57.0%
unpow257.0%
Simplified57.0%
Taylor expanded in x around 0 51.9%
+-commutative51.9%
unpow251.9%
fma-udef51.9%
Simplified51.9%
Taylor expanded in y around inf 51.9%
unpow251.9%
Simplified51.9%
if -2.5 < y < 2.5Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 29.1%
Taylor expanded in y around 0 51.6%
Final simplification51.7%
(FPCore (x y) :precision binary64 (if (or (<= x -2.3e+138) (not (<= x 1.02e-35))) (/ (* x y) y) x))
double code(double x, double y) {
double tmp;
if ((x <= -2.3e+138) || !(x <= 1.02e-35)) {
tmp = (x * y) / y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-2.3d+138)) .or. (.not. (x <= 1.02d-35))) then
tmp = (x * y) / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -2.3e+138) || !(x <= 1.02e-35)) {
tmp = (x * y) / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -2.3e+138) or not (x <= 1.02e-35): tmp = (x * y) / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if ((x <= -2.3e+138) || !(x <= 1.02e-35)) tmp = Float64(Float64(x * y) / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -2.3e+138) || ~((x <= 1.02e-35))) tmp = (x * y) / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -2.3e+138], N[Not[LessEqual[x, 1.02e-35]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] / y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+138} \lor \neg \left(x \leq 1.02 \cdot 10^{-35}\right):\\
\;\;\;\;\frac{x \cdot y}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.30000000000000008e138 or 1.01999999999999995e-35 < x Initial program 100.0%
Taylor expanded in y around 0 91.8%
Taylor expanded in x around 0 34.3%
Taylor expanded in y around 0 21.5%
if -2.30000000000000008e138 < x < 1.01999999999999995e-35Initial program 100.0%
Taylor expanded in y around 0 89.2%
Taylor expanded in x around 0 60.4%
Taylor expanded in y around 0 38.3%
Final simplification31.4%
(FPCore (x y) :precision binary64 (+ x (* x (* y (* y 0.16666666666666666)))))
double code(double x, double y) {
return x + (x * (y * (y * 0.16666666666666666)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x + (x * (y * (y * 0.16666666666666666d0)))
end function
public static double code(double x, double y) {
return x + (x * (y * (y * 0.16666666666666666)));
}
def code(x, y): return x + (x * (y * (y * 0.16666666666666666)))
function code(x, y) return Float64(x + Float64(x * Float64(y * Float64(y * 0.16666666666666666)))) end
function tmp = code(x, y) tmp = x + (x * (y * (y * 0.16666666666666666))); end
code[x_, y_] := N[(x + N[(x * N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + x \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 90.3%
Taylor expanded in y around 0 76.5%
unpow276.5%
Simplified76.5%
Taylor expanded in x around 0 51.9%
+-commutative51.9%
unpow251.9%
fma-udef51.9%
Simplified51.9%
*-commutative51.9%
fma-udef51.9%
distribute-rgt-in51.9%
*-commutative51.9%
associate-*r*51.9%
*-un-lft-identity51.9%
Applied egg-rr51.9%
Final simplification51.9%
(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%
Taylor expanded in y around 0 90.3%
Taylor expanded in x around 0 49.7%
Taylor expanded in y around 0 24.8%
Final simplification24.8%
herbie shell --seed 2023196
(FPCore (x y)
:name "Linear.Quaternion:$ccos from linear-1.19.1.3"
:precision binary64
(* (sin x) (/ (sinh y) y)))