
(FPCore (x y) :precision binary64 (/ (* (sin x) (sinh y)) x))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(x) * sinh(y)) / x
end function
public static double code(double x, double y) {
return (Math.sin(x) * Math.sinh(y)) / x;
}
def code(x, y): return (math.sin(x) * math.sinh(y)) / x
function code(x, y) return Float64(Float64(sin(x) * sinh(y)) / x) end
function tmp = code(x, y) tmp = (sin(x) * sinh(y)) / x; end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x \cdot \sinh y}{x}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* (sin x) (sinh y)) x))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(x) * sinh(y)) / x
end function
public static double code(double x, double y) {
return (Math.sin(x) * Math.sinh(y)) / x;
}
def code(x, y): return (math.sin(x) * math.sinh(y)) / x
function code(x, y) return Float64(Float64(sin(x) * sinh(y)) / x) end
function tmp = code(x, y) tmp = (sin(x) * sinh(y)) / x; end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x \cdot \sinh y}{x}
\end{array}
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) x)))
double code(double x, double y) {
return sin(x) * (sinh(y) / x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / x)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / x);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / x)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / x)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / x); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{x}
\end{array}
Initial program 88.8%
associate-*r/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (or (<= y -490.0) (not (<= y 700.0))) (log1p (expm1 y)) (/ y (/ x (sin x)))))
double code(double x, double y) {
double tmp;
if ((y <= -490.0) || !(y <= 700.0)) {
tmp = log1p(expm1(y));
} else {
tmp = y / (x / sin(x));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if ((y <= -490.0) || !(y <= 700.0)) {
tmp = Math.log1p(Math.expm1(y));
} else {
tmp = y / (x / Math.sin(x));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -490.0) or not (y <= 700.0): tmp = math.log1p(math.expm1(y)) else: tmp = y / (x / math.sin(x)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -490.0) || !(y <= 700.0)) tmp = log1p(expm1(y)); else tmp = Float64(y / Float64(x / sin(x))); end return tmp end
code[x_, y_] := If[Or[LessEqual[y, -490.0], N[Not[LessEqual[y, 700.0]], $MachinePrecision]], N[Log[1 + N[(Exp[y] - 1), $MachinePrecision]], $MachinePrecision], N[(y / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -490 \lor \neg \left(y \leq 700\right):\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\end{array}
\end{array}
if y < -490 or 700 < y Initial program 100.0%
Taylor expanded in y around 0 4.4%
Taylor expanded in x around 0 15.6%
div-inv15.6%
associate-*l*4.0%
div-inv4.0%
*-inverses4.0%
*-commutative4.0%
*-un-lft-identity4.0%
log1p-expm1-u69.4%
Applied egg-rr69.4%
if -490 < y < 700Initial program 80.2%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 78.3%
associate-/l*98.0%
Simplified98.0%
Final simplification85.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* y (* x (* x -0.16666666666666666))))
(t_1 (+ y (* (* y -0.16666666666666666) (* x x)))))
(if (<= y -9.6e+240)
t_1
(if (<= y -4.2e+124)
(/ (- (* t_0 t_0) (* y y)) (- t_0 y))
(if (<= y -5e+16)
t_1
(if (<= y 8.2e+148) (* (sin x) (/ y x)) (sqrt (* y y))))))))
double code(double x, double y) {
double t_0 = y * (x * (x * -0.16666666666666666));
double t_1 = y + ((y * -0.16666666666666666) * (x * x));
double tmp;
if (y <= -9.6e+240) {
tmp = t_1;
} else if (y <= -4.2e+124) {
tmp = ((t_0 * t_0) - (y * y)) / (t_0 - y);
} else if (y <= -5e+16) {
tmp = t_1;
} else if (y <= 8.2e+148) {
tmp = sin(x) * (y / x);
} else {
tmp = sqrt((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) :: t_1
real(8) :: tmp
t_0 = y * (x * (x * (-0.16666666666666666d0)))
t_1 = y + ((y * (-0.16666666666666666d0)) * (x * x))
if (y <= (-9.6d+240)) then
tmp = t_1
else if (y <= (-4.2d+124)) then
tmp = ((t_0 * t_0) - (y * y)) / (t_0 - y)
else if (y <= (-5d+16)) then
tmp = t_1
else if (y <= 8.2d+148) then
tmp = sin(x) * (y / x)
else
tmp = sqrt((y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y * (x * (x * -0.16666666666666666));
double t_1 = y + ((y * -0.16666666666666666) * (x * x));
double tmp;
if (y <= -9.6e+240) {
tmp = t_1;
} else if (y <= -4.2e+124) {
tmp = ((t_0 * t_0) - (y * y)) / (t_0 - y);
} else if (y <= -5e+16) {
tmp = t_1;
} else if (y <= 8.2e+148) {
tmp = Math.sin(x) * (y / x);
} else {
tmp = Math.sqrt((y * y));
}
return tmp;
}
def code(x, y): t_0 = y * (x * (x * -0.16666666666666666)) t_1 = y + ((y * -0.16666666666666666) * (x * x)) tmp = 0 if y <= -9.6e+240: tmp = t_1 elif y <= -4.2e+124: tmp = ((t_0 * t_0) - (y * y)) / (t_0 - y) elif y <= -5e+16: tmp = t_1 elif y <= 8.2e+148: tmp = math.sin(x) * (y / x) else: tmp = math.sqrt((y * y)) return tmp
function code(x, y) t_0 = Float64(y * Float64(x * Float64(x * -0.16666666666666666))) t_1 = Float64(y + Float64(Float64(y * -0.16666666666666666) * Float64(x * x))) tmp = 0.0 if (y <= -9.6e+240) tmp = t_1; elseif (y <= -4.2e+124) tmp = Float64(Float64(Float64(t_0 * t_0) - Float64(y * y)) / Float64(t_0 - y)); elseif (y <= -5e+16) tmp = t_1; elseif (y <= 8.2e+148) tmp = Float64(sin(x) * Float64(y / x)); else tmp = sqrt(Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) t_0 = y * (x * (x * -0.16666666666666666)); t_1 = y + ((y * -0.16666666666666666) * (x * x)); tmp = 0.0; if (y <= -9.6e+240) tmp = t_1; elseif (y <= -4.2e+124) tmp = ((t_0 * t_0) - (y * y)) / (t_0 - y); elseif (y <= -5e+16) tmp = t_1; elseif (y <= 8.2e+148) tmp = sin(x) * (y / x); else tmp = sqrt((y * y)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(x * N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y + N[(N[(y * -0.16666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.6e+240], t$95$1, If[LessEqual[y, -4.2e+124], N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(y * y), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -5e+16], t$95$1, If[LessEqual[y, 8.2e+148], N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(y * y), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(x \cdot \left(x \cdot -0.16666666666666666\right)\right)\\
t_1 := y + \left(y \cdot -0.16666666666666666\right) \cdot \left(x \cdot x\right)\\
\mathbf{if}\;y \leq -9.6 \cdot 10^{+240}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -4.2 \cdot 10^{+124}:\\
\;\;\;\;\frac{t_0 \cdot t_0 - y \cdot y}{t_0 - y}\\
\mathbf{elif}\;y \leq -5 \cdot 10^{+16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+148}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{y \cdot y}\\
\end{array}
\end{array}
if y < -9.5999999999999995e240 or -4.20000000000000023e124 < y < -5e16Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.2%
associate-/l*4.2%
Simplified4.2%
Taylor expanded in x around 0 40.5%
associate-*r*40.5%
*-commutative40.5%
unpow240.5%
Simplified40.5%
if -9.5999999999999995e240 < y < -4.20000000000000023e124Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.3%
associate-/l*4.3%
Simplified4.3%
Taylor expanded in x around 0 25.8%
+-commutative25.8%
remove-double-neg25.8%
unsub-neg25.8%
associate-*r*25.8%
*-commutative25.8%
associate-*l*25.8%
fma-neg25.8%
unpow225.8%
remove-double-neg25.8%
Simplified25.8%
fma-udef25.8%
flip-+41.7%
*-commutative41.7%
associate-*l*41.7%
*-commutative41.7%
associate-*l*41.7%
*-commutative41.7%
associate-*l*41.7%
Applied egg-rr41.7%
if -5e16 < y < 8.1999999999999996e148Initial program 83.2%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 66.9%
associate-/l*83.6%
associate-/r/85.8%
Simplified85.8%
if 8.1999999999999996e148 < y Initial program 100.0%
Taylor expanded in y around 0 5.9%
Taylor expanded in x around 0 21.3%
div-inv21.3%
associate-*l*6.2%
div-inv6.2%
*-inverses6.2%
*-commutative6.2%
*-un-lft-identity6.2%
add-sqr-sqrt6.2%
sqrt-unprod75.2%
Applied egg-rr75.2%
Final simplification74.1%
(FPCore (x y) :precision binary64 (if (or (<= y -0.0052) (not (<= y 3.2e+94))) (+ y (* (pow y 3.0) 0.16666666666666666)) (* (sin x) (/ y x))))
double code(double x, double y) {
double tmp;
if ((y <= -0.0052) || !(y <= 3.2e+94)) {
tmp = y + (pow(y, 3.0) * 0.16666666666666666);
} else {
tmp = sin(x) * (y / 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.0052d0)) .or. (.not. (y <= 3.2d+94))) then
tmp = y + ((y ** 3.0d0) * 0.16666666666666666d0)
else
tmp = sin(x) * (y / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -0.0052) || !(y <= 3.2e+94)) {
tmp = y + (Math.pow(y, 3.0) * 0.16666666666666666);
} else {
tmp = Math.sin(x) * (y / x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -0.0052) or not (y <= 3.2e+94): tmp = y + (math.pow(y, 3.0) * 0.16666666666666666) else: tmp = math.sin(x) * (y / x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -0.0052) || !(y <= 3.2e+94)) tmp = Float64(y + Float64((y ^ 3.0) * 0.16666666666666666)); else tmp = Float64(sin(x) * Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -0.0052) || ~((y <= 3.2e+94))) tmp = y + ((y ^ 3.0) * 0.16666666666666666); else tmp = sin(x) * (y / x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -0.0052], N[Not[LessEqual[y, 3.2e+94]], $MachinePrecision]], N[(y + N[(N[Power[y, 3.0], $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision], N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0052 \lor \neg \left(y \leq 3.2 \cdot 10^{+94}\right):\\
\;\;\;\;y + {y}^{3} \cdot 0.16666666666666666\\
\mathbf{else}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\end{array}
\end{array}
if y < -0.0051999999999999998 or 3.20000000000000014e94 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 84.5%
fma-def84.5%
associate-/l*84.5%
associate-/l*84.5%
Simplified84.5%
Taylor expanded in x around 0 57.1%
*-commutative57.1%
Simplified57.1%
if -0.0051999999999999998 < y < 3.20000000000000014e94Initial program 81.7%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 72.2%
associate-/l*90.4%
associate-/r/90.9%
Simplified90.9%
Final simplification77.8%
(FPCore (x y) :precision binary64 (if (<= x 0.24) (* x (/ y x)) (sqrt (* y y))))
double code(double x, double y) {
double tmp;
if (x <= 0.24) {
tmp = x * (y / x);
} else {
tmp = sqrt((y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 0.24d0) then
tmp = x * (y / x)
else
tmp = sqrt((y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 0.24) {
tmp = x * (y / x);
} else {
tmp = Math.sqrt((y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.24: tmp = x * (y / x) else: tmp = math.sqrt((y * y)) return tmp
function code(x, y) tmp = 0.0 if (x <= 0.24) tmp = Float64(x * Float64(y / x)); else tmp = sqrt(Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 0.24) tmp = x * (y / x); else tmp = sqrt((y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.24], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(y * y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.24:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{y \cdot y}\\
\end{array}
\end{array}
if x < 0.23999999999999999Initial program 86.1%
Taylor expanded in y around 0 42.2%
Taylor expanded in x around 0 28.9%
associate-/l*38.2%
associate-/r/59.5%
Applied egg-rr59.5%
if 0.23999999999999999 < x Initial program 99.8%
Taylor expanded in y around 0 63.0%
Taylor expanded in x around 0 12.5%
div-inv12.5%
associate-*l*5.0%
div-inv5.0%
*-inverses5.0%
*-commutative5.0%
*-un-lft-identity5.0%
add-sqr-sqrt2.3%
sqrt-unprod37.0%
Applied egg-rr37.0%
Final simplification55.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* y (* x (* x -0.16666666666666666))))
(t_1 (+ y (* (* y -0.16666666666666666) (* x x))))
(t_2 (- t_0 y)))
(if (<= y -3.6e+240)
t_1
(if (<= y -4.2e+124)
(/ (- (* t_0 t_0) (* y y)) t_2)
(if (<= y -5e+16)
t_1
(if (<= y 9.2e+117) (/ x (/ x y)) (/ (* y (- y)) t_2)))))))
double code(double x, double y) {
double t_0 = y * (x * (x * -0.16666666666666666));
double t_1 = y + ((y * -0.16666666666666666) * (x * x));
double t_2 = t_0 - y;
double tmp;
if (y <= -3.6e+240) {
tmp = t_1;
} else if (y <= -4.2e+124) {
tmp = ((t_0 * t_0) - (y * y)) / t_2;
} else if (y <= -5e+16) {
tmp = t_1;
} else if (y <= 9.2e+117) {
tmp = x / (x / y);
} else {
tmp = (y * -y) / t_2;
}
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) :: t_2
real(8) :: tmp
t_0 = y * (x * (x * (-0.16666666666666666d0)))
t_1 = y + ((y * (-0.16666666666666666d0)) * (x * x))
t_2 = t_0 - y
if (y <= (-3.6d+240)) then
tmp = t_1
else if (y <= (-4.2d+124)) then
tmp = ((t_0 * t_0) - (y * y)) / t_2
else if (y <= (-5d+16)) then
tmp = t_1
else if (y <= 9.2d+117) then
tmp = x / (x / y)
else
tmp = (y * -y) / t_2
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y * (x * (x * -0.16666666666666666));
double t_1 = y + ((y * -0.16666666666666666) * (x * x));
double t_2 = t_0 - y;
double tmp;
if (y <= -3.6e+240) {
tmp = t_1;
} else if (y <= -4.2e+124) {
tmp = ((t_0 * t_0) - (y * y)) / t_2;
} else if (y <= -5e+16) {
tmp = t_1;
} else if (y <= 9.2e+117) {
tmp = x / (x / y);
} else {
tmp = (y * -y) / t_2;
}
return tmp;
}
def code(x, y): t_0 = y * (x * (x * -0.16666666666666666)) t_1 = y + ((y * -0.16666666666666666) * (x * x)) t_2 = t_0 - y tmp = 0 if y <= -3.6e+240: tmp = t_1 elif y <= -4.2e+124: tmp = ((t_0 * t_0) - (y * y)) / t_2 elif y <= -5e+16: tmp = t_1 elif y <= 9.2e+117: tmp = x / (x / y) else: tmp = (y * -y) / t_2 return tmp
function code(x, y) t_0 = Float64(y * Float64(x * Float64(x * -0.16666666666666666))) t_1 = Float64(y + Float64(Float64(y * -0.16666666666666666) * Float64(x * x))) t_2 = Float64(t_0 - y) tmp = 0.0 if (y <= -3.6e+240) tmp = t_1; elseif (y <= -4.2e+124) tmp = Float64(Float64(Float64(t_0 * t_0) - Float64(y * y)) / t_2); elseif (y <= -5e+16) tmp = t_1; elseif (y <= 9.2e+117) tmp = Float64(x / Float64(x / y)); else tmp = Float64(Float64(y * Float64(-y)) / t_2); end return tmp end
function tmp_2 = code(x, y) t_0 = y * (x * (x * -0.16666666666666666)); t_1 = y + ((y * -0.16666666666666666) * (x * x)); t_2 = t_0 - y; tmp = 0.0; if (y <= -3.6e+240) tmp = t_1; elseif (y <= -4.2e+124) tmp = ((t_0 * t_0) - (y * y)) / t_2; elseif (y <= -5e+16) tmp = t_1; elseif (y <= 9.2e+117) tmp = x / (x / y); else tmp = (y * -y) / t_2; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(x * N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y + N[(N[(y * -0.16666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - y), $MachinePrecision]}, If[LessEqual[y, -3.6e+240], t$95$1, If[LessEqual[y, -4.2e+124], N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(y * y), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[y, -5e+16], t$95$1, If[LessEqual[y, 9.2e+117], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(y * (-y)), $MachinePrecision] / t$95$2), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(x \cdot \left(x \cdot -0.16666666666666666\right)\right)\\
t_1 := y + \left(y \cdot -0.16666666666666666\right) \cdot \left(x \cdot x\right)\\
t_2 := t_0 - y\\
\mathbf{if}\;y \leq -3.6 \cdot 10^{+240}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -4.2 \cdot 10^{+124}:\\
\;\;\;\;\frac{t_0 \cdot t_0 - y \cdot y}{t_2}\\
\mathbf{elif}\;y \leq -5 \cdot 10^{+16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{+117}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(-y\right)}{t_2}\\
\end{array}
\end{array}
if y < -3.5999999999999998e240 or -4.20000000000000023e124 < y < -5e16Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.2%
associate-/l*4.2%
Simplified4.2%
Taylor expanded in x around 0 40.5%
associate-*r*40.5%
*-commutative40.5%
unpow240.5%
Simplified40.5%
if -3.5999999999999998e240 < y < -4.20000000000000023e124Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.3%
associate-/l*4.3%
Simplified4.3%
Taylor expanded in x around 0 25.8%
+-commutative25.8%
remove-double-neg25.8%
unsub-neg25.8%
associate-*r*25.8%
*-commutative25.8%
associate-*l*25.8%
fma-neg25.8%
unpow225.8%
remove-double-neg25.8%
Simplified25.8%
fma-udef25.8%
flip-+41.7%
*-commutative41.7%
associate-*l*41.7%
*-commutative41.7%
associate-*l*41.7%
*-commutative41.7%
associate-*l*41.7%
Applied egg-rr41.7%
if -5e16 < y < 9.19999999999999951e117Initial program 82.9%
Taylor expanded in y around 0 68.0%
Taylor expanded in x around 0 29.8%
associate-/l*46.2%
associate-/r/68.4%
Applied egg-rr68.4%
*-commutative68.4%
clear-num70.3%
un-div-inv69.2%
Applied egg-rr69.2%
if 9.19999999999999951e117 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 5.6%
associate-/l*5.6%
Simplified5.6%
Taylor expanded in x around 0 29.5%
+-commutative29.5%
remove-double-neg29.5%
unsub-neg29.5%
associate-*r*29.5%
*-commutative29.5%
associate-*l*29.5%
fma-neg29.5%
unpow229.5%
remove-double-neg29.5%
Simplified29.5%
fma-udef29.5%
flip-+33.7%
*-commutative33.7%
associate-*l*33.7%
*-commutative33.7%
associate-*l*33.7%
*-commutative33.7%
associate-*l*33.7%
Applied egg-rr33.7%
Taylor expanded in x around 0 52.3%
unpow252.3%
mul-1-neg52.3%
distribute-rgt-neg-out52.3%
Simplified52.3%
Final simplification60.7%
(FPCore (x y)
:precision binary64
(if (<= y -5e+16)
(+ y (* (* y -0.16666666666666666) (* x x)))
(if (<= y 9.2e+117)
(/ x (/ x y))
(/ (* y (- y)) (- (* y (* x (* x -0.16666666666666666))) y)))))
double code(double x, double y) {
double tmp;
if (y <= -5e+16) {
tmp = y + ((y * -0.16666666666666666) * (x * x));
} else if (y <= 9.2e+117) {
tmp = x / (x / y);
} else {
tmp = (y * -y) / ((y * (x * (x * -0.16666666666666666))) - 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+16)) then
tmp = y + ((y * (-0.16666666666666666d0)) * (x * x))
else if (y <= 9.2d+117) then
tmp = x / (x / y)
else
tmp = (y * -y) / ((y * (x * (x * (-0.16666666666666666d0)))) - y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5e+16) {
tmp = y + ((y * -0.16666666666666666) * (x * x));
} else if (y <= 9.2e+117) {
tmp = x / (x / y);
} else {
tmp = (y * -y) / ((y * (x * (x * -0.16666666666666666))) - y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5e+16: tmp = y + ((y * -0.16666666666666666) * (x * x)) elif y <= 9.2e+117: tmp = x / (x / y) else: tmp = (y * -y) / ((y * (x * (x * -0.16666666666666666))) - y) return tmp
function code(x, y) tmp = 0.0 if (y <= -5e+16) tmp = Float64(y + Float64(Float64(y * -0.16666666666666666) * Float64(x * x))); elseif (y <= 9.2e+117) tmp = Float64(x / Float64(x / y)); else tmp = Float64(Float64(y * Float64(-y)) / Float64(Float64(y * Float64(x * Float64(x * -0.16666666666666666))) - y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5e+16) tmp = y + ((y * -0.16666666666666666) * (x * x)); elseif (y <= 9.2e+117) tmp = x / (x / y); else tmp = (y * -y) / ((y * (x * (x * -0.16666666666666666))) - y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5e+16], N[(y + N[(N[(y * -0.16666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.2e+117], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(y * (-y)), $MachinePrecision] / N[(N[(y * N[(x * N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+16}:\\
\;\;\;\;y + \left(y \cdot -0.16666666666666666\right) \cdot \left(x \cdot x\right)\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{+117}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(-y\right)}{y \cdot \left(x \cdot \left(x \cdot -0.16666666666666666\right)\right) - y}\\
\end{array}
\end{array}
if y < -5e16Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.3%
associate-/l*4.3%
Simplified4.3%
Taylor expanded in x around 0 34.0%
associate-*r*34.0%
*-commutative34.0%
unpow234.0%
Simplified34.0%
if -5e16 < y < 9.19999999999999951e117Initial program 82.9%
Taylor expanded in y around 0 68.0%
Taylor expanded in x around 0 29.8%
associate-/l*46.2%
associate-/r/68.4%
Applied egg-rr68.4%
*-commutative68.4%
clear-num70.3%
un-div-inv69.2%
Applied egg-rr69.2%
if 9.19999999999999951e117 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 5.6%
associate-/l*5.6%
Simplified5.6%
Taylor expanded in x around 0 29.5%
+-commutative29.5%
remove-double-neg29.5%
unsub-neg29.5%
associate-*r*29.5%
*-commutative29.5%
associate-*l*29.5%
fma-neg29.5%
unpow229.5%
remove-double-neg29.5%
Simplified29.5%
fma-udef29.5%
flip-+33.7%
*-commutative33.7%
associate-*l*33.7%
*-commutative33.7%
associate-*l*33.7%
*-commutative33.7%
associate-*l*33.7%
Applied egg-rr33.7%
Taylor expanded in x around 0 52.3%
unpow252.3%
mul-1-neg52.3%
distribute-rgt-neg-out52.3%
Simplified52.3%
Final simplification59.0%
(FPCore (x y) :precision binary64 (if (<= y -5.6e+16) (+ y (* (* y -0.16666666666666666) (* x x))) (/ x (/ x y))))
double code(double x, double y) {
double tmp;
if (y <= -5.6e+16) {
tmp = y + ((y * -0.16666666666666666) * (x * x));
} else {
tmp = x / (x / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-5.6d+16)) then
tmp = y + ((y * (-0.16666666666666666d0)) * (x * x))
else
tmp = x / (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.6e+16) {
tmp = y + ((y * -0.16666666666666666) * (x * x));
} else {
tmp = x / (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.6e+16: tmp = y + ((y * -0.16666666666666666) * (x * x)) else: tmp = x / (x / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -5.6e+16) tmp = Float64(y + Float64(Float64(y * -0.16666666666666666) * Float64(x * x))); else tmp = Float64(x / Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.6e+16) tmp = y + ((y * -0.16666666666666666) * (x * x)); else tmp = x / (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.6e+16], N[(y + N[(N[(y * -0.16666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.6 \cdot 10^{+16}:\\
\;\;\;\;y + \left(y \cdot -0.16666666666666666\right) \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\end{array}
\end{array}
if y < -5.6e16Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.3%
associate-/l*4.3%
Simplified4.3%
Taylor expanded in x around 0 34.0%
associate-*r*34.0%
*-commutative34.0%
unpow234.0%
Simplified34.0%
if -5.6e16 < y Initial program 85.3%
Taylor expanded in y around 0 59.4%
Taylor expanded in x around 0 28.3%
associate-/l*40.6%
associate-/r/63.9%
Applied egg-rr63.9%
*-commutative63.9%
clear-num65.6%
un-div-inv64.7%
Applied egg-rr64.7%
Final simplification57.4%
(FPCore (x y) :precision binary64 (if (<= y -5e+16) (* -0.16666666666666666 (* y (* x x))) (/ x (/ x y))))
double code(double x, double y) {
double tmp;
if (y <= -5e+16) {
tmp = -0.16666666666666666 * (y * (x * x));
} else {
tmp = x / (x / 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+16)) then
tmp = (-0.16666666666666666d0) * (y * (x * x))
else
tmp = x / (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5e+16) {
tmp = -0.16666666666666666 * (y * (x * x));
} else {
tmp = x / (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5e+16: tmp = -0.16666666666666666 * (y * (x * x)) else: tmp = x / (x / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -5e+16) tmp = Float64(-0.16666666666666666 * Float64(y * Float64(x * x))); else tmp = Float64(x / Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5e+16) tmp = -0.16666666666666666 * (y * (x * x)); else tmp = x / (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5e+16], N[(-0.16666666666666666 * N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+16}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(y \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\end{array}
\end{array}
if y < -5e16Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.3%
associate-/l*4.3%
Simplified4.3%
Taylor expanded in x around 0 34.0%
+-commutative34.0%
remove-double-neg34.0%
unsub-neg34.0%
associate-*r*34.0%
*-commutative34.0%
associate-*l*34.0%
fma-neg34.0%
unpow234.0%
remove-double-neg34.0%
Simplified34.0%
Taylor expanded in x around inf 32.2%
unpow232.2%
Simplified32.2%
if -5e16 < y Initial program 85.3%
Taylor expanded in y around 0 59.4%
Taylor expanded in x around 0 28.3%
associate-/l*40.6%
associate-/r/63.9%
Applied egg-rr63.9%
*-commutative63.9%
clear-num65.6%
un-div-inv64.7%
Applied egg-rr64.7%
Final simplification56.9%
(FPCore (x y) :precision binary64 (* x (/ y x)))
double code(double x, double y) {
return x * (y / x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (y / x)
end function
public static double code(double x, double y) {
return x * (y / x);
}
def code(x, y): return x * (y / x)
function code(x, y) return Float64(x * Float64(y / x)) end
function tmp = code(x, y) tmp = x * (y / x); end
code[x_, y_] := N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y}{x}
\end{array}
Initial program 88.8%
Taylor expanded in y around 0 46.3%
Taylor expanded in x around 0 25.7%
associate-/l*31.7%
associate-/r/53.9%
Applied egg-rr53.9%
Final simplification53.9%
(FPCore (x y) :precision binary64 y)
double code(double x, double y) {
return y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = y
end function
public static double code(double x, double y) {
return y;
}
def code(x, y): return y
function code(x, y) return y end
function tmp = code(x, y) tmp = y; end
code[x_, y_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 88.8%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 46.3%
associate-/l*57.4%
Simplified57.4%
Taylor expanded in x around 0 31.7%
Final simplification31.7%
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) x)))
double code(double x, double y) {
return sin(x) * (sinh(y) / x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / x)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / x);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / x)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / x)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / x); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{x}
\end{array}
herbie shell --seed 2023207
(FPCore (x y)
:name "Linear.Quaternion:$ccosh from linear-1.19.1.3"
:precision binary64
:herbie-target
(* (sin x) (/ (sinh y) x))
(/ (* (sin x) (sinh y)) x))