
(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) 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 86.0%
associate-*l/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= (sinh y) -2e-7) (sinh y) (if (<= (sinh y) 0.005) (* (sin x) (/ y x)) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -2e-7) {
tmp = sinh(y);
} else if (sinh(y) <= 0.005) {
tmp = sin(x) * (y / 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 (sinh(y) <= (-2d-7)) then
tmp = sinh(y)
else if (sinh(y) <= 0.005d0) then
tmp = sin(x) * (y / x)
else
tmp = sinh(y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.sinh(y) <= -2e-7) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 0.005) {
tmp = Math.sin(x) * (y / x);
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -2e-7: tmp = math.sinh(y) elif math.sinh(y) <= 0.005: tmp = math.sin(x) * (y / x) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -2e-7) tmp = sinh(y); elseif (sinh(y) <= 0.005) tmp = Float64(sin(x) * Float64(y / x)); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (sinh(y) <= -2e-7) tmp = sinh(y); elseif (sinh(y) <= 0.005) tmp = sin(x) * (y / x); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -2e-7], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 0.005], N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -2 \cdot 10^{-7}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 0.005:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -1.9999999999999999e-7 or 0.0050000000000000001 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 76.7%
if -1.9999999999999999e-7 < (sinh.f64 y) < 0.0050000000000000001Initial program 70.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 70.1%
associate-/l*99.1%
associate-/r/98.9%
Simplified98.9%
Final simplification87.4%
(FPCore (x y) :precision binary64 (if (<= (sinh y) -2e-7) (sinh y) (if (<= (sinh y) 0.005) (* (/ (sin x) x) y) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -2e-7) {
tmp = sinh(y);
} else if (sinh(y) <= 0.005) {
tmp = (sin(x) / x) * y;
} 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 (sinh(y) <= (-2d-7)) then
tmp = sinh(y)
else if (sinh(y) <= 0.005d0) then
tmp = (sin(x) / x) * y
else
tmp = sinh(y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.sinh(y) <= -2e-7) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 0.005) {
tmp = (Math.sin(x) / x) * y;
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -2e-7: tmp = math.sinh(y) elif math.sinh(y) <= 0.005: tmp = (math.sin(x) / x) * y else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -2e-7) tmp = sinh(y); elseif (sinh(y) <= 0.005) 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) <= -2e-7) tmp = sinh(y); elseif (sinh(y) <= 0.005) tmp = (sin(x) / x) * y; else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -2e-7], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 0.005], 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 -2 \cdot 10^{-7}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 0.005:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -1.9999999999999999e-7 or 0.0050000000000000001 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 76.7%
if -1.9999999999999999e-7 < (sinh.f64 y) < 0.0050000000000000001Initial program 70.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 99.1%
Final simplification87.4%
(FPCore (x y) :precision binary64 (if (<= (sinh y) -2e-7) (sinh y) (if (<= (sinh y) 0.005) (/ y (/ x (sin x))) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -2e-7) {
tmp = sinh(y);
} else if (sinh(y) <= 0.005) {
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 (sinh(y) <= (-2d-7)) then
tmp = sinh(y)
else if (sinh(y) <= 0.005d0) 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 (Math.sinh(y) <= -2e-7) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 0.005) {
tmp = y / (x / Math.sin(x));
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -2e-7: tmp = math.sinh(y) elif math.sinh(y) <= 0.005: tmp = y / (x / math.sin(x)) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -2e-7) tmp = sinh(y); elseif (sinh(y) <= 0.005) 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 (sinh(y) <= -2e-7) tmp = sinh(y); elseif (sinh(y) <= 0.005) tmp = y / (x / sin(x)); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -2e-7], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 0.005], N[(y / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -2 \cdot 10^{-7}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 0.005:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -1.9999999999999999e-7 or 0.0050000000000000001 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 76.7%
if -1.9999999999999999e-7 < (sinh.f64 y) < 0.0050000000000000001Initial program 70.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 70.1%
associate-/l*99.1%
Simplified99.1%
Final simplification87.5%
(FPCore (x y) :precision binary64 (if (<= (sinh y) -2e-7) (* (+ 1.0 (* -0.16666666666666666 (* x x))) (sinh y)) (if (<= (sinh y) 0.005) (/ y (/ x (sin x))) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -2e-7) {
tmp = (1.0 + (-0.16666666666666666 * (x * x))) * sinh(y);
} else if (sinh(y) <= 0.005) {
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 (sinh(y) <= (-2d-7)) then
tmp = (1.0d0 + ((-0.16666666666666666d0) * (x * x))) * sinh(y)
else if (sinh(y) <= 0.005d0) 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 (Math.sinh(y) <= -2e-7) {
tmp = (1.0 + (-0.16666666666666666 * (x * x))) * Math.sinh(y);
} else if (Math.sinh(y) <= 0.005) {
tmp = y / (x / Math.sin(x));
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -2e-7: tmp = (1.0 + (-0.16666666666666666 * (x * x))) * math.sinh(y) elif math.sinh(y) <= 0.005: tmp = y / (x / math.sin(x)) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -2e-7) tmp = Float64(Float64(1.0 + Float64(-0.16666666666666666 * Float64(x * x))) * sinh(y)); elseif (sinh(y) <= 0.005) 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 (sinh(y) <= -2e-7) tmp = (1.0 + (-0.16666666666666666 * (x * x))) * sinh(y); elseif (sinh(y) <= 0.005) tmp = y / (x / sin(x)); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -2e-7], N[(N[(1.0 + N[(-0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 0.005], N[(y / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -2 \cdot 10^{-7}:\\
\;\;\;\;\left(1 + -0.16666666666666666 \cdot \left(x \cdot x\right)\right) \cdot \sinh y\\
\mathbf{elif}\;\sinh y \leq 0.005:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -1.9999999999999999e-7Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 89.4%
unpow226.5%
Simplified89.4%
if -1.9999999999999999e-7 < (sinh.f64 y) < 0.0050000000000000001Initial program 70.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 70.1%
associate-/l*99.1%
Simplified99.1%
if 0.0050000000000000001 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 82.1%
Final simplification92.1%
(FPCore (x y) :precision binary64 (sinh y))
double code(double x, double y) {
return sinh(y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sinh(y)
end function
public static double code(double x, double y) {
return Math.sinh(y);
}
def code(x, y): return math.sinh(y)
function code(x, y) return sinh(y) end
function tmp = code(x, y) tmp = sinh(y); end
code[x_, y_] := N[Sinh[y], $MachinePrecision]
\begin{array}{l}
\\
\sinh y
\end{array}
Initial program 86.0%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around 0 67.9%
Final simplification67.9%
(FPCore (x y) :precision binary64 (if (<= y -1200000.0) (* y (* -0.16666666666666666 (* x x))) (if (<= y 4.9e-8) y (* (* x y) (/ 1.0 x)))))
double code(double x, double y) {
double tmp;
if (y <= -1200000.0) {
tmp = y * (-0.16666666666666666 * (x * x));
} else if (y <= 4.9e-8) {
tmp = y;
} else {
tmp = (x * y) * (1.0 / x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1200000.0d0)) then
tmp = y * ((-0.16666666666666666d0) * (x * x))
else if (y <= 4.9d-8) then
tmp = y
else
tmp = (x * y) * (1.0d0 / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1200000.0) {
tmp = y * (-0.16666666666666666 * (x * x));
} else if (y <= 4.9e-8) {
tmp = y;
} else {
tmp = (x * y) * (1.0 / x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1200000.0: tmp = y * (-0.16666666666666666 * (x * x)) elif y <= 4.9e-8: tmp = y else: tmp = (x * y) * (1.0 / x) return tmp
function code(x, y) tmp = 0.0 if (y <= -1200000.0) tmp = Float64(y * Float64(-0.16666666666666666 * Float64(x * x))); elseif (y <= 4.9e-8) tmp = y; else tmp = Float64(Float64(x * y) * Float64(1.0 / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1200000.0) tmp = y * (-0.16666666666666666 * (x * x)); elseif (y <= 4.9e-8) tmp = y; else tmp = (x * y) * (1.0 / x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1200000.0], N[(y * N[(-0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.9e-8], y, N[(N[(x * y), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1200000:\\
\;\;\;\;y \cdot \left(-0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{-8}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{x}\\
\end{array}
\end{array}
if y < -1.2e6Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.9%
Taylor expanded in x around 0 25.9%
unpow225.9%
Simplified25.9%
Taylor expanded in x around inf 23.1%
unpow223.1%
Simplified23.1%
Taylor expanded in y around 0 23.1%
associate-*r*23.1%
*-commutative23.1%
associate-*l*23.1%
unpow223.1%
Simplified23.1%
if -1.2e6 < y < 4.9000000000000002e-8Initial program 70.6%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 99.0%
Taylor expanded in x around 0 58.6%
if 4.9000000000000002e-8 < y Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 29.8%
associate-/l*7.2%
div-inv7.3%
*-commutative7.3%
Applied egg-rr7.3%
Taylor expanded in x around 0 27.5%
Final simplification41.2%
(FPCore (x y) :precision binary64 (if (<= y 5.2e+111) (* y (+ 1.0 (* -0.16666666666666666 (* x x)))) (* (* x y) (/ 1.0 x))))
double code(double x, double y) {
double tmp;
if (y <= 5.2e+111) {
tmp = y * (1.0 + (-0.16666666666666666 * (x * x)));
} else {
tmp = (x * y) * (1.0 / x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 5.2d+111) then
tmp = y * (1.0d0 + ((-0.16666666666666666d0) * (x * x)))
else
tmp = (x * y) * (1.0d0 / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 5.2e+111) {
tmp = y * (1.0 + (-0.16666666666666666 * (x * x)));
} else {
tmp = (x * y) * (1.0 / x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 5.2e+111: tmp = y * (1.0 + (-0.16666666666666666 * (x * x))) else: tmp = (x * y) * (1.0 / x) return tmp
function code(x, y) tmp = 0.0 if (y <= 5.2e+111) tmp = Float64(y * Float64(1.0 + Float64(-0.16666666666666666 * Float64(x * x)))); else tmp = Float64(Float64(x * y) * Float64(1.0 / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 5.2e+111) tmp = y * (1.0 + (-0.16666666666666666 * (x * x))); else tmp = (x * y) * (1.0 / x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 5.2e+111], N[(y * N[(1.0 + N[(-0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.2 \cdot 10^{+111}:\\
\;\;\;\;y \cdot \left(1 + -0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{x}\\
\end{array}
\end{array}
if y < 5.1999999999999997e111Initial program 82.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 60.3%
Taylor expanded in x around 0 43.6%
unpow243.6%
Simplified43.6%
if 5.1999999999999997e111 < y Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 37.5%
associate-/l*5.2%
div-inv5.2%
*-commutative5.2%
Applied egg-rr5.2%
Taylor expanded in x around 0 36.1%
Final simplification42.2%
(FPCore (x y) :precision binary64 (if (<= x 6.5e+26) y (* -0.16666666666666666 (* y (* x x)))))
double code(double x, double y) {
double tmp;
if (x <= 6.5e+26) {
tmp = y;
} else {
tmp = -0.16666666666666666 * (y * (x * x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 6.5d+26) then
tmp = y
else
tmp = (-0.16666666666666666d0) * (y * (x * x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 6.5e+26) {
tmp = y;
} else {
tmp = -0.16666666666666666 * (y * (x * x));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 6.5e+26: tmp = y else: tmp = -0.16666666666666666 * (y * (x * x)) return tmp
function code(x, y) tmp = 0.0 if (x <= 6.5e+26) tmp = y; else tmp = Float64(-0.16666666666666666 * Float64(y * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 6.5e+26) tmp = y; else tmp = -0.16666666666666666 * (y * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 6.5e+26], y, N[(-0.16666666666666666 * N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{+26}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(y \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if x < 6.50000000000000022e26Initial program 82.2%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 49.3%
Taylor expanded in x around 0 37.8%
if 6.50000000000000022e26 < x Initial program 99.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 54.3%
Taylor expanded in x around 0 21.3%
unpow221.3%
Simplified21.3%
Taylor expanded in x around inf 21.3%
unpow221.3%
Simplified21.3%
Final simplification34.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 86.0%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 50.4%
Taylor expanded in x around 0 30.8%
Final simplification30.8%
(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 2023268
(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))