
(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 13 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) (- INFINITY)) (sinh y) (if (<= (sinh y) 2e-12) (* (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-12) {
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-12) {
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-12: 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-12) 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-12) 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-12], 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^{-12}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 1.99999999999999996e-12 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 77.3%
if -inf.0 < (sinh.f64 y) < 1.99999999999999996e-12Initial program 71.2%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 70.9%
associate-/l*99.6%
associate-/r/99.4%
Simplified99.4%
Final simplification88.0%
(FPCore (x y) :precision binary64 (if (<= (sinh y) (- INFINITY)) (sinh y) (if (<= (sinh y) 2e-12) (* (/ (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-12) {
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-12) {
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-12: 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-12) 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-12) 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-12], 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^{-12}:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 1.99999999999999996e-12 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 77.3%
if -inf.0 < (sinh.f64 y) < 1.99999999999999996e-12Initial program 71.2%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 70.9%
associate-/l*99.6%
Simplified99.6%
clear-num99.3%
associate-/r/99.6%
clear-num99.6%
Applied egg-rr99.6%
Final simplification88.1%
(FPCore (x y) :precision binary64 (if (<= (sinh y) (- INFINITY)) (sinh y) (if (<= (sinh y) 2e-12) (/ y (/ x (sin x))) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -((double) INFINITY)) {
tmp = sinh(y);
} else if (sinh(y) <= 2e-12) {
tmp = y / (x / sin(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-12) {
tmp = y / (x / Math.sin(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-12: tmp = y / (x / math.sin(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-12) 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) <= -Inf) tmp = sinh(y); elseif (sinh(y) <= 2e-12) tmp = y / (x / sin(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-12], 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 -\infty:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 1.99999999999999996e-12 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 77.3%
if -inf.0 < (sinh.f64 y) < 1.99999999999999996e-12Initial program 71.2%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 70.9%
associate-/l*99.6%
Simplified99.6%
Final simplification88.1%
(FPCore (x y)
:precision binary64
(if (<= (sinh y) (- INFINITY))
(sinh y)
(if (<= (sinh y) 1e-114)
(/ (/ y x) (+ (* x 0.16666666666666666) (/ 1.0 x)))
(sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -((double) INFINITY)) {
tmp = sinh(y);
} else if (sinh(y) <= 1e-114) {
tmp = (y / x) / ((x * 0.16666666666666666) + (1.0 / 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) <= 1e-114) {
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) <= -math.inf: tmp = math.sinh(y) elif math.sinh(y) <= 1e-114: 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) <= Float64(-Inf)) tmp = sinh(y); elseif (sinh(y) <= 1e-114) tmp = Float64(Float64(y / 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) <= -Inf) tmp = sinh(y); elseif (sinh(y) <= 1e-114) 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], (-Infinity)], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 1e-114], N[(N[(y / x), $MachinePrecision] / N[(N[(x * 0.16666666666666666), $MachinePrecision] + N[(1.0 / x), $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 10^{-114}:\\
\;\;\;\;\frac{\frac{y}{x}}{x \cdot 0.16666666666666666 + \frac{1}{x}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 1.0000000000000001e-114 < (sinh.f64 y) Initial program 98.1%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 78.0%
if -inf.0 < (sinh.f64 y) < 1.0000000000000001e-114Initial program 67.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 67.5%
associate-/l*99.5%
associate-/r/99.4%
Simplified99.4%
associate-/r/99.5%
div-inv99.3%
associate-/r*99.2%
Applied egg-rr99.2%
Taylor expanded in x around 0 81.8%
Final simplification79.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}
Initial program 86.0%
associate-*r/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= y -2.2e+179)
(/ (* y (- y)) (- (* y (* x (* x -0.16666666666666666))) y))
(if (or (<= y -7.5e+166) (not (<= y 1.25e+169)))
(sqrt (* y y))
(* x (/ 1.0 (/ x y))))))
double code(double x, double y) {
double tmp;
if (y <= -2.2e+179) {
tmp = (y * -y) / ((y * (x * (x * -0.16666666666666666))) - y);
} else if ((y <= -7.5e+166) || !(y <= 1.25e+169)) {
tmp = sqrt((y * y));
} else {
tmp = x * (1.0 / (x / y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-2.2d+179)) then
tmp = (y * -y) / ((y * (x * (x * (-0.16666666666666666d0)))) - y)
else if ((y <= (-7.5d+166)) .or. (.not. (y <= 1.25d+169))) then
tmp = sqrt((y * y))
else
tmp = x * (1.0d0 / (x / y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.2e+179) {
tmp = (y * -y) / ((y * (x * (x * -0.16666666666666666))) - y);
} else if ((y <= -7.5e+166) || !(y <= 1.25e+169)) {
tmp = Math.sqrt((y * y));
} else {
tmp = x * (1.0 / (x / y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.2e+179: tmp = (y * -y) / ((y * (x * (x * -0.16666666666666666))) - y) elif (y <= -7.5e+166) or not (y <= 1.25e+169): tmp = math.sqrt((y * y)) else: tmp = x * (1.0 / (x / y)) return tmp
function code(x, y) tmp = 0.0 if (y <= -2.2e+179) tmp = Float64(Float64(y * Float64(-y)) / Float64(Float64(y * Float64(x * Float64(x * -0.16666666666666666))) - y)); elseif ((y <= -7.5e+166) || !(y <= 1.25e+169)) tmp = sqrt(Float64(y * y)); else tmp = Float64(x * Float64(1.0 / Float64(x / y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.2e+179) tmp = (y * -y) / ((y * (x * (x * -0.16666666666666666))) - y); elseif ((y <= -7.5e+166) || ~((y <= 1.25e+169))) tmp = sqrt((y * y)); else tmp = x * (1.0 / (x / y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.2e+179], N[(N[(y * (-y)), $MachinePrecision] / N[(N[(y * N[(x * N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -7.5e+166], N[Not[LessEqual[y, 1.25e+169]], $MachinePrecision]], N[Sqrt[N[(y * y), $MachinePrecision]], $MachinePrecision], N[(x * N[(1.0 / N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+179}:\\
\;\;\;\;\frac{y \cdot \left(-y\right)}{y \cdot \left(x \cdot \left(x \cdot -0.16666666666666666\right)\right) - y}\\
\mathbf{elif}\;y \leq -7.5 \cdot 10^{+166} \lor \neg \left(y \leq 1.25 \cdot 10^{+169}\right):\\
\;\;\;\;\sqrt{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{\frac{x}{y}}\\
\end{array}
\end{array}
if y < -2.2e179Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 6.7%
associate-/l*6.7%
associate-/r/59.2%
Simplified59.2%
Taylor expanded in x around 0 14.5%
+-commutative14.5%
remove-double-neg14.5%
unsub-neg14.5%
*-commutative14.5%
associate-*l*14.5%
fma-neg14.5%
unpow214.5%
remove-double-neg14.5%
Simplified14.5%
fma-udef14.5%
flip-+47.6%
*-commutative47.6%
associate-*l*47.6%
*-commutative47.6%
associate-*l*47.6%
*-commutative47.6%
associate-*l*47.6%
Applied egg-rr47.6%
Taylor expanded in x around 0 66.7%
unpow266.7%
neg-mul-166.7%
distribute-rgt-neg-in66.7%
Simplified66.7%
if -2.2e179 < y < -7.50000000000000029e166 or 1.25000000000000004e169 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 5.3%
Taylor expanded in x around 0 22.5%
div-inv22.5%
associate-*l*4.6%
div-inv4.6%
*-inverses4.6%
*-commutative4.6%
*-un-lft-identity4.6%
add-sqr-sqrt4.5%
sqrt-unprod80.6%
Applied egg-rr80.6%
if -7.50000000000000029e166 < y < 1.25000000000000004e169Initial program 82.5%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 44.8%
Taylor expanded in x around 0 25.8%
div-inv26.2%
*-commutative26.2%
associate-*l*58.3%
Applied egg-rr58.3%
div-inv58.4%
clear-num59.1%
Applied egg-rr59.1%
Final simplification62.4%
(FPCore (x y)
:precision binary64
(if (<= x -3.7e+137)
(/ x (/ x y))
(if (<= x -3.1e+91)
(* x (* x (* y -0.16666666666666666)))
(if (<= x 9e-92)
(* x (/ y x))
(+ y (* (* y -0.16666666666666666) (* x x)))))))
double code(double x, double y) {
double tmp;
if (x <= -3.7e+137) {
tmp = x / (x / y);
} else if (x <= -3.1e+91) {
tmp = x * (x * (y * -0.16666666666666666));
} else if (x <= 9e-92) {
tmp = x * (y / x);
} else {
tmp = y + ((y * -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 (x <= (-3.7d+137)) then
tmp = x / (x / y)
else if (x <= (-3.1d+91)) then
tmp = x * (x * (y * (-0.16666666666666666d0)))
else if (x <= 9d-92) then
tmp = x * (y / x)
else
tmp = y + ((y * (-0.16666666666666666d0)) * (x * x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -3.7e+137) {
tmp = x / (x / y);
} else if (x <= -3.1e+91) {
tmp = x * (x * (y * -0.16666666666666666));
} else if (x <= 9e-92) {
tmp = x * (y / x);
} else {
tmp = y + ((y * -0.16666666666666666) * (x * x));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3.7e+137: tmp = x / (x / y) elif x <= -3.1e+91: tmp = x * (x * (y * -0.16666666666666666)) elif x <= 9e-92: tmp = x * (y / x) else: tmp = y + ((y * -0.16666666666666666) * (x * x)) return tmp
function code(x, y) tmp = 0.0 if (x <= -3.7e+137) tmp = Float64(x / Float64(x / y)); elseif (x <= -3.1e+91) tmp = Float64(x * Float64(x * Float64(y * -0.16666666666666666))); elseif (x <= 9e-92) tmp = Float64(x * Float64(y / x)); else tmp = Float64(y + Float64(Float64(y * -0.16666666666666666) * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3.7e+137) tmp = x / (x / y); elseif (x <= -3.1e+91) tmp = x * (x * (y * -0.16666666666666666)); elseif (x <= 9e-92) tmp = x * (y / x); else tmp = y + ((y * -0.16666666666666666) * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3.7e+137], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.1e+91], N[(x * N[(x * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9e-92], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(y + N[(N[(y * -0.16666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{+137}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{elif}\;x \leq -3.1 \cdot 10^{+91}:\\
\;\;\;\;x \cdot \left(x \cdot \left(y \cdot -0.16666666666666666\right)\right)\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-92}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;y + \left(y \cdot -0.16666666666666666\right) \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < -3.7000000000000002e137Initial program 99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 56.6%
Taylor expanded in x around 0 25.8%
associate-/l*4.9%
associate-/r/41.3%
Applied egg-rr41.3%
associate-*l/25.8%
*-commutative25.8%
associate-/l*43.5%
Applied egg-rr43.5%
if -3.7000000000000002e137 < x < -3.09999999999999998e91Initial program 99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 27.3%
associate-/l*27.5%
associate-/r/27.3%
Simplified27.3%
Taylor expanded in x around 0 51.5%
+-commutative51.5%
remove-double-neg51.5%
unsub-neg51.5%
*-commutative51.5%
associate-*l*51.5%
fma-neg51.5%
unpow251.5%
remove-double-neg51.5%
Simplified51.5%
fma-udef51.5%
flip-+13.1%
*-commutative13.1%
associate-*l*13.1%
*-commutative13.1%
associate-*l*13.1%
*-commutative13.1%
associate-*l*13.1%
Applied egg-rr13.1%
Taylor expanded in x around inf 51.5%
*-commutative51.5%
*-commutative51.5%
unpow251.5%
associate-*l*51.5%
*-commutative51.5%
associate-*r*51.5%
*-commutative51.5%
associate-*l*51.5%
Simplified51.5%
if -3.09999999999999998e91 < x < 9.0000000000000001e-92Initial program 75.1%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 30.1%
Taylor expanded in x around 0 23.9%
associate-/l*48.2%
associate-/r/75.1%
Applied egg-rr75.1%
if 9.0000000000000001e-92 < x Initial program 98.6%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 41.3%
associate-/l*42.6%
associate-/r/42.6%
Simplified42.6%
Taylor expanded in x around 0 40.5%
associate-*r*40.5%
unpow240.5%
Simplified40.5%
Final simplification60.0%
(FPCore (x y)
:precision binary64
(if (<= x -3.7e+137)
(/ x (/ x y))
(if (<= x -1.45e+90)
(* x (* x (* y -0.16666666666666666)))
(if (<= x 9.5e-92)
(* x (/ y x))
(+ y (* x (* y (* x -0.16666666666666666))))))))
double code(double x, double y) {
double tmp;
if (x <= -3.7e+137) {
tmp = x / (x / y);
} else if (x <= -1.45e+90) {
tmp = x * (x * (y * -0.16666666666666666));
} else if (x <= 9.5e-92) {
tmp = x * (y / x);
} else {
tmp = y + (x * (y * (x * -0.16666666666666666)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3.7d+137)) then
tmp = x / (x / y)
else if (x <= (-1.45d+90)) then
tmp = x * (x * (y * (-0.16666666666666666d0)))
else if (x <= 9.5d-92) then
tmp = x * (y / x)
else
tmp = y + (x * (y * (x * (-0.16666666666666666d0))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -3.7e+137) {
tmp = x / (x / y);
} else if (x <= -1.45e+90) {
tmp = x * (x * (y * -0.16666666666666666));
} else if (x <= 9.5e-92) {
tmp = x * (y / x);
} else {
tmp = y + (x * (y * (x * -0.16666666666666666)));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3.7e+137: tmp = x / (x / y) elif x <= -1.45e+90: tmp = x * (x * (y * -0.16666666666666666)) elif x <= 9.5e-92: tmp = x * (y / x) else: tmp = y + (x * (y * (x * -0.16666666666666666))) return tmp
function code(x, y) tmp = 0.0 if (x <= -3.7e+137) tmp = Float64(x / Float64(x / y)); elseif (x <= -1.45e+90) tmp = Float64(x * Float64(x * Float64(y * -0.16666666666666666))); elseif (x <= 9.5e-92) tmp = Float64(x * Float64(y / x)); else tmp = Float64(y + Float64(x * Float64(y * Float64(x * -0.16666666666666666)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3.7e+137) tmp = x / (x / y); elseif (x <= -1.45e+90) tmp = x * (x * (y * -0.16666666666666666)); elseif (x <= 9.5e-92) tmp = x * (y / x); else tmp = y + (x * (y * (x * -0.16666666666666666))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3.7e+137], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.45e+90], N[(x * N[(x * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.5e-92], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(y + N[(x * N[(y * N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{+137}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{+90}:\\
\;\;\;\;x \cdot \left(x \cdot \left(y \cdot -0.16666666666666666\right)\right)\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-92}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;y + x \cdot \left(y \cdot \left(x \cdot -0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if x < -3.7000000000000002e137Initial program 99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 56.6%
Taylor expanded in x around 0 25.8%
associate-/l*4.9%
associate-/r/41.3%
Applied egg-rr41.3%
associate-*l/25.8%
*-commutative25.8%
associate-/l*43.5%
Applied egg-rr43.5%
if -3.7000000000000002e137 < x < -1.4500000000000001e90Initial program 99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 27.3%
associate-/l*27.5%
associate-/r/27.3%
Simplified27.3%
Taylor expanded in x around 0 51.5%
+-commutative51.5%
remove-double-neg51.5%
unsub-neg51.5%
*-commutative51.5%
associate-*l*51.5%
fma-neg51.5%
unpow251.5%
remove-double-neg51.5%
Simplified51.5%
fma-udef51.5%
flip-+13.1%
*-commutative13.1%
associate-*l*13.1%
*-commutative13.1%
associate-*l*13.1%
*-commutative13.1%
associate-*l*13.1%
Applied egg-rr13.1%
Taylor expanded in x around inf 51.5%
*-commutative51.5%
*-commutative51.5%
unpow251.5%
associate-*l*51.5%
*-commutative51.5%
associate-*r*51.5%
*-commutative51.5%
associate-*l*51.5%
Simplified51.5%
if -1.4500000000000001e90 < x < 9.49999999999999946e-92Initial program 75.1%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 30.1%
Taylor expanded in x around 0 23.9%
associate-/l*48.2%
associate-/r/75.1%
Applied egg-rr75.1%
if 9.49999999999999946e-92 < x Initial program 98.6%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 41.3%
associate-/l*42.6%
associate-/r/42.6%
Simplified42.6%
Taylor expanded in x around 0 40.5%
+-commutative40.5%
remove-double-neg40.5%
unsub-neg40.5%
*-commutative40.5%
associate-*l*40.5%
fma-neg40.5%
unpow240.5%
remove-double-neg40.5%
Simplified40.5%
fma-udef40.5%
flip-+15.1%
*-commutative15.1%
associate-*l*15.1%
*-commutative15.1%
associate-*l*15.1%
*-commutative15.1%
associate-*l*15.1%
Applied egg-rr15.1%
flip-+40.5%
associate-*l*40.5%
*-commutative40.5%
Applied egg-rr40.5%
Final simplification60.0%
(FPCore (x y)
:precision binary64
(if (<= x -4.8e+136)
(/ x (/ x y))
(if (or (<= x -1.55e+90) (not (<= x 48.0)))
(* -0.16666666666666666 (* y (* x x)))
(* x (/ y x)))))
double code(double x, double y) {
double tmp;
if (x <= -4.8e+136) {
tmp = x / (x / y);
} else if ((x <= -1.55e+90) || !(x <= 48.0)) {
tmp = -0.16666666666666666 * (y * (x * x));
} else {
tmp = x * (y / x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.8d+136)) then
tmp = x / (x / y)
else if ((x <= (-1.55d+90)) .or. (.not. (x <= 48.0d0))) then
tmp = (-0.16666666666666666d0) * (y * (x * x))
else
tmp = x * (y / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -4.8e+136) {
tmp = x / (x / y);
} else if ((x <= -1.55e+90) || !(x <= 48.0)) {
tmp = -0.16666666666666666 * (y * (x * x));
} else {
tmp = x * (y / x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.8e+136: tmp = x / (x / y) elif (x <= -1.55e+90) or not (x <= 48.0): tmp = -0.16666666666666666 * (y * (x * x)) else: tmp = x * (y / x) return tmp
function code(x, y) tmp = 0.0 if (x <= -4.8e+136) tmp = Float64(x / Float64(x / y)); elseif ((x <= -1.55e+90) || !(x <= 48.0)) tmp = Float64(-0.16666666666666666 * Float64(y * Float64(x * x))); else tmp = Float64(x * Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -4.8e+136) tmp = x / (x / y); elseif ((x <= -1.55e+90) || ~((x <= 48.0))) tmp = -0.16666666666666666 * (y * (x * x)); else tmp = x * (y / x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.8e+136], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.55e+90], N[Not[LessEqual[x, 48.0]], $MachinePrecision]], N[(-0.16666666666666666 * N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+136}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{+90} \lor \neg \left(x \leq 48\right):\\
\;\;\;\;-0.16666666666666666 \cdot \left(y \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\end{array}
\end{array}
if x < -4.8000000000000001e136Initial program 99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 56.6%
Taylor expanded in x around 0 25.8%
associate-/l*4.9%
associate-/r/41.3%
Applied egg-rr41.3%
associate-*l/25.8%
*-commutative25.8%
associate-/l*43.5%
Applied egg-rr43.5%
if -4.8000000000000001e136 < x < -1.54999999999999994e90 or 48 < x Initial program 99.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 33.0%
associate-/l*33.1%
associate-/r/33.0%
Simplified33.0%
Taylor expanded in x around 0 34.4%
+-commutative34.4%
remove-double-neg34.4%
unsub-neg34.4%
*-commutative34.4%
associate-*l*34.4%
fma-neg34.4%
unpow234.4%
remove-double-neg34.4%
Simplified34.4%
Taylor expanded in x around inf 34.4%
unpow234.4%
Simplified34.4%
if -1.54999999999999994e90 < x < 48Initial program 78.2%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 34.0%
Taylor expanded in x around 0 28.3%
associate-/l*49.6%
associate-/r/72.5%
Applied egg-rr72.5%
Final simplification59.9%
(FPCore (x y)
:precision binary64
(if (<= x -4.8e+136)
(/ x (/ x y))
(if (or (<= x -1.45e+90) (not (<= x 48.0)))
(* x (* x (* y -0.16666666666666666)))
(* x (/ y x)))))
double code(double x, double y) {
double tmp;
if (x <= -4.8e+136) {
tmp = x / (x / y);
} else if ((x <= -1.45e+90) || !(x <= 48.0)) {
tmp = x * (x * (y * -0.16666666666666666));
} else {
tmp = x * (y / x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.8d+136)) then
tmp = x / (x / y)
else if ((x <= (-1.45d+90)) .or. (.not. (x <= 48.0d0))) then
tmp = x * (x * (y * (-0.16666666666666666d0)))
else
tmp = x * (y / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -4.8e+136) {
tmp = x / (x / y);
} else if ((x <= -1.45e+90) || !(x <= 48.0)) {
tmp = x * (x * (y * -0.16666666666666666));
} else {
tmp = x * (y / x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.8e+136: tmp = x / (x / y) elif (x <= -1.45e+90) or not (x <= 48.0): tmp = x * (x * (y * -0.16666666666666666)) else: tmp = x * (y / x) return tmp
function code(x, y) tmp = 0.0 if (x <= -4.8e+136) tmp = Float64(x / Float64(x / y)); elseif ((x <= -1.45e+90) || !(x <= 48.0)) tmp = Float64(x * Float64(x * Float64(y * -0.16666666666666666))); else tmp = Float64(x * Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -4.8e+136) tmp = x / (x / y); elseif ((x <= -1.45e+90) || ~((x <= 48.0))) tmp = x * (x * (y * -0.16666666666666666)); else tmp = x * (y / x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.8e+136], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.45e+90], N[Not[LessEqual[x, 48.0]], $MachinePrecision]], N[(x * N[(x * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+136}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{+90} \lor \neg \left(x \leq 48\right):\\
\;\;\;\;x \cdot \left(x \cdot \left(y \cdot -0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\end{array}
\end{array}
if x < -4.8000000000000001e136Initial program 99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 56.6%
Taylor expanded in x around 0 25.8%
associate-/l*4.9%
associate-/r/41.3%
Applied egg-rr41.3%
associate-*l/25.8%
*-commutative25.8%
associate-/l*43.5%
Applied egg-rr43.5%
if -4.8000000000000001e136 < x < -1.4500000000000001e90 or 48 < x Initial program 99.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 33.0%
associate-/l*33.1%
associate-/r/33.0%
Simplified33.0%
Taylor expanded in x around 0 34.4%
+-commutative34.4%
remove-double-neg34.4%
unsub-neg34.4%
*-commutative34.4%
associate-*l*34.4%
fma-neg34.4%
unpow234.4%
remove-double-neg34.4%
Simplified34.4%
fma-udef34.4%
flip-+2.4%
*-commutative2.4%
associate-*l*2.4%
*-commutative2.4%
associate-*l*2.4%
*-commutative2.4%
associate-*l*2.4%
Applied egg-rr2.4%
Taylor expanded in x around inf 34.4%
*-commutative34.4%
*-commutative34.4%
unpow234.4%
associate-*l*34.5%
*-commutative34.5%
associate-*r*34.5%
*-commutative34.5%
associate-*l*34.5%
Simplified34.5%
if -1.4500000000000001e90 < x < 48Initial program 78.2%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 34.0%
Taylor expanded in x around 0 28.3%
associate-/l*49.6%
associate-/r/72.5%
Applied egg-rr72.5%
Final simplification60.0%
(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 86.0%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 36.9%
Taylor expanded in x around 0 25.7%
associate-/l*33.0%
associate-/r/55.6%
Applied egg-rr55.6%
Final simplification55.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 86.0%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 36.9%
associate-/l*50.8%
associate-/r/65.1%
Simplified65.1%
Taylor expanded in x around 0 33.0%
Final simplification33.0%
(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 2023174
(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))