
(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 (/ (sinh y) (/ x (sin x))))
double code(double x, double y) {
return sinh(y) / (x / sin(x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sinh(y) / (x / sin(x))
end function
public static double code(double x, double y) {
return Math.sinh(y) / (x / Math.sin(x));
}
def code(x, y): return math.sinh(y) / (x / math.sin(x))
function code(x, y) return Float64(sinh(y) / Float64(x / sin(x))) end
function tmp = code(x, y) tmp = sinh(y) / (x / sin(x)); end
code[x_, y_] := N[(N[Sinh[y], $MachinePrecision] / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sinh y}{\frac{x}{\sin x}}
\end{array}
Initial program 87.7%
associate-*r/99.9%
Simplified99.9%
add-log-exp65.4%
*-un-lft-identity65.4%
log-prod65.4%
metadata-eval65.4%
add-log-exp99.9%
Applied egg-rr99.9%
+-lft-identity99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= (sinh y) (- INFINITY)) (sinh y) (if (<= (sinh y) 1e-6) (* (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) <= 1e-6) {
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) <= 1e-6) {
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) <= 1e-6: 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) <= 1e-6) 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) <= 1e-6) 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], 1e-6], 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 10^{-6}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 9.99999999999999955e-7 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 77.9%
if -inf.0 < (sinh.f64 y) < 9.99999999999999955e-7Initial program 72.9%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 72.8%
associate-/l*99.7%
associate-/r/99.7%
Simplified99.7%
Final simplification87.7%
(FPCore (x y) :precision binary64 (if (<= (sinh y) (- INFINITY)) (sinh y) (if (<= (sinh y) 1e-6) (* y (/ (sin x) x)) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -((double) INFINITY)) {
tmp = sinh(y);
} else if (sinh(y) <= 1e-6) {
tmp = y * (sin(x) / 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-6) {
tmp = y * (Math.sin(x) / 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-6: tmp = y * (math.sin(x) / 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-6) tmp = Float64(y * Float64(sin(x) / 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-6) tmp = y * (sin(x) / 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-6], N[(y * N[(N[Sin[x], $MachinePrecision] / 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 10^{-6}:\\
\;\;\;\;y \cdot \frac{\sin x}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 9.99999999999999955e-7 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 77.9%
if -inf.0 < (sinh.f64 y) < 9.99999999999999955e-7Initial program 72.9%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in y around 0 99.7%
Final simplification87.7%
(FPCore (x y) :precision binary64 (if (<= (sinh y) (- INFINITY)) (sinh y) (if (<= (sinh y) 1e-6) (/ 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) <= 1e-6) {
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) <= 1e-6) {
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) <= 1e-6: 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) <= 1e-6) 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) <= 1e-6) 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], 1e-6], 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 10^{-6}:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 9.99999999999999955e-7 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 77.9%
if -inf.0 < (sinh.f64 y) < 9.99999999999999955e-7Initial program 72.9%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 72.8%
associate-/l*99.7%
Simplified99.7%
Final simplification87.8%
(FPCore (x y) :precision binary64 (if (<= (sinh y) -2e-24) (sinh y) (if (<= (sinh y) 1e-156) (/ x (/ x y)) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -2e-24) {
tmp = sinh(y);
} else if (sinh(y) <= 1e-156) {
tmp = x / (x / y);
} else {
tmp = sinh(y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (sinh(y) <= (-2d-24)) then
tmp = sinh(y)
else if (sinh(y) <= 1d-156) then
tmp = x / (x / y)
else
tmp = sinh(y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.sinh(y) <= -2e-24) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 1e-156) {
tmp = x / (x / y);
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -2e-24: tmp = math.sinh(y) elif math.sinh(y) <= 1e-156: tmp = x / (x / y) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -2e-24) tmp = sinh(y); elseif (sinh(y) <= 1e-156) tmp = Float64(x / Float64(x / y)); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (sinh(y) <= -2e-24) tmp = sinh(y); elseif (sinh(y) <= 1e-156) tmp = x / (x / y); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -2e-24], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 1e-156], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -2 \cdot 10^{-24}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 10^{-156}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -1.99999999999999985e-24 or 1.00000000000000004e-156 < (sinh.f64 y) Initial program 98.1%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around 0 73.0%
if -1.99999999999999985e-24 < (sinh.f64 y) < 1.00000000000000004e-156Initial program 65.4%
Taylor expanded in y around 0 65.4%
Taylor expanded in x around 0 16.4%
associate-/l*50.8%
associate-/r/72.6%
Applied egg-rr72.6%
frac-2neg72.6%
clear-num75.7%
associate-*l/75.8%
*-un-lft-identity75.8%
frac-2neg75.8%
Applied egg-rr75.8%
Final simplification73.9%
(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 87.7%
associate-*r/99.9%
Simplified99.9%
Final simplification99.9%
(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 87.7%
associate-*l/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (+ 1.0 (* (* x x) -0.16666666666666666)) (sinh y))))
(if (<= y -0.0017)
t_0
(if (<= y 1.7e-6) (/ y (/ x (sin x))) (if (<= y 9e+75) (sinh y) t_0)))))
double code(double x, double y) {
double t_0 = (1.0 + ((x * x) * -0.16666666666666666)) * sinh(y);
double tmp;
if (y <= -0.0017) {
tmp = t_0;
} else if (y <= 1.7e-6) {
tmp = y / (x / sin(x));
} else if (y <= 9e+75) {
tmp = sinh(y);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 + ((x * x) * (-0.16666666666666666d0))) * sinh(y)
if (y <= (-0.0017d0)) then
tmp = t_0
else if (y <= 1.7d-6) then
tmp = y / (x / sin(x))
else if (y <= 9d+75) then
tmp = sinh(y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (1.0 + ((x * x) * -0.16666666666666666)) * Math.sinh(y);
double tmp;
if (y <= -0.0017) {
tmp = t_0;
} else if (y <= 1.7e-6) {
tmp = y / (x / Math.sin(x));
} else if (y <= 9e+75) {
tmp = Math.sinh(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (1.0 + ((x * x) * -0.16666666666666666)) * math.sinh(y) tmp = 0 if y <= -0.0017: tmp = t_0 elif y <= 1.7e-6: tmp = y / (x / math.sin(x)) elif y <= 9e+75: tmp = math.sinh(y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(1.0 + Float64(Float64(x * x) * -0.16666666666666666)) * sinh(y)) tmp = 0.0 if (y <= -0.0017) tmp = t_0; elseif (y <= 1.7e-6) tmp = Float64(y / Float64(x / sin(x))); elseif (y <= 9e+75) tmp = sinh(y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (1.0 + ((x * x) * -0.16666666666666666)) * sinh(y); tmp = 0.0; if (y <= -0.0017) tmp = t_0; elseif (y <= 1.7e-6) tmp = y / (x / sin(x)); elseif (y <= 9e+75) tmp = sinh(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.0017], t$95$0, If[LessEqual[y, 1.7e-6], N[(y / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+75], N[Sinh[y], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + \left(x \cdot x\right) \cdot -0.16666666666666666\right) \cdot \sinh y\\
\mathbf{if}\;y \leq -0.0017:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-6}:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+75}:\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -0.00169999999999999991 or 9.0000000000000007e75 < y Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 85.7%
*-commutative85.7%
unpow285.7%
Simplified85.7%
if -0.00169999999999999991 < y < 1.70000000000000003e-6Initial program 72.9%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 72.8%
associate-/l*99.7%
Simplified99.7%
if 1.70000000000000003e-6 < y < 9.0000000000000007e75Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 95.2%
Final simplification92.9%
(FPCore (x y) :precision binary64 (if (<= y 2.9e+138) (* x (/ y x)) (sqrt (* y y))))
double code(double x, double y) {
double tmp;
if (y <= 2.9e+138) {
tmp = x * (y / x);
} else {
tmp = sqrt((y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.9d+138) then
tmp = x * (y / x)
else
tmp = sqrt((y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.9e+138) {
tmp = x * (y / x);
} else {
tmp = Math.sqrt((y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.9e+138: tmp = x * (y / x) else: tmp = math.sqrt((y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.9e+138) tmp = Float64(x * Float64(y / x)); else tmp = sqrt(Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.9e+138) tmp = x * (y / x); else tmp = sqrt((y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.9e+138], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(y * y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.9 \cdot 10^{+138}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{y \cdot y}\\
\end{array}
\end{array}
if y < 2.9000000000000001e138Initial program 85.5%
Taylor expanded in y around 0 41.4%
Taylor expanded in x around 0 18.6%
associate-/l*29.9%
associate-/r/51.1%
Applied egg-rr51.1%
if 2.9000000000000001e138 < y Initial program 100.0%
Taylor expanded in y around 0 5.3%
Taylor expanded in x around 0 19.3%
div-inv19.3%
associate-*l*4.9%
div-inv4.9%
*-inverses4.9%
*-commutative4.9%
*-un-lft-identity4.9%
add-sqr-sqrt4.9%
sqrt-unprod69.5%
Applied egg-rr69.5%
Final simplification53.9%
(FPCore (x y) :precision binary64 (if (<= x 5.8e+177) (* x (/ y x)) (if (<= x 5.3e+272) (/ (* x (- y)) x) (/ (* y x) x))))
double code(double x, double y) {
double tmp;
if (x <= 5.8e+177) {
tmp = x * (y / x);
} else if (x <= 5.3e+272) {
tmp = (x * -y) / x;
} else {
tmp = (y * x) / x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 5.8d+177) then
tmp = x * (y / x)
else if (x <= 5.3d+272) then
tmp = (x * -y) / x
else
tmp = (y * x) / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 5.8e+177) {
tmp = x * (y / x);
} else if (x <= 5.3e+272) {
tmp = (x * -y) / x;
} else {
tmp = (y * x) / x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 5.8e+177: tmp = x * (y / x) elif x <= 5.3e+272: tmp = (x * -y) / x else: tmp = (y * x) / x return tmp
function code(x, y) tmp = 0.0 if (x <= 5.8e+177) tmp = Float64(x * Float64(y / x)); elseif (x <= 5.3e+272) tmp = Float64(Float64(x * Float64(-y)) / x); else tmp = Float64(Float64(y * x) / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 5.8e+177) tmp = x * (y / x); elseif (x <= 5.3e+272) tmp = (x * -y) / x; else tmp = (y * x) / x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 5.8e+177], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.3e+272], N[(N[(x * (-y)), $MachinePrecision] / x), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.8 \cdot 10^{+177}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq 5.3 \cdot 10^{+272}:\\
\;\;\;\;\frac{x \cdot \left(-y\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{x}\\
\end{array}
\end{array}
if x < 5.80000000000000027e177Initial program 86.2%
Taylor expanded in y around 0 34.6%
Taylor expanded in x around 0 19.0%
associate-/l*29.1%
associate-/r/52.5%
Applied egg-rr52.5%
if 5.80000000000000027e177 < x < 5.30000000000000011e272Initial program 99.8%
Taylor expanded in y around 0 43.1%
Taylor expanded in x around 0 10.4%
associate-/l*2.6%
associate-/r/18.4%
Applied egg-rr18.4%
associate-*l/10.4%
frac-2neg10.4%
add-sqr-sqrt0.0%
sqrt-unprod21.6%
sqr-neg21.6%
sqrt-unprod39.5%
add-sqr-sqrt39.5%
Applied egg-rr39.5%
if 5.30000000000000011e272 < x Initial program 99.7%
Taylor expanded in y around 0 57.8%
Taylor expanded in x around 0 42.2%
Final simplification51.1%
(FPCore (x y) :precision binary64 (if (<= x 280.0) (* x (/ y x)) (/ (* y (- y)) y)))
double code(double x, double y) {
double tmp;
if (x <= 280.0) {
tmp = x * (y / x);
} else {
tmp = (y * -y) / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 280.0d0) then
tmp = x * (y / x)
else
tmp = (y * -y) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 280.0) {
tmp = x * (y / x);
} else {
tmp = (y * -y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 280.0: tmp = x * (y / x) else: tmp = (y * -y) / y return tmp
function code(x, y) tmp = 0.0 if (x <= 280.0) tmp = Float64(x * Float64(y / x)); else tmp = Float64(Float64(y * Float64(-y)) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 280.0) tmp = x * (y / x); else tmp = (y * -y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 280.0], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(y * (-y)), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 280:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(-y\right)}{y}\\
\end{array}
\end{array}
if x < 280Initial program 84.0%
Taylor expanded in y around 0 31.3%
Taylor expanded in x around 0 20.1%
associate-/l*33.2%
associate-/r/59.1%
Applied egg-rr59.1%
if 280 < x Initial program 99.8%
Taylor expanded in y around 0 50.5%
Taylor expanded in x around 0 14.1%
clear-num14.1%
inv-pow14.1%
*-commutative14.1%
associate-/r*3.4%
*-inverses3.4%
Applied egg-rr3.4%
unpow-13.4%
remove-double-div3.4%
add-sqr-sqrt1.7%
sqrt-unprod26.5%
sqr-neg26.5%
sqrt-unprod2.1%
add-sqr-sqrt4.4%
neg-sub04.4%
metadata-eval4.4%
flip--31.5%
metadata-eval31.5%
metadata-eval31.5%
metadata-eval31.5%
add-log-exp0.9%
log-prod0.9%
*-un-lft-identity0.9%
add-log-exp31.5%
Applied egg-rr31.5%
Final simplification52.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 87.7%
Taylor expanded in y around 0 35.9%
Taylor expanded in x around 0 18.7%
associate-/l*26.1%
associate-/r/49.1%
Applied egg-rr49.1%
Final simplification49.1%
(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 87.7%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 48.1%
Taylor expanded in x around 0 26.1%
Final simplification26.1%
(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 2023229
(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))