
(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) x) (sinh y)))
double code(double x, double y) {
return (sin(x) / x) * sinh(y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(x) / x) * sinh(y)
end function
public static double code(double x, double y) {
return (Math.sin(x) / x) * Math.sinh(y);
}
def code(x, y): return (math.sin(x) / x) * math.sinh(y)
function code(x, y) return Float64(Float64(sin(x) / x) * sinh(y)) end
function tmp = code(x, y) tmp = (sin(x) / x) * sinh(y); end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x}{x} \cdot \sinh y
\end{array}
Initial program 88.6%
associate-*l/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= (sinh y) (- INFINITY)) (sinh y) (if (<= (sinh y) 1.0) (* (/ (sin x) x) y) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -((double) INFINITY)) {
tmp = sinh(y);
} else if (sinh(y) <= 1.0) {
tmp = (sin(x) / x) * y;
} else {
tmp = sinh(y);
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (Math.sinh(y) <= -Double.POSITIVE_INFINITY) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 1.0) {
tmp = (Math.sin(x) / x) * y;
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -math.inf: tmp = math.sinh(y) elif math.sinh(y) <= 1.0: tmp = (math.sin(x) / x) * y else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= Float64(-Inf)) tmp = sinh(y); elseif (sinh(y) <= 1.0) tmp = Float64(Float64(sin(x) / x) * y); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (sinh(y) <= -Inf) tmp = sinh(y); elseif (sinh(y) <= 1.0) tmp = (sin(x) / x) * y; else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], (-Infinity)], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 1.0], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -\infty:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 1:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 1 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 75.1%
if -inf.0 < (sinh.f64 y) < 1Initial program 76.5%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 98.6%
Final simplification86.5%
(FPCore (x y)
:precision binary64
(if (<= (sinh y) (- INFINITY))
(sinh y)
(if (<= (sinh y) 4e-12)
(/ y (+ 1.0 (* (* x x) 0.16666666666666666)))
(sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -((double) INFINITY)) {
tmp = sinh(y);
} else if (sinh(y) <= 4e-12) {
tmp = y / (1.0 + ((x * x) * 0.16666666666666666));
} else {
tmp = sinh(y);
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (Math.sinh(y) <= -Double.POSITIVE_INFINITY) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 4e-12) {
tmp = y / (1.0 + ((x * x) * 0.16666666666666666));
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -math.inf: tmp = math.sinh(y) elif math.sinh(y) <= 4e-12: tmp = y / (1.0 + ((x * x) * 0.16666666666666666)) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= Float64(-Inf)) tmp = sinh(y); elseif (sinh(y) <= 4e-12) tmp = Float64(y / Float64(1.0 + Float64(Float64(x * x) * 0.16666666666666666))); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (sinh(y) <= -Inf) tmp = sinh(y); elseif (sinh(y) <= 4e-12) tmp = y / (1.0 + ((x * x) * 0.16666666666666666)); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], (-Infinity)], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 4e-12], N[(y / N[(1.0 + N[(N[(x * x), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -\infty:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 4 \cdot 10^{-12}:\\
\;\;\;\;\frac{y}{1 + \left(x \cdot x\right) \cdot 0.16666666666666666}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 3.99999999999999992e-12 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 74.9%
if -inf.0 < (sinh.f64 y) < 3.99999999999999992e-12Initial program 75.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 75.3%
associate-/l*99.3%
Simplified99.3%
Taylor expanded in x around 0 76.7%
*-commutative76.7%
unpow276.7%
Simplified76.7%
Final simplification75.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (+ 1.0 (* -0.16666666666666666 (* x x))) (sinh y))))
(if (<= y -1800000.0)
t_0
(if (<= y 0.62) (/ y (/ x (sin x))) (if (<= y 1.3e+139) (sinh y) t_0)))))
double code(double x, double y) {
double t_0 = (1.0 + (-0.16666666666666666 * (x * x))) * sinh(y);
double tmp;
if (y <= -1800000.0) {
tmp = t_0;
} else if (y <= 0.62) {
tmp = y / (x / sin(x));
} else if (y <= 1.3e+139) {
tmp = sinh(y);
} 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 = (1.0d0 + ((-0.16666666666666666d0) * (x * x))) * sinh(y)
if (y <= (-1800000.0d0)) then
tmp = t_0
else if (y <= 0.62d0) then
tmp = y / (x / sin(x))
else if (y <= 1.3d+139) then
tmp = sinh(y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (1.0 + (-0.16666666666666666 * (x * x))) * Math.sinh(y);
double tmp;
if (y <= -1800000.0) {
tmp = t_0;
} else if (y <= 0.62) {
tmp = y / (x / Math.sin(x));
} else if (y <= 1.3e+139) {
tmp = Math.sinh(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (1.0 + (-0.16666666666666666 * (x * x))) * math.sinh(y) tmp = 0 if y <= -1800000.0: tmp = t_0 elif y <= 0.62: tmp = y / (x / math.sin(x)) elif y <= 1.3e+139: tmp = math.sinh(y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(1.0 + Float64(-0.16666666666666666 * Float64(x * x))) * sinh(y)) tmp = 0.0 if (y <= -1800000.0) tmp = t_0; elseif (y <= 0.62) tmp = Float64(y / Float64(x / sin(x))); elseif (y <= 1.3e+139) tmp = sinh(y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (1.0 + (-0.16666666666666666 * (x * x))) * sinh(y); tmp = 0.0; if (y <= -1800000.0) tmp = t_0; elseif (y <= 0.62) tmp = y / (x / sin(x)); elseif (y <= 1.3e+139) tmp = sinh(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 + N[(-0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1800000.0], t$95$0, If[LessEqual[y, 0.62], N[(y / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e+139], N[Sinh[y], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + -0.16666666666666666 \cdot \left(x \cdot x\right)\right) \cdot \sinh y\\
\mathbf{if}\;y \leq -1800000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 0.62:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+139}:\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.8e6 or 1.30000000000000011e139 < y Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 84.1%
unpow284.1%
Simplified84.1%
if -1.8e6 < y < 0.619999999999999996Initial program 76.7%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 74.6%
associate-/l*97.9%
Simplified97.9%
if 0.619999999999999996 < y < 1.30000000000000011e139Initial program 99.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around 0 87.8%
Final simplification91.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (+ 1.0 (* -0.16666666666666666 (* x x))) (sinh y))))
(if (<= y -1800000.0)
t_0
(if (<= y 0.62)
(/ (sin x) (+ (* -0.16666666666666666 (* x y)) (/ x y)))
(if (<= y 1e+137) (sinh y) t_0)))))
double code(double x, double y) {
double t_0 = (1.0 + (-0.16666666666666666 * (x * x))) * sinh(y);
double tmp;
if (y <= -1800000.0) {
tmp = t_0;
} else if (y <= 0.62) {
tmp = sin(x) / ((-0.16666666666666666 * (x * y)) + (x / y));
} else if (y <= 1e+137) {
tmp = sinh(y);
} 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 = (1.0d0 + ((-0.16666666666666666d0) * (x * x))) * sinh(y)
if (y <= (-1800000.0d0)) then
tmp = t_0
else if (y <= 0.62d0) then
tmp = sin(x) / (((-0.16666666666666666d0) * (x * y)) + (x / y))
else if (y <= 1d+137) then
tmp = sinh(y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (1.0 + (-0.16666666666666666 * (x * x))) * Math.sinh(y);
double tmp;
if (y <= -1800000.0) {
tmp = t_0;
} else if (y <= 0.62) {
tmp = Math.sin(x) / ((-0.16666666666666666 * (x * y)) + (x / y));
} else if (y <= 1e+137) {
tmp = Math.sinh(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (1.0 + (-0.16666666666666666 * (x * x))) * math.sinh(y) tmp = 0 if y <= -1800000.0: tmp = t_0 elif y <= 0.62: tmp = math.sin(x) / ((-0.16666666666666666 * (x * y)) + (x / y)) elif y <= 1e+137: tmp = math.sinh(y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(1.0 + Float64(-0.16666666666666666 * Float64(x * x))) * sinh(y)) tmp = 0.0 if (y <= -1800000.0) tmp = t_0; elseif (y <= 0.62) tmp = Float64(sin(x) / Float64(Float64(-0.16666666666666666 * Float64(x * y)) + Float64(x / y))); elseif (y <= 1e+137) tmp = sinh(y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (1.0 + (-0.16666666666666666 * (x * x))) * sinh(y); tmp = 0.0; if (y <= -1800000.0) tmp = t_0; elseif (y <= 0.62) tmp = sin(x) / ((-0.16666666666666666 * (x * y)) + (x / y)); elseif (y <= 1e+137) tmp = sinh(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 + N[(-0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1800000.0], t$95$0, If[LessEqual[y, 0.62], N[(N[Sin[x], $MachinePrecision] / N[(N[(-0.16666666666666666 * N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e+137], N[Sinh[y], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + -0.16666666666666666 \cdot \left(x \cdot x\right)\right) \cdot \sinh y\\
\mathbf{if}\;y \leq -1800000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 0.62:\\
\;\;\;\;\frac{\sin x}{-0.16666666666666666 \cdot \left(x \cdot y\right) + \frac{x}{y}}\\
\mathbf{elif}\;y \leq 10^{+137}:\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.8e6 or 1e137 < y Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 84.1%
unpow284.1%
Simplified84.1%
if -1.8e6 < y < 0.619999999999999996Initial program 76.7%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 98.0%
if 0.619999999999999996 < y < 1e137Initial program 99.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around 0 87.8%
Final simplification91.2%
(FPCore (x y) :precision binary64 (if (<= y -0.0027) (sinh y) (if (<= y 0.62) (/ y (/ x (sin x))) (sinh y))))
double code(double x, double y) {
double tmp;
if (y <= -0.0027) {
tmp = sinh(y);
} else if (y <= 0.62) {
tmp = y / (x / sin(x));
} else {
tmp = sinh(y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-0.0027d0)) then
tmp = sinh(y)
else if (y <= 0.62d0) then
tmp = y / (x / sin(x))
else
tmp = sinh(y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -0.0027) {
tmp = Math.sinh(y);
} else if (y <= 0.62) {
tmp = y / (x / Math.sin(x));
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -0.0027: tmp = math.sinh(y) elif y <= 0.62: tmp = y / (x / math.sin(x)) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (y <= -0.0027) tmp = sinh(y); elseif (y <= 0.62) tmp = Float64(y / Float64(x / sin(x))); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -0.0027) tmp = sinh(y); elseif (y <= 0.62) tmp = y / (x / sin(x)); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -0.0027], N[Sinh[y], $MachinePrecision], If[LessEqual[y, 0.62], N[(y / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0027:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;y \leq 0.62:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if y < -0.0027000000000000001 or 0.619999999999999996 < y Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 75.1%
if -0.0027000000000000001 < y < 0.619999999999999996Initial program 76.5%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 75.2%
associate-/l*98.6%
Simplified98.6%
Final simplification86.5%
(FPCore (x y) :precision binary64 (if (<= y 1.35e+154) (* x (/ y x)) (sqrt (* y y))))
double code(double x, double y) {
double tmp;
if (y <= 1.35e+154) {
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 (y <= 1.35d+154) 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 (y <= 1.35e+154) {
tmp = x * (y / x);
} else {
tmp = Math.sqrt((y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.35e+154: tmp = x * (y / x) else: tmp = math.sqrt((y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.35e+154) 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 (y <= 1.35e+154) tmp = x * (y / x); else tmp = sqrt((y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.35e+154], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(y * y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{y \cdot y}\\
\end{array}
\end{array}
if y < 1.35000000000000003e154Initial program 86.8%
Taylor expanded in y around 0 44.3%
Taylor expanded in x around 0 21.9%
*-commutative21.9%
Simplified21.9%
associate-/l*32.5%
associate-/r/56.7%
Applied egg-rr56.7%
if 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 5.2%
Taylor expanded in x around 0 22.0%
*-commutative22.0%
Simplified22.0%
associate-/l*4.0%
*-inverses4.0%
/-rgt-identity4.0%
add-sqr-sqrt4.0%
sqrt-unprod61.1%
Applied egg-rr61.1%
Final simplification57.3%
(FPCore (x y) :precision binary64 (if (or (<= x 3.1) (not (<= x 2.2e+145))) (* x (/ y x)) (* -0.16666666666666666 (* x (* x y)))))
double code(double x, double y) {
double tmp;
if ((x <= 3.1) || !(x <= 2.2e+145)) {
tmp = x * (y / x);
} else {
tmp = -0.16666666666666666 * (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 ((x <= 3.1d0) .or. (.not. (x <= 2.2d+145))) then
tmp = x * (y / x)
else
tmp = (-0.16666666666666666d0) * (x * (x * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= 3.1) || !(x <= 2.2e+145)) {
tmp = x * (y / x);
} else {
tmp = -0.16666666666666666 * (x * (x * y));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= 3.1) or not (x <= 2.2e+145): tmp = x * (y / x) else: tmp = -0.16666666666666666 * (x * (x * y)) return tmp
function code(x, y) tmp = 0.0 if ((x <= 3.1) || !(x <= 2.2e+145)) tmp = Float64(x * Float64(y / x)); else tmp = Float64(-0.16666666666666666 * Float64(x * Float64(x * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= 3.1) || ~((x <= 2.2e+145))) tmp = x * (y / x); else tmp = -0.16666666666666666 * (x * (x * y)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, 3.1], N[Not[LessEqual[x, 2.2e+145]], $MachinePrecision]], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(-0.16666666666666666 * N[(x * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.1 \lor \neg \left(x \leq 2.2 \cdot 10^{+145}\right):\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(x \cdot \left(x \cdot y\right)\right)\\
\end{array}
\end{array}
if x < 3.10000000000000009 or 2.20000000000000009e145 < x Initial program 86.9%
Taylor expanded in y around 0 38.5%
Taylor expanded in x around 0 24.2%
*-commutative24.2%
Simplified24.2%
associate-/l*32.2%
associate-/r/58.9%
Applied egg-rr58.9%
if 3.10000000000000009 < x < 2.20000000000000009e145Initial program 99.8%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around 0 42.7%
unpow242.7%
Simplified42.7%
Taylor expanded in y around 0 37.3%
Taylor expanded in x around inf 37.3%
unpow237.3%
associate-*l*37.3%
*-commutative37.3%
Simplified37.3%
Final simplification56.0%
(FPCore (x y) :precision binary64 (if (<= y 2e+185) (* x (/ y x)) (* y (+ 1.0 (* -0.16666666666666666 (* x x))))))
double code(double x, double y) {
double tmp;
if (y <= 2e+185) {
tmp = x * (y / x);
} else {
tmp = y * (1.0 + (-0.16666666666666666 * (x * x)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2d+185) then
tmp = x * (y / x)
else
tmp = y * (1.0d0 + ((-0.16666666666666666d0) * (x * x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2e+185) {
tmp = x * (y / x);
} else {
tmp = y * (1.0 + (-0.16666666666666666 * (x * x)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2e+185: tmp = x * (y / x) else: tmp = y * (1.0 + (-0.16666666666666666 * (x * x))) return tmp
function code(x, y) tmp = 0.0 if (y <= 2e+185) tmp = Float64(x * Float64(y / x)); else tmp = Float64(y * Float64(1.0 + Float64(-0.16666666666666666 * Float64(x * x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2e+185) tmp = x * (y / x); else tmp = y * (1.0 + (-0.16666666666666666 * (x * x))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2e+185], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 + N[(-0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{+185}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 + -0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if y < 2e185Initial program 87.2%
Taylor expanded in y around 0 42.9%
Taylor expanded in x around 0 21.2%
*-commutative21.2%
Simplified21.2%
associate-/l*31.5%
associate-/r/57.0%
Applied egg-rr57.0%
if 2e185 < y Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 71.4%
unpow271.4%
Simplified71.4%
Taylor expanded in y around 0 41.6%
Final simplification55.3%
(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.6%
Taylor expanded in y around 0 38.8%
Taylor expanded in x around 0 21.9%
*-commutative21.9%
Simplified21.9%
associate-/l*28.5%
associate-/r/53.3%
Applied egg-rr53.3%
Final simplification53.3%
(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.6%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 38.8%
associate-/l*50.1%
Simplified50.1%
Taylor expanded in x around 0 28.5%
Final simplification28.5%
(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 2023290
(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))