
(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 12 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 92.3%
associate-*l/100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (or (<= (sinh y) (- INFINITY)) (not (<= (sinh y) 2e-25))) (* (+ 1.0 (* -0.16666666666666666 (* x x))) (sinh y)) (* (/ (sin x) x) y)))
double code(double x, double y) {
double tmp;
if ((sinh(y) <= -((double) INFINITY)) || !(sinh(y) <= 2e-25)) {
tmp = (1.0 + (-0.16666666666666666 * (x * x))) * sinh(y);
} else {
tmp = (sin(x) / x) * y;
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if ((Math.sinh(y) <= -Double.POSITIVE_INFINITY) || !(Math.sinh(y) <= 2e-25)) {
tmp = (1.0 + (-0.16666666666666666 * (x * x))) * Math.sinh(y);
} else {
tmp = (Math.sin(x) / x) * y;
}
return tmp;
}
def code(x, y): tmp = 0 if (math.sinh(y) <= -math.inf) or not (math.sinh(y) <= 2e-25): tmp = (1.0 + (-0.16666666666666666 * (x * x))) * math.sinh(y) else: tmp = (math.sin(x) / x) * y return tmp
function code(x, y) tmp = 0.0 if ((sinh(y) <= Float64(-Inf)) || !(sinh(y) <= 2e-25)) tmp = Float64(Float64(1.0 + Float64(-0.16666666666666666 * Float64(x * x))) * sinh(y)); else tmp = Float64(Float64(sin(x) / x) * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((sinh(y) <= -Inf) || ~((sinh(y) <= 2e-25))) tmp = (1.0 + (-0.16666666666666666 * (x * x))) * sinh(y); else tmp = (sin(x) / x) * y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[N[Sinh[y], $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[Sinh[y], $MachinePrecision], 2e-25]], $MachinePrecision]], N[(N[(1.0 + N[(-0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -\infty \lor \neg \left(\sinh y \leq 2 \cdot 10^{-25}\right):\\
\;\;\;\;\left(1 + -0.16666666666666666 \cdot \left(x \cdot x\right)\right) \cdot \sinh y\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 2.00000000000000008e-25 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 79.6%
unpow223.1%
Simplified79.6%
if -inf.0 < (sinh.f64 y) < 2.00000000000000008e-25Initial program 84.0%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 99.7%
Final simplification89.3%
(FPCore (x y) :precision binary64 (if (<= (sinh y) (- INFINITY)) (sinh y) (if (<= (sinh y) 2e-25) (* (sin x) (/ y x)) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -((double) INFINITY)) {
tmp = sinh(y);
} else if (sinh(y) <= 2e-25) {
tmp = sin(x) * (y / x);
} 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) <= 2e-25) {
tmp = Math.sin(x) * (y / x);
} 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) <= 2e-25: tmp = math.sin(x) * (y / x) 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) <= 2e-25) 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) <= -Inf) tmp = sinh(y); elseif (sinh(y) <= 2e-25) tmp = sin(x) * (y / x); 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], 2e-25], 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 -\infty:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 2 \cdot 10^{-25}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 2.00000000000000008e-25 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 73.5%
if -inf.0 < (sinh.f64 y) < 2.00000000000000008e-25Initial program 84.0%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 83.8%
associate-/l*99.7%
associate-/r/99.5%
Simplified99.5%
Final simplification86.1%
(FPCore (x y) :precision binary64 (if (<= (sinh y) (- INFINITY)) (sinh y) (if (<= (sinh y) 2e-25) (* (/ (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) <= 2e-25) {
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) <= 2e-25) {
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) <= 2e-25: 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) <= 2e-25) 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) <= 2e-25) 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], 2e-25], 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 2 \cdot 10^{-25}:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 2.00000000000000008e-25 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 73.5%
if -inf.0 < (sinh.f64 y) < 2.00000000000000008e-25Initial program 84.0%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 99.7%
Final simplification86.2%
(FPCore (x y)
:precision binary64
(if (<= (sinh y) (- INFINITY))
(sinh y)
(if (<= (sinh y) 2e-25)
(/ 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) <= 2e-25) {
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) <= 2e-25) {
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) <= 2e-25: 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) <= 2e-25) 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) <= 2e-25) 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], 2e-25], 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 2 \cdot 10^{-25}:\\
\;\;\;\;\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 2.00000000000000008e-25 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 73.5%
if -inf.0 < (sinh.f64 y) < 2.00000000000000008e-25Initial program 84.0%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 83.8%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in x around 0 73.2%
unpow273.2%
Simplified73.2%
Final simplification73.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 6.0 (/ y (* x x)))))
(if (<= y -4.3e-35)
(* (/ y x) (/ 6.0 x))
(if (<= y 1.8)
(/ y (+ 1.0 (* (* x x) 0.16666666666666666)))
(if (<= y 3.4e+44)
t_0
(if (<= y 1.9e+77)
(* -0.16666666666666666 (* y (* x x)))
(if (<= y 5.1e+149) t_0 (sqrt (* y y)))))))))
double code(double x, double y) {
double t_0 = 6.0 * (y / (x * x));
double tmp;
if (y <= -4.3e-35) {
tmp = (y / x) * (6.0 / x);
} else if (y <= 1.8) {
tmp = y / (1.0 + ((x * x) * 0.16666666666666666));
} else if (y <= 3.4e+44) {
tmp = t_0;
} else if (y <= 1.9e+77) {
tmp = -0.16666666666666666 * (y * (x * x));
} else if (y <= 5.1e+149) {
tmp = t_0;
} 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) :: tmp
t_0 = 6.0d0 * (y / (x * x))
if (y <= (-4.3d-35)) then
tmp = (y / x) * (6.0d0 / x)
else if (y <= 1.8d0) then
tmp = y / (1.0d0 + ((x * x) * 0.16666666666666666d0))
else if (y <= 3.4d+44) then
tmp = t_0
else if (y <= 1.9d+77) then
tmp = (-0.16666666666666666d0) * (y * (x * x))
else if (y <= 5.1d+149) then
tmp = t_0
else
tmp = sqrt((y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 6.0 * (y / (x * x));
double tmp;
if (y <= -4.3e-35) {
tmp = (y / x) * (6.0 / x);
} else if (y <= 1.8) {
tmp = y / (1.0 + ((x * x) * 0.16666666666666666));
} else if (y <= 3.4e+44) {
tmp = t_0;
} else if (y <= 1.9e+77) {
tmp = -0.16666666666666666 * (y * (x * x));
} else if (y <= 5.1e+149) {
tmp = t_0;
} else {
tmp = Math.sqrt((y * y));
}
return tmp;
}
def code(x, y): t_0 = 6.0 * (y / (x * x)) tmp = 0 if y <= -4.3e-35: tmp = (y / x) * (6.0 / x) elif y <= 1.8: tmp = y / (1.0 + ((x * x) * 0.16666666666666666)) elif y <= 3.4e+44: tmp = t_0 elif y <= 1.9e+77: tmp = -0.16666666666666666 * (y * (x * x)) elif y <= 5.1e+149: tmp = t_0 else: tmp = math.sqrt((y * y)) return tmp
function code(x, y) t_0 = Float64(6.0 * Float64(y / Float64(x * x))) tmp = 0.0 if (y <= -4.3e-35) tmp = Float64(Float64(y / x) * Float64(6.0 / x)); elseif (y <= 1.8) tmp = Float64(y / Float64(1.0 + Float64(Float64(x * x) * 0.16666666666666666))); elseif (y <= 3.4e+44) tmp = t_0; elseif (y <= 1.9e+77) tmp = Float64(-0.16666666666666666 * Float64(y * Float64(x * x))); elseif (y <= 5.1e+149) tmp = t_0; else tmp = sqrt(Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) t_0 = 6.0 * (y / (x * x)); tmp = 0.0; if (y <= -4.3e-35) tmp = (y / x) * (6.0 / x); elseif (y <= 1.8) tmp = y / (1.0 + ((x * x) * 0.16666666666666666)); elseif (y <= 3.4e+44) tmp = t_0; elseif (y <= 1.9e+77) tmp = -0.16666666666666666 * (y * (x * x)); elseif (y <= 5.1e+149) tmp = t_0; else tmp = sqrt((y * y)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(6.0 * N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.3e-35], N[(N[(y / x), $MachinePrecision] * N[(6.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8], N[(y / N[(1.0 + N[(N[(x * x), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.4e+44], t$95$0, If[LessEqual[y, 1.9e+77], N[(-0.16666666666666666 * N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.1e+149], t$95$0, N[Sqrt[N[(y * y), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \frac{y}{x \cdot x}\\
\mathbf{if}\;y \leq -4.3 \cdot 10^{-35}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{6}{x}\\
\mathbf{elif}\;y \leq 1.8:\\
\;\;\;\;\frac{y}{1 + \left(x \cdot x\right) \cdot 0.16666666666666666}\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+77}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(y \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;y \leq 5.1 \cdot 10^{+149}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{y \cdot y}\\
\end{array}
\end{array}
if y < -4.3000000000000002e-35Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 13.3%
associate-/l*13.2%
Simplified13.2%
Taylor expanded in x around 0 3.8%
unpow23.8%
Simplified3.8%
Taylor expanded in x around inf 41.6%
associate-*r/41.6%
unpow241.6%
times-frac41.6%
Simplified41.6%
if -4.3000000000000002e-35 < y < 1.80000000000000004Initial program 83.4%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 82.8%
associate-/l*99.3%
Simplified99.3%
Taylor expanded in x around 0 77.1%
unpow277.1%
Simplified77.1%
if 1.80000000000000004 < y < 3.4e44 or 1.9000000000000001e77 < y < 5.0999999999999997e149Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.1%
associate-/l*4.1%
Simplified4.1%
Taylor expanded in x around 0 2.9%
unpow22.9%
Simplified2.9%
Taylor expanded in x around inf 44.7%
unpow244.7%
Simplified44.7%
if 3.4e44 < y < 1.9000000000000001e77Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 2.6%
Taylor expanded in x around 0 51.7%
unpow251.7%
Simplified51.7%
Taylor expanded in x around inf 51.7%
*-commutative51.7%
*-commutative51.7%
associate-*r*51.7%
unpow251.7%
associate-*l*51.7%
Simplified51.7%
Taylor expanded in y around 0 51.7%
unpow251.7%
*-commutative51.7%
Simplified51.7%
if 5.0999999999999997e149 < y Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.9%
associate-/l*4.9%
associate-/r/24.7%
Simplified24.7%
Taylor expanded in x around 0 24.7%
*-commutative24.7%
clear-num24.7%
un-div-inv24.7%
Applied egg-rr24.7%
associate-/r/4.9%
*-inverses4.9%
*-un-lft-identity4.9%
add-sqr-sqrt4.9%
sqrt-unprod71.6%
Applied egg-rr71.6%
Final simplification62.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 6.0 (/ y (* x x)))))
(if (<= y -4.3e-35)
t_0
(if (<= y 1.8)
(/ x (/ x y))
(if (or (<= y 6e+44) (not (<= y 1.5e+81)))
t_0
(* -0.16666666666666666 (* y (* x x))))))))
double code(double x, double y) {
double t_0 = 6.0 * (y / (x * x));
double tmp;
if (y <= -4.3e-35) {
tmp = t_0;
} else if (y <= 1.8) {
tmp = x / (x / y);
} else if ((y <= 6e+44) || !(y <= 1.5e+81)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = 6.0d0 * (y / (x * x))
if (y <= (-4.3d-35)) then
tmp = t_0
else if (y <= 1.8d0) then
tmp = x / (x / y)
else if ((y <= 6d+44) .or. (.not. (y <= 1.5d+81))) then
tmp = t_0
else
tmp = (-0.16666666666666666d0) * (y * (x * x))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 6.0 * (y / (x * x));
double tmp;
if (y <= -4.3e-35) {
tmp = t_0;
} else if (y <= 1.8) {
tmp = x / (x / y);
} else if ((y <= 6e+44) || !(y <= 1.5e+81)) {
tmp = t_0;
} else {
tmp = -0.16666666666666666 * (y * (x * x));
}
return tmp;
}
def code(x, y): t_0 = 6.0 * (y / (x * x)) tmp = 0 if y <= -4.3e-35: tmp = t_0 elif y <= 1.8: tmp = x / (x / y) elif (y <= 6e+44) or not (y <= 1.5e+81): tmp = t_0 else: tmp = -0.16666666666666666 * (y * (x * x)) return tmp
function code(x, y) t_0 = Float64(6.0 * Float64(y / Float64(x * x))) tmp = 0.0 if (y <= -4.3e-35) tmp = t_0; elseif (y <= 1.8) tmp = Float64(x / Float64(x / y)); elseif ((y <= 6e+44) || !(y <= 1.5e+81)) tmp = t_0; else tmp = Float64(-0.16666666666666666 * Float64(y * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y) t_0 = 6.0 * (y / (x * x)); tmp = 0.0; if (y <= -4.3e-35) tmp = t_0; elseif (y <= 1.8) tmp = x / (x / y); elseif ((y <= 6e+44) || ~((y <= 1.5e+81))) tmp = t_0; else tmp = -0.16666666666666666 * (y * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(6.0 * N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.3e-35], t$95$0, If[LessEqual[y, 1.8], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 6e+44], N[Not[LessEqual[y, 1.5e+81]], $MachinePrecision]], t$95$0, N[(-0.16666666666666666 * N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \frac{y}{x \cdot x}\\
\mathbf{if}\;y \leq -4.3 \cdot 10^{-35}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.8:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+44} \lor \neg \left(y \leq 1.5 \cdot 10^{+81}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(y \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if y < -4.3000000000000002e-35 or 1.80000000000000004 < y < 5.99999999999999974e44 or 1.49999999999999999e81 < y Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 9.5%
associate-/l*9.4%
Simplified9.4%
Taylor expanded in x around 0 3.7%
unpow23.7%
Simplified3.7%
Taylor expanded in x around inf 40.7%
unpow240.7%
Simplified40.7%
if -4.3000000000000002e-35 < y < 1.80000000000000004Initial program 83.4%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 82.8%
associate-/l*99.3%
associate-/r/99.1%
Simplified99.1%
Taylor expanded in x around 0 75.5%
*-commutative75.5%
clear-num75.8%
un-div-inv76.0%
Applied egg-rr76.0%
if 5.99999999999999974e44 < y < 1.49999999999999999e81Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 2.6%
Taylor expanded in x around 0 51.7%
unpow251.7%
Simplified51.7%
Taylor expanded in x around inf 51.7%
*-commutative51.7%
*-commutative51.7%
associate-*r*51.7%
unpow251.7%
associate-*l*51.7%
Simplified51.7%
Taylor expanded in y around 0 51.7%
unpow251.7%
*-commutative51.7%
Simplified51.7%
Final simplification57.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (/ y x) (/ 6.0 x))))
(if (<= y -4.3e-35)
t_0
(if (<= y 1.8)
(/ x (/ x y))
(if (<= y 5.2e+44)
(* 6.0 (/ y (* x x)))
(if (<= y 1.7e+79) (* -0.16666666666666666 (* y (* x x))) t_0))))))
double code(double x, double y) {
double t_0 = (y / x) * (6.0 / x);
double tmp;
if (y <= -4.3e-35) {
tmp = t_0;
} else if (y <= 1.8) {
tmp = x / (x / y);
} else if (y <= 5.2e+44) {
tmp = 6.0 * (y / (x * x));
} else if (y <= 1.7e+79) {
tmp = -0.16666666666666666 * (y * (x * x));
} 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 = (y / x) * (6.0d0 / x)
if (y <= (-4.3d-35)) then
tmp = t_0
else if (y <= 1.8d0) then
tmp = x / (x / y)
else if (y <= 5.2d+44) then
tmp = 6.0d0 * (y / (x * x))
else if (y <= 1.7d+79) then
tmp = (-0.16666666666666666d0) * (y * (x * x))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y / x) * (6.0 / x);
double tmp;
if (y <= -4.3e-35) {
tmp = t_0;
} else if (y <= 1.8) {
tmp = x / (x / y);
} else if (y <= 5.2e+44) {
tmp = 6.0 * (y / (x * x));
} else if (y <= 1.7e+79) {
tmp = -0.16666666666666666 * (y * (x * x));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (y / x) * (6.0 / x) tmp = 0 if y <= -4.3e-35: tmp = t_0 elif y <= 1.8: tmp = x / (x / y) elif y <= 5.2e+44: tmp = 6.0 * (y / (x * x)) elif y <= 1.7e+79: tmp = -0.16666666666666666 * (y * (x * x)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(y / x) * Float64(6.0 / x)) tmp = 0.0 if (y <= -4.3e-35) tmp = t_0; elseif (y <= 1.8) tmp = Float64(x / Float64(x / y)); elseif (y <= 5.2e+44) tmp = Float64(6.0 * Float64(y / Float64(x * x))); elseif (y <= 1.7e+79) tmp = Float64(-0.16666666666666666 * Float64(y * Float64(x * x))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (y / x) * (6.0 / x); tmp = 0.0; if (y <= -4.3e-35) tmp = t_0; elseif (y <= 1.8) tmp = x / (x / y); elseif (y <= 5.2e+44) tmp = 6.0 * (y / (x * x)); elseif (y <= 1.7e+79) tmp = -0.16666666666666666 * (y * (x * x)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y / x), $MachinePrecision] * N[(6.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.3e-35], t$95$0, If[LessEqual[y, 1.8], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.2e+44], N[(6.0 * N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.7e+79], N[(-0.16666666666666666 * N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{x} \cdot \frac{6}{x}\\
\mathbf{if}\;y \leq -4.3 \cdot 10^{-35}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.8:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+44}:\\
\;\;\;\;6 \cdot \frac{y}{x \cdot x}\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{+79}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(y \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -4.3000000000000002e-35 or 1.70000000000000016e79 < y Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 10.0%
associate-/l*9.9%
Simplified9.9%
Taylor expanded in x around 0 3.7%
unpow23.7%
Simplified3.7%
Taylor expanded in x around inf 41.1%
associate-*r/41.1%
unpow241.1%
times-frac41.1%
Simplified41.1%
if -4.3000000000000002e-35 < y < 1.80000000000000004Initial program 83.4%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 82.8%
associate-/l*99.3%
associate-/r/99.1%
Simplified99.1%
Taylor expanded in x around 0 75.5%
*-commutative75.5%
clear-num75.8%
un-div-inv76.0%
Applied egg-rr76.0%
if 1.80000000000000004 < y < 5.1999999999999998e44Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.5%
associate-/l*4.5%
Simplified4.5%
Taylor expanded in x around 0 2.9%
unpow22.9%
Simplified2.9%
Taylor expanded in x around inf 36.5%
unpow236.5%
Simplified36.5%
if 5.1999999999999998e44 < y < 1.70000000000000016e79Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 2.6%
Taylor expanded in x around 0 51.7%
unpow251.7%
Simplified51.7%
Taylor expanded in x around inf 51.7%
*-commutative51.7%
*-commutative51.7%
associate-*r*51.7%
unpow251.7%
associate-*l*51.7%
Simplified51.7%
Taylor expanded in y around 0 51.7%
unpow251.7%
*-commutative51.7%
Simplified51.7%
Final simplification57.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (/ y x) (/ 6.0 x))))
(if (<= y -4.3e-35)
t_0
(if (<= y 1.8)
(/ y (+ 1.0 (* (* x x) 0.16666666666666666)))
(if (<= y 6e+39)
(* 6.0 (/ y (* x x)))
(if (<= y 1.4e+77) (* -0.16666666666666666 (* y (* x x))) t_0))))))
double code(double x, double y) {
double t_0 = (y / x) * (6.0 / x);
double tmp;
if (y <= -4.3e-35) {
tmp = t_0;
} else if (y <= 1.8) {
tmp = y / (1.0 + ((x * x) * 0.16666666666666666));
} else if (y <= 6e+39) {
tmp = 6.0 * (y / (x * x));
} else if (y <= 1.4e+77) {
tmp = -0.16666666666666666 * (y * (x * x));
} 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 = (y / x) * (6.0d0 / x)
if (y <= (-4.3d-35)) then
tmp = t_0
else if (y <= 1.8d0) then
tmp = y / (1.0d0 + ((x * x) * 0.16666666666666666d0))
else if (y <= 6d+39) then
tmp = 6.0d0 * (y / (x * x))
else if (y <= 1.4d+77) then
tmp = (-0.16666666666666666d0) * (y * (x * x))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y / x) * (6.0 / x);
double tmp;
if (y <= -4.3e-35) {
tmp = t_0;
} else if (y <= 1.8) {
tmp = y / (1.0 + ((x * x) * 0.16666666666666666));
} else if (y <= 6e+39) {
tmp = 6.0 * (y / (x * x));
} else if (y <= 1.4e+77) {
tmp = -0.16666666666666666 * (y * (x * x));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (y / x) * (6.0 / x) tmp = 0 if y <= -4.3e-35: tmp = t_0 elif y <= 1.8: tmp = y / (1.0 + ((x * x) * 0.16666666666666666)) elif y <= 6e+39: tmp = 6.0 * (y / (x * x)) elif y <= 1.4e+77: tmp = -0.16666666666666666 * (y * (x * x)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(y / x) * Float64(6.0 / x)) tmp = 0.0 if (y <= -4.3e-35) tmp = t_0; elseif (y <= 1.8) tmp = Float64(y / Float64(1.0 + Float64(Float64(x * x) * 0.16666666666666666))); elseif (y <= 6e+39) tmp = Float64(6.0 * Float64(y / Float64(x * x))); elseif (y <= 1.4e+77) tmp = Float64(-0.16666666666666666 * Float64(y * Float64(x * x))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (y / x) * (6.0 / x); tmp = 0.0; if (y <= -4.3e-35) tmp = t_0; elseif (y <= 1.8) tmp = y / (1.0 + ((x * x) * 0.16666666666666666)); elseif (y <= 6e+39) tmp = 6.0 * (y / (x * x)); elseif (y <= 1.4e+77) tmp = -0.16666666666666666 * (y * (x * x)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y / x), $MachinePrecision] * N[(6.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.3e-35], t$95$0, If[LessEqual[y, 1.8], N[(y / N[(1.0 + N[(N[(x * x), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e+39], N[(6.0 * N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+77], N[(-0.16666666666666666 * N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{x} \cdot \frac{6}{x}\\
\mathbf{if}\;y \leq -4.3 \cdot 10^{-35}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.8:\\
\;\;\;\;\frac{y}{1 + \left(x \cdot x\right) \cdot 0.16666666666666666}\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+39}:\\
\;\;\;\;6 \cdot \frac{y}{x \cdot x}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+77}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(y \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -4.3000000000000002e-35 or 1.4e77 < y Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 10.0%
associate-/l*9.9%
Simplified9.9%
Taylor expanded in x around 0 3.7%
unpow23.7%
Simplified3.7%
Taylor expanded in x around inf 41.1%
associate-*r/41.1%
unpow241.1%
times-frac41.1%
Simplified41.1%
if -4.3000000000000002e-35 < y < 1.80000000000000004Initial program 83.4%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 82.8%
associate-/l*99.3%
Simplified99.3%
Taylor expanded in x around 0 77.1%
unpow277.1%
Simplified77.1%
if 1.80000000000000004 < y < 5.9999999999999999e39Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.5%
associate-/l*4.5%
Simplified4.5%
Taylor expanded in x around 0 2.9%
unpow22.9%
Simplified2.9%
Taylor expanded in x around inf 36.5%
unpow236.5%
Simplified36.5%
if 5.9999999999999999e39 < y < 1.4e77Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 2.6%
Taylor expanded in x around 0 51.7%
unpow251.7%
Simplified51.7%
Taylor expanded in x around inf 51.7%
*-commutative51.7%
*-commutative51.7%
associate-*r*51.7%
unpow251.7%
associate-*l*51.7%
Simplified51.7%
Taylor expanded in y around 0 51.7%
unpow251.7%
*-commutative51.7%
Simplified51.7%
Final simplification57.9%
(FPCore (x y) :precision binary64 (if (<= x 7.2e+131) (* x (/ y x)) (if (<= x 1.4e+151) (* -0.16666666666666666 (* y (* x x))) (/ x (/ x y)))))
double code(double x, double y) {
double tmp;
if (x <= 7.2e+131) {
tmp = x * (y / x);
} else if (x <= 1.4e+151) {
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 (x <= 7.2d+131) then
tmp = x * (y / x)
else if (x <= 1.4d+151) 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 (x <= 7.2e+131) {
tmp = x * (y / x);
} else if (x <= 1.4e+151) {
tmp = -0.16666666666666666 * (y * (x * x));
} else {
tmp = x / (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 7.2e+131: tmp = x * (y / x) elif x <= 1.4e+151: tmp = -0.16666666666666666 * (y * (x * x)) else: tmp = x / (x / y) return tmp
function code(x, y) tmp = 0.0 if (x <= 7.2e+131) tmp = Float64(x * Float64(y / x)); elseif (x <= 1.4e+151) 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 (x <= 7.2e+131) tmp = x * (y / x); elseif (x <= 1.4e+151) tmp = -0.16666666666666666 * (y * (x * x)); else tmp = x / (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 7.2e+131], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.4e+151], 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}\;x \leq 7.2 \cdot 10^{+131}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+151}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(y \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\end{array}
\end{array}
if x < 7.20000000000000063e131Initial program 90.8%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 41.0%
associate-/l*50.2%
associate-/r/63.6%
Simplified63.6%
Taylor expanded in x around 0 52.0%
if 7.20000000000000063e131 < x < 1.39999999999999994e151Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 17.4%
Taylor expanded in x around 0 71.6%
unpow271.6%
Simplified71.6%
Taylor expanded in x around inf 71.6%
*-commutative71.6%
*-commutative71.6%
associate-*r*71.6%
unpow271.6%
associate-*l*71.6%
Simplified71.6%
Taylor expanded in y around 0 71.6%
unpow271.6%
*-commutative71.6%
Simplified71.6%
if 1.39999999999999994e151 < x Initial program 99.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 63.8%
associate-/l*63.7%
associate-/r/63.7%
Simplified63.7%
Taylor expanded in x around 0 35.8%
*-commutative35.8%
clear-num35.8%
un-div-inv35.8%
Applied egg-rr35.8%
Final simplification50.5%
(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 92.3%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 43.3%
associate-/l*51.0%
associate-/r/62.3%
Simplified62.3%
Taylor expanded in x around 0 48.6%
Final simplification48.6%
(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 92.3%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 43.3%
associate-/l*51.0%
associate-/r/62.3%
Simplified62.3%
Taylor expanded in x around 0 26.2%
Final simplification26.2%
(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 2023275
(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))