
(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 10 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 91.1%
associate-/l*99.9%
Simplified99.9%
(FPCore (x y)
:precision binary64
(if (<= y 2500000000000.0)
(* y (/ (sin x) x))
(if (or (<= y 1.6e+276) (not (<= y 1.26e+297)))
(log1p (expm1 y))
(* y (+ (* -0.16666666666666666 (pow x 2.0)) 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= 2500000000000.0) {
tmp = y * (sin(x) / x);
} else if ((y <= 1.6e+276) || !(y <= 1.26e+297)) {
tmp = log1p(expm1(y));
} else {
tmp = y * ((-0.16666666666666666 * pow(x, 2.0)) + 1.0);
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= 2500000000000.0) {
tmp = y * (Math.sin(x) / x);
} else if ((y <= 1.6e+276) || !(y <= 1.26e+297)) {
tmp = Math.log1p(Math.expm1(y));
} else {
tmp = y * ((-0.16666666666666666 * Math.pow(x, 2.0)) + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2500000000000.0: tmp = y * (math.sin(x) / x) elif (y <= 1.6e+276) or not (y <= 1.26e+297): tmp = math.log1p(math.expm1(y)) else: tmp = y * ((-0.16666666666666666 * math.pow(x, 2.0)) + 1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= 2500000000000.0) tmp = Float64(y * Float64(sin(x) / x)); elseif ((y <= 1.6e+276) || !(y <= 1.26e+297)) tmp = log1p(expm1(y)); else tmp = Float64(y * Float64(Float64(-0.16666666666666666 * (x ^ 2.0)) + 1.0)); end return tmp end
code[x_, y_] := If[LessEqual[y, 2500000000000.0], N[(y * N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 1.6e+276], N[Not[LessEqual[y, 1.26e+297]], $MachinePrecision]], N[Log[1 + N[(Exp[y] - 1), $MachinePrecision]], $MachinePrecision], N[(y * N[(N[(-0.16666666666666666 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2500000000000:\\
\;\;\;\;y \cdot \frac{\sin x}{x}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+276} \lor \neg \left(y \leq 1.26 \cdot 10^{+297}\right):\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-0.16666666666666666 \cdot {x}^{2} + 1\right)\\
\end{array}
\end{array}
if y < 2.5e12Initial program 88.2%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 51.0%
associate-/l*62.7%
Simplified62.7%
if 2.5e12 < y < 1.59999999999999994e276 or 1.26e297 < y Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 4.0%
associate-/l*4.0%
Simplified4.0%
associate-*r/4.0%
clear-num4.0%
*-commutative4.0%
Applied egg-rr4.0%
Taylor expanded in x around 0 3.8%
remove-double-div3.8%
log1p-expm1-u75.0%
Applied egg-rr75.0%
if 1.59999999999999994e276 < y < 1.26e297Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 6.1%
associate-/l*6.1%
Simplified6.1%
Taylor expanded in x around 0 74.2%
Final simplification65.7%
(FPCore (x y)
:precision binary64
(if (<= y 13.2)
(* y (/ (sin x) x))
(if (<= y 4e+63)
(/ (* x (+ y (* -0.16666666666666666 (* y (pow x 2.0))))) x)
(if (<= y 8.8e+272)
(* (sin x) (/ 1.0 (/ x y)))
(if (<= y 2e+297)
(* y (+ (* -0.16666666666666666 (pow x 2.0)) 1.0))
(/ (* x y) x))))))
double code(double x, double y) {
double tmp;
if (y <= 13.2) {
tmp = y * (sin(x) / x);
} else if (y <= 4e+63) {
tmp = (x * (y + (-0.16666666666666666 * (y * pow(x, 2.0))))) / x;
} else if (y <= 8.8e+272) {
tmp = sin(x) * (1.0 / (x / y));
} else if (y <= 2e+297) {
tmp = y * ((-0.16666666666666666 * pow(x, 2.0)) + 1.0);
} else {
tmp = (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 <= 13.2d0) then
tmp = y * (sin(x) / x)
else if (y <= 4d+63) then
tmp = (x * (y + ((-0.16666666666666666d0) * (y * (x ** 2.0d0))))) / x
else if (y <= 8.8d+272) then
tmp = sin(x) * (1.0d0 / (x / y))
else if (y <= 2d+297) then
tmp = y * (((-0.16666666666666666d0) * (x ** 2.0d0)) + 1.0d0)
else
tmp = (x * y) / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 13.2) {
tmp = y * (Math.sin(x) / x);
} else if (y <= 4e+63) {
tmp = (x * (y + (-0.16666666666666666 * (y * Math.pow(x, 2.0))))) / x;
} else if (y <= 8.8e+272) {
tmp = Math.sin(x) * (1.0 / (x / y));
} else if (y <= 2e+297) {
tmp = y * ((-0.16666666666666666 * Math.pow(x, 2.0)) + 1.0);
} else {
tmp = (x * y) / x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 13.2: tmp = y * (math.sin(x) / x) elif y <= 4e+63: tmp = (x * (y + (-0.16666666666666666 * (y * math.pow(x, 2.0))))) / x elif y <= 8.8e+272: tmp = math.sin(x) * (1.0 / (x / y)) elif y <= 2e+297: tmp = y * ((-0.16666666666666666 * math.pow(x, 2.0)) + 1.0) else: tmp = (x * y) / x return tmp
function code(x, y) tmp = 0.0 if (y <= 13.2) tmp = Float64(y * Float64(sin(x) / x)); elseif (y <= 4e+63) tmp = Float64(Float64(x * Float64(y + Float64(-0.16666666666666666 * Float64(y * (x ^ 2.0))))) / x); elseif (y <= 8.8e+272) tmp = Float64(sin(x) * Float64(1.0 / Float64(x / y))); elseif (y <= 2e+297) tmp = Float64(y * Float64(Float64(-0.16666666666666666 * (x ^ 2.0)) + 1.0)); else tmp = Float64(Float64(x * y) / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 13.2) tmp = y * (sin(x) / x); elseif (y <= 4e+63) tmp = (x * (y + (-0.16666666666666666 * (y * (x ^ 2.0))))) / x; elseif (y <= 8.8e+272) tmp = sin(x) * (1.0 / (x / y)); elseif (y <= 2e+297) tmp = y * ((-0.16666666666666666 * (x ^ 2.0)) + 1.0); else tmp = (x * y) / x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 13.2], N[(y * N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e+63], N[(N[(x * N[(y + N[(-0.16666666666666666 * N[(y * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 8.8e+272], N[(N[Sin[x], $MachinePrecision] * N[(1.0 / N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e+297], N[(y * N[(N[(-0.16666666666666666 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 13.2:\\
\;\;\;\;y \cdot \frac{\sin x}{x}\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+63}:\\
\;\;\;\;\frac{x \cdot \left(y + -0.16666666666666666 \cdot \left(y \cdot {x}^{2}\right)\right)}{x}\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{+272}:\\
\;\;\;\;\sin x \cdot \frac{1}{\frac{x}{y}}\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+297}:\\
\;\;\;\;y \cdot \left(-0.16666666666666666 \cdot {x}^{2} + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{x}\\
\end{array}
\end{array}
if y < 13.199999999999999Initial program 88.0%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 51.4%
associate-/l*63.3%
Simplified63.3%
if 13.199999999999999 < y < 4.00000000000000023e63Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 3.5%
Taylor expanded in x around 0 30.1%
if 4.00000000000000023e63 < y < 8.80000000000000034e272Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 4.3%
associate-/l*4.3%
Simplified4.3%
associate-*r/4.3%
*-commutative4.3%
associate-*r/28.9%
clear-num28.9%
un-div-inv28.9%
Applied egg-rr28.9%
frac-2neg28.9%
div-inv28.9%
distribute-neg-frac228.9%
Applied egg-rr28.9%
if 8.80000000000000034e272 < y < 2e297Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 6.1%
associate-/l*6.1%
Simplified6.1%
Taylor expanded in x around 0 74.2%
if 2e297 < y Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 3.7%
Taylor expanded in x around 0 100.0%
Final simplification56.1%
(FPCore (x y)
:precision binary64
(if (<= y 13.2)
(* y (/ (sin x) x))
(if (<= y 3.7e+63)
(* y (+ (* -0.16666666666666666 (pow x 2.0)) 1.0))
(* (sin x) (/ y x)))))
double code(double x, double y) {
double tmp;
if (y <= 13.2) {
tmp = y * (sin(x) / x);
} else if (y <= 3.7e+63) {
tmp = y * ((-0.16666666666666666 * pow(x, 2.0)) + 1.0);
} 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 <= 13.2d0) then
tmp = y * (sin(x) / x)
else if (y <= 3.7d+63) then
tmp = y * (((-0.16666666666666666d0) * (x ** 2.0d0)) + 1.0d0)
else
tmp = sin(x) * (y / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 13.2) {
tmp = y * (Math.sin(x) / x);
} else if (y <= 3.7e+63) {
tmp = y * ((-0.16666666666666666 * Math.pow(x, 2.0)) + 1.0);
} else {
tmp = Math.sin(x) * (y / x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 13.2: tmp = y * (math.sin(x) / x) elif y <= 3.7e+63: tmp = y * ((-0.16666666666666666 * math.pow(x, 2.0)) + 1.0) else: tmp = math.sin(x) * (y / x) return tmp
function code(x, y) tmp = 0.0 if (y <= 13.2) tmp = Float64(y * Float64(sin(x) / x)); elseif (y <= 3.7e+63) tmp = Float64(y * Float64(Float64(-0.16666666666666666 * (x ^ 2.0)) + 1.0)); else tmp = Float64(sin(x) * Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 13.2) tmp = y * (sin(x) / x); elseif (y <= 3.7e+63) tmp = y * ((-0.16666666666666666 * (x ^ 2.0)) + 1.0); else tmp = sin(x) * (y / x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 13.2], N[(y * N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.7e+63], N[(y * N[(N[(-0.16666666666666666 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 13.2:\\
\;\;\;\;y \cdot \frac{\sin x}{x}\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{+63}:\\
\;\;\;\;y \cdot \left(-0.16666666666666666 \cdot {x}^{2} + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\end{array}
\end{array}
if y < 13.199999999999999Initial program 88.0%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 51.4%
associate-/l*63.3%
Simplified63.3%
if 13.199999999999999 < y < 3.69999999999999968e63Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 3.5%
associate-/l*3.5%
Simplified3.5%
Taylor expanded in x around 0 30.1%
if 3.69999999999999968e63 < y Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 28.8%
Final simplification54.6%
(FPCore (x y)
:precision binary64
(if (<= y 1200.0)
(* y (/ (sin x) x))
(if (<= y 1.16e+63)
(* -0.16666666666666666 (* y (pow x 2.0)))
(* (sin x) (/ y x)))))
double code(double x, double y) {
double tmp;
if (y <= 1200.0) {
tmp = y * (sin(x) / x);
} else if (y <= 1.16e+63) {
tmp = -0.16666666666666666 * (y * pow(x, 2.0));
} 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 <= 1200.0d0) then
tmp = y * (sin(x) / x)
else if (y <= 1.16d+63) then
tmp = (-0.16666666666666666d0) * (y * (x ** 2.0d0))
else
tmp = sin(x) * (y / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1200.0) {
tmp = y * (Math.sin(x) / x);
} else if (y <= 1.16e+63) {
tmp = -0.16666666666666666 * (y * Math.pow(x, 2.0));
} else {
tmp = Math.sin(x) * (y / x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1200.0: tmp = y * (math.sin(x) / x) elif y <= 1.16e+63: tmp = -0.16666666666666666 * (y * math.pow(x, 2.0)) else: tmp = math.sin(x) * (y / x) return tmp
function code(x, y) tmp = 0.0 if (y <= 1200.0) tmp = Float64(y * Float64(sin(x) / x)); elseif (y <= 1.16e+63) tmp = Float64(-0.16666666666666666 * Float64(y * (x ^ 2.0))); else tmp = Float64(sin(x) * Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1200.0) tmp = y * (sin(x) / x); elseif (y <= 1.16e+63) tmp = -0.16666666666666666 * (y * (x ^ 2.0)); else tmp = sin(x) * (y / x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1200.0], N[(y * N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.16e+63], N[(-0.16666666666666666 * N[(y * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1200:\\
\;\;\;\;y \cdot \frac{\sin x}{x}\\
\mathbf{elif}\;y \leq 1.16 \cdot 10^{+63}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(y \cdot {x}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\end{array}
\end{array}
if y < 1200Initial program 88.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 51.2%
associate-/l*63.0%
Simplified63.0%
if 1200 < y < 1.15999999999999994e63Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 2.5%
associate-/l*2.5%
Simplified2.5%
Taylor expanded in x around 0 31.9%
Taylor expanded in x around inf 31.3%
if 1.15999999999999994e63 < y Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 28.8%
Final simplification54.6%
(FPCore (x y) :precision binary64 (if (<= y 1.3e+37) (* y (/ (sin x) x)) (/ -1.0 (* x (/ -1.0 (* x y))))))
double code(double x, double y) {
double tmp;
if (y <= 1.3e+37) {
tmp = y * (sin(x) / x);
} else {
tmp = -1.0 / (x * (-1.0 / (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 <= 1.3d+37) then
tmp = y * (sin(x) / x)
else
tmp = (-1.0d0) / (x * ((-1.0d0) / (x * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.3e+37) {
tmp = y * (Math.sin(x) / x);
} else {
tmp = -1.0 / (x * (-1.0 / (x * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.3e+37: tmp = y * (math.sin(x) / x) else: tmp = -1.0 / (x * (-1.0 / (x * y))) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.3e+37) tmp = Float64(y * Float64(sin(x) / x)); else tmp = Float64(-1.0 / Float64(x * Float64(-1.0 / Float64(x * y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.3e+37) tmp = y * (sin(x) / x); else tmp = -1.0 / (x * (-1.0 / (x * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.3e+37], N[(y * N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(x * N[(-1.0 / N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.3 \cdot 10^{+37}:\\
\;\;\;\;y \cdot \frac{\sin x}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{x \cdot \frac{-1}{x \cdot y}}\\
\end{array}
\end{array}
if y < 1.3e37Initial program 88.4%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 50.0%
associate-/l*61.5%
Simplified61.5%
if 1.3e37 < y Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 4.4%
associate-/l*4.4%
Simplified4.4%
associate-*r/4.4%
clear-num4.4%
*-commutative4.4%
Applied egg-rr4.4%
clear-num4.4%
associate-/r/4.4%
*-commutative4.4%
associate-/r*4.4%
Applied egg-rr4.4%
Taylor expanded in x around 0 16.6%
*-commutative16.6%
Simplified16.6%
Final simplification51.2%
(FPCore (x y) :precision binary64 (* (sin x) (/ y x)))
double code(double x, double y) {
return sin(x) * (y / x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (y / x)
end function
public static double code(double x, double y) {
return Math.sin(x) * (y / x);
}
def code(x, y): return math.sin(x) * (y / x)
function code(x, y) return Float64(sin(x) * Float64(y / x)) end
function tmp = code(x, y) tmp = sin(x) * (y / x); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{y}{x}
\end{array}
Initial program 91.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 61.0%
(FPCore (x y) :precision binary64 (if (<= x 1e+32) y (/ -1.0 (* x (/ -1.0 (* x y))))))
double code(double x, double y) {
double tmp;
if (x <= 1e+32) {
tmp = y;
} else {
tmp = -1.0 / (x * (-1.0 / (x * y)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 1d+32) then
tmp = y
else
tmp = (-1.0d0) / (x * ((-1.0d0) / (x * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 1e+32) {
tmp = y;
} else {
tmp = -1.0 / (x * (-1.0 / (x * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 1e+32: tmp = y else: tmp = -1.0 / (x * (-1.0 / (x * y))) return tmp
function code(x, y) tmp = 0.0 if (x <= 1e+32) tmp = y; else tmp = Float64(-1.0 / Float64(x * Float64(-1.0 / Float64(x * y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 1e+32) tmp = y; else tmp = -1.0 / (x * (-1.0 / (x * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 1e+32], y, N[(-1.0 / N[(x * N[(-1.0 / N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+32}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{x \cdot \frac{-1}{x \cdot y}}\\
\end{array}
\end{array}
if x < 1.00000000000000005e32Initial program 88.6%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 36.2%
associate-/l*47.6%
Simplified47.6%
Taylor expanded in x around 0 32.4%
if 1.00000000000000005e32 < x Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 50.8%
associate-/l*50.8%
Simplified50.8%
associate-*r/50.8%
clear-num50.4%
*-commutative50.4%
Applied egg-rr50.4%
clear-num50.4%
associate-/r/50.4%
*-commutative50.4%
associate-/r*50.4%
Applied egg-rr50.4%
Taylor expanded in x around 0 17.1%
*-commutative17.1%
Simplified17.1%
Final simplification29.0%
(FPCore (x y) :precision binary64 (if (<= x 1e+33) y (/ (* x y) x)))
double code(double x, double y) {
double tmp;
if (x <= 1e+33) {
tmp = y;
} else {
tmp = (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 (x <= 1d+33) then
tmp = y
else
tmp = (x * y) / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 1e+33) {
tmp = y;
} else {
tmp = (x * y) / x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 1e+33: tmp = y else: tmp = (x * y) / x return tmp
function code(x, y) tmp = 0.0 if (x <= 1e+33) tmp = y; else tmp = Float64(Float64(x * y) / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 1e+33) tmp = y; else tmp = (x * y) / x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 1e+33], y, N[(N[(x * y), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+33}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{x}\\
\end{array}
\end{array}
if x < 9.9999999999999995e32Initial program 88.6%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 36.2%
associate-/l*47.6%
Simplified47.6%
Taylor expanded in x around 0 32.4%
if 9.9999999999999995e32 < x Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 50.8%
Taylor expanded in x around 0 17.1%
(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 91.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 39.5%
associate-/l*48.3%
Simplified48.3%
Taylor expanded in x around 0 26.1%
(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 2024085
(FPCore (x y)
:name "Linear.Quaternion:$ccosh from linear-1.19.1.3"
:precision binary64
:alt
(* (sin x) (/ (sinh y) x))
(/ (* (sin x) (sinh y)) x))