
(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 90.1%
associate-*l/100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= (sinh y) -0.0001)
(sinh y)
(if (<= (sinh y) 0.002)
(/ y (/ x (sin x)))
(* (sinh y) (+ 1.0 (* -0.16666666666666666 (* x x)))))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -0.0001) {
tmp = sinh(y);
} else if (sinh(y) <= 0.002) {
tmp = y / (x / sin(x));
} else {
tmp = sinh(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 (sinh(y) <= (-0.0001d0)) then
tmp = sinh(y)
else if (sinh(y) <= 0.002d0) then
tmp = y / (x / sin(x))
else
tmp = sinh(y) * (1.0d0 + ((-0.16666666666666666d0) * (x * x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.sinh(y) <= -0.0001) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 0.002) {
tmp = y / (x / Math.sin(x));
} else {
tmp = Math.sinh(y) * (1.0 + (-0.16666666666666666 * (x * x)));
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -0.0001: tmp = math.sinh(y) elif math.sinh(y) <= 0.002: tmp = y / (x / math.sin(x)) else: tmp = math.sinh(y) * (1.0 + (-0.16666666666666666 * (x * x))) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -0.0001) tmp = sinh(y); elseif (sinh(y) <= 0.002) tmp = Float64(y / Float64(x / sin(x))); else tmp = Float64(sinh(y) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(x * x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (sinh(y) <= -0.0001) tmp = sinh(y); elseif (sinh(y) <= 0.002) tmp = y / (x / sin(x)); else tmp = sinh(y) * (1.0 + (-0.16666666666666666 * (x * x))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -0.0001], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 0.002], N[(y / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sinh[y], $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -0.0001:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 0.002:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y \cdot \left(1 + -0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if (sinh.f64 y) < -1.00000000000000005e-4Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 76.9%
if -1.00000000000000005e-4 < (sinh.f64 y) < 2e-3Initial program 80.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 80.3%
associate-/l*99.4%
Simplified99.4%
if 2e-3 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 77.6%
unpow277.6%
Simplified77.6%
Final simplification88.7%
(FPCore (x y) :precision binary64 (if (<= (sinh y) -0.0001) (sinh y) (if (<= (sinh y) 0.002) (* (sin x) (/ y x)) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -0.0001) {
tmp = sinh(y);
} else if (sinh(y) <= 0.002) {
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) <= (-0.0001d0)) then
tmp = sinh(y)
else if (sinh(y) <= 0.002d0) 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) <= -0.0001) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 0.002) {
tmp = Math.sin(x) * (y / x);
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -0.0001: tmp = math.sinh(y) elif math.sinh(y) <= 0.002: tmp = math.sin(x) * (y / x) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -0.0001) tmp = sinh(y); elseif (sinh(y) <= 0.002) 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) <= -0.0001) tmp = sinh(y); elseif (sinh(y) <= 0.002) tmp = sin(x) * (y / x); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -0.0001], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 0.002], 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 -0.0001:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 0.002:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -1.00000000000000005e-4 or 2e-3 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 76.4%
if -1.00000000000000005e-4 < (sinh.f64 y) < 2e-3Initial program 80.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 80.3%
associate-/l*99.4%
associate-/r/99.3%
Simplified99.3%
Final simplification88.3%
(FPCore (x y) :precision binary64 (if (<= (sinh y) -0.0001) (sinh y) (if (<= (sinh y) 0.002) (/ y (/ x (sin x))) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -0.0001) {
tmp = sinh(y);
} else if (sinh(y) <= 0.002) {
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) <= (-0.0001d0)) then
tmp = sinh(y)
else if (sinh(y) <= 0.002d0) 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) <= -0.0001) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 0.002) {
tmp = y / (x / Math.sin(x));
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -0.0001: tmp = math.sinh(y) elif math.sinh(y) <= 0.002: tmp = y / (x / math.sin(x)) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -0.0001) tmp = sinh(y); elseif (sinh(y) <= 0.002) 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) <= -0.0001) tmp = sinh(y); elseif (sinh(y) <= 0.002) tmp = y / (x / sin(x)); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -0.0001], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 0.002], 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 -0.0001:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 0.002:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -1.00000000000000005e-4 or 2e-3 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 76.4%
if -1.00000000000000005e-4 < (sinh.f64 y) < 2e-3Initial program 80.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 80.3%
associate-/l*99.4%
Simplified99.4%
Final simplification88.4%
(FPCore (x y)
:precision binary64
(if (<= (sinh y) -1e-11)
(sinh y)
(if (<= (sinh y) 2e-43)
(/ y (* x (+ (* x 0.16666666666666666) (/ 1.0 x))))
(sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -1e-11) {
tmp = sinh(y);
} else if (sinh(y) <= 2e-43) {
tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / 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) <= (-1d-11)) then
tmp = sinh(y)
else if (sinh(y) <= 2d-43) then
tmp = y / (x * ((x * 0.16666666666666666d0) + (1.0d0 / 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) <= -1e-11) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 2e-43) {
tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x)));
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -1e-11: tmp = math.sinh(y) elif math.sinh(y) <= 2e-43: tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x))) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -1e-11) tmp = sinh(y); elseif (sinh(y) <= 2e-43) tmp = Float64(y / Float64(x * Float64(Float64(x * 0.16666666666666666) + Float64(1.0 / x)))); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (sinh(y) <= -1e-11) tmp = sinh(y); elseif (sinh(y) <= 2e-43) tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x))); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -1e-11], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 2e-43], N[(y / N[(x * N[(N[(x * 0.16666666666666666), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -1 \cdot 10^{-11}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 2 \cdot 10^{-43}:\\
\;\;\;\;\frac{y}{x \cdot \left(x \cdot 0.16666666666666666 + \frac{1}{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -9.99999999999999939e-12 or 2.00000000000000015e-43 < (sinh.f64 y) Initial program 99.5%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 76.2%
if -9.99999999999999939e-12 < (sinh.f64 y) < 2.00000000000000015e-43Initial program 79.7%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 79.7%
associate-/l*99.9%
Simplified99.9%
clear-num99.9%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 77.5%
Final simplification76.8%
(FPCore (x y)
:precision binary64
(if (<= x 2.7)
(* x (/ y x))
(if (<= x 9.5e+241)
(sqrt (* y y))
(/ y (* x (+ (* x 0.16666666666666666) (/ 1.0 x)))))))
double code(double x, double y) {
double tmp;
if (x <= 2.7) {
tmp = x * (y / x);
} else if (x <= 9.5e+241) {
tmp = sqrt((y * y));
} else {
tmp = y / (x * ((x * 0.16666666666666666) + (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 (x <= 2.7d0) then
tmp = x * (y / x)
else if (x <= 9.5d+241) then
tmp = sqrt((y * y))
else
tmp = y / (x * ((x * 0.16666666666666666d0) + (1.0d0 / x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 2.7) {
tmp = x * (y / x);
} else if (x <= 9.5e+241) {
tmp = Math.sqrt((y * y));
} else {
tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x)));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 2.7: tmp = x * (y / x) elif x <= 9.5e+241: tmp = math.sqrt((y * y)) else: tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x))) return tmp
function code(x, y) tmp = 0.0 if (x <= 2.7) tmp = Float64(x * Float64(y / x)); elseif (x <= 9.5e+241) tmp = sqrt(Float64(y * y)); else tmp = Float64(y / Float64(x * Float64(Float64(x * 0.16666666666666666) + Float64(1.0 / x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 2.7) tmp = x * (y / x); elseif (x <= 9.5e+241) tmp = sqrt((y * y)); else tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 2.7], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.5e+241], N[Sqrt[N[(y * y), $MachinePrecision]], $MachinePrecision], N[(y / N[(x * N[(N[(x * 0.16666666666666666), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.7:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+241}:\\
\;\;\;\;\sqrt{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot \left(x \cdot 0.16666666666666666 + \frac{1}{x}\right)}\\
\end{array}
\end{array}
if x < 2.7000000000000002Initial program 86.7%
Taylor expanded in y around 0 38.1%
Taylor expanded in x around 0 28.5%
associate-/l*36.8%
associate-/r/60.9%
Applied egg-rr60.9%
if 2.7000000000000002 < x < 9.50000000000000019e241Initial program 99.7%
Taylor expanded in y around 0 56.0%
Taylor expanded in x around 0 17.6%
associate-/l*4.8%
*-inverses4.8%
/-rgt-identity4.8%
add-sqr-sqrt2.5%
sqrt-unprod35.5%
Applied egg-rr35.5%
if 9.50000000000000019e241 < x Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 80.4%
associate-/l*80.4%
Simplified80.4%
clear-num80.4%
associate-/r/80.4%
Applied egg-rr80.4%
Taylor expanded in x around 0 68.5%
Final simplification56.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (/ 1.0 y) (* y -0.16666666666666666))))
(if (<= x 6.8e+89)
(* x (/ y x))
(if (<= x 2.35e+154)
(* -0.16666666666666666 (* x (* x y)))
(if (<= x 9.2e+165)
(+ (/ 1.0 t_0) (* -0.16666666666666666 (/ (* x x) t_0)))
(/ y (* x (+ (* x 0.16666666666666666) (/ 1.0 x)))))))))
double code(double x, double y) {
double t_0 = (1.0 / y) + (y * -0.16666666666666666);
double tmp;
if (x <= 6.8e+89) {
tmp = x * (y / x);
} else if (x <= 2.35e+154) {
tmp = -0.16666666666666666 * (x * (x * y));
} else if (x <= 9.2e+165) {
tmp = (1.0 / t_0) + (-0.16666666666666666 * ((x * x) / t_0));
} else {
tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x)));
}
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 / y) + (y * (-0.16666666666666666d0))
if (x <= 6.8d+89) then
tmp = x * (y / x)
else if (x <= 2.35d+154) then
tmp = (-0.16666666666666666d0) * (x * (x * y))
else if (x <= 9.2d+165) then
tmp = (1.0d0 / t_0) + ((-0.16666666666666666d0) * ((x * x) / t_0))
else
tmp = y / (x * ((x * 0.16666666666666666d0) + (1.0d0 / x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (1.0 / y) + (y * -0.16666666666666666);
double tmp;
if (x <= 6.8e+89) {
tmp = x * (y / x);
} else if (x <= 2.35e+154) {
tmp = -0.16666666666666666 * (x * (x * y));
} else if (x <= 9.2e+165) {
tmp = (1.0 / t_0) + (-0.16666666666666666 * ((x * x) / t_0));
} else {
tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x)));
}
return tmp;
}
def code(x, y): t_0 = (1.0 / y) + (y * -0.16666666666666666) tmp = 0 if x <= 6.8e+89: tmp = x * (y / x) elif x <= 2.35e+154: tmp = -0.16666666666666666 * (x * (x * y)) elif x <= 9.2e+165: tmp = (1.0 / t_0) + (-0.16666666666666666 * ((x * x) / t_0)) else: tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x))) return tmp
function code(x, y) t_0 = Float64(Float64(1.0 / y) + Float64(y * -0.16666666666666666)) tmp = 0.0 if (x <= 6.8e+89) tmp = Float64(x * Float64(y / x)); elseif (x <= 2.35e+154) tmp = Float64(-0.16666666666666666 * Float64(x * Float64(x * y))); elseif (x <= 9.2e+165) tmp = Float64(Float64(1.0 / t_0) + Float64(-0.16666666666666666 * Float64(Float64(x * x) / t_0))); else tmp = Float64(y / Float64(x * Float64(Float64(x * 0.16666666666666666) + Float64(1.0 / x)))); end return tmp end
function tmp_2 = code(x, y) t_0 = (1.0 / y) + (y * -0.16666666666666666); tmp = 0.0; if (x <= 6.8e+89) tmp = x * (y / x); elseif (x <= 2.35e+154) tmp = -0.16666666666666666 * (x * (x * y)); elseif (x <= 9.2e+165) tmp = (1.0 / t_0) + (-0.16666666666666666 * ((x * x) / t_0)); else tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 / y), $MachinePrecision] + N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 6.8e+89], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.35e+154], N[(-0.16666666666666666 * N[(x * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.2e+165], N[(N[(1.0 / t$95$0), $MachinePrecision] + N[(-0.16666666666666666 * N[(N[(x * x), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * N[(N[(x * 0.16666666666666666), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{y} + y \cdot -0.16666666666666666\\
\mathbf{if}\;x \leq 6.8 \cdot 10^{+89}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq 2.35 \cdot 10^{+154}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(x \cdot \left(x \cdot y\right)\right)\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{+165}:\\
\;\;\;\;\frac{1}{t_0} + -0.16666666666666666 \cdot \frac{x \cdot x}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot \left(x \cdot 0.16666666666666666 + \frac{1}{x}\right)}\\
\end{array}
\end{array}
if x < 6.8000000000000004e89Initial program 87.6%
Taylor expanded in y around 0 39.3%
Taylor expanded in x around 0 26.7%
associate-/l*34.4%
associate-/r/57.1%
Applied egg-rr57.1%
if 6.8000000000000004e89 < x < 2.34999999999999992e154Initial program 99.7%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in y around 0 58.6%
associate-/l*58.7%
Simplified58.7%
Taylor expanded in x around 0 30.0%
+-commutative30.0%
fma-def30.0%
*-commutative30.0%
unpow230.0%
associate-*l*30.0%
*-commutative30.0%
Simplified30.0%
Taylor expanded in x around inf 30.0%
unpow230.0%
associate-*r*30.0%
Simplified30.0%
if 2.34999999999999992e154 < x < 9.20000000000000063e165Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 1.5%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
if 9.20000000000000063e165 < x Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 73.4%
associate-/l*73.5%
Simplified73.5%
clear-num73.4%
associate-/r/73.4%
Applied egg-rr73.4%
Taylor expanded in x around 0 62.2%
Final simplification56.9%
(FPCore (x y) :precision binary64 (if (or (<= y 8.8e+164) (not (<= y 3.5e+223))) (* x (/ y x)) (+ y (* (* x x) (* y -0.16666666666666666)))))
double code(double x, double y) {
double tmp;
if ((y <= 8.8e+164) || !(y <= 3.5e+223)) {
tmp = x * (y / x);
} else {
tmp = y + ((x * x) * (y * -0.16666666666666666));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= 8.8d+164) .or. (.not. (y <= 3.5d+223))) then
tmp = x * (y / x)
else
tmp = y + ((x * x) * (y * (-0.16666666666666666d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 8.8e+164) || !(y <= 3.5e+223)) {
tmp = x * (y / x);
} else {
tmp = y + ((x * x) * (y * -0.16666666666666666));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 8.8e+164) or not (y <= 3.5e+223): tmp = x * (y / x) else: tmp = y + ((x * x) * (y * -0.16666666666666666)) return tmp
function code(x, y) tmp = 0.0 if ((y <= 8.8e+164) || !(y <= 3.5e+223)) tmp = Float64(x * Float64(y / x)); else tmp = Float64(y + Float64(Float64(x * x) * Float64(y * -0.16666666666666666))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 8.8e+164) || ~((y <= 3.5e+223))) tmp = x * (y / x); else tmp = y + ((x * x) * (y * -0.16666666666666666)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 8.8e+164], N[Not[LessEqual[y, 3.5e+223]], $MachinePrecision]], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(y + N[(N[(x * x), $MachinePrecision] * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.8 \cdot 10^{+164} \lor \neg \left(y \leq 3.5 \cdot 10^{+223}\right):\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;y + \left(x \cdot x\right) \cdot \left(y \cdot -0.16666666666666666\right)\\
\end{array}
\end{array}
if y < 8.80000000000000022e164 or 3.5000000000000001e223 < y Initial program 89.7%
Taylor expanded in y around 0 45.6%
Taylor expanded in x around 0 25.7%
associate-/l*29.5%
associate-/r/55.5%
Applied egg-rr55.5%
if 8.80000000000000022e164 < y < 3.5000000000000001e223Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 3.8%
associate-/l*3.8%
Simplified3.8%
Taylor expanded in x around 0 68.0%
associate-*r*68.0%
*-commutative68.0%
unpow268.0%
Simplified68.0%
Final simplification55.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 90.1%
Taylor expanded in y around 0 44.2%
Taylor expanded in x around 0 25.3%
associate-/l*28.5%
associate-/r/54.3%
Applied egg-rr54.3%
Final simplification54.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 90.1%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 44.2%
associate-/l*54.1%
Simplified54.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 2023230
(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))