
(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 11 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 87.5%
associate-*l/100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= (sinh y) -2e+34)
(sinh y)
(if (<= (sinh y) 2e-10)
(* (/ (sin x) x) y)
(* (sinh y) (+ 1.0 (* (* x x) -0.16666666666666666))))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -2e+34) {
tmp = sinh(y);
} else if (sinh(y) <= 2e-10) {
tmp = (sin(x) / x) * y;
} else {
tmp = sinh(y) * (1.0 + ((x * 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 (sinh(y) <= (-2d+34)) then
tmp = sinh(y)
else if (sinh(y) <= 2d-10) then
tmp = (sin(x) / x) * y
else
tmp = sinh(y) * (1.0d0 + ((x * x) * (-0.16666666666666666d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.sinh(y) <= -2e+34) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 2e-10) {
tmp = (Math.sin(x) / x) * y;
} else {
tmp = Math.sinh(y) * (1.0 + ((x * x) * -0.16666666666666666));
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -2e+34: tmp = math.sinh(y) elif math.sinh(y) <= 2e-10: tmp = (math.sin(x) / x) * y else: tmp = math.sinh(y) * (1.0 + ((x * x) * -0.16666666666666666)) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -2e+34) tmp = sinh(y); elseif (sinh(y) <= 2e-10) tmp = Float64(Float64(sin(x) / x) * y); else tmp = Float64(sinh(y) * Float64(1.0 + Float64(Float64(x * x) * -0.16666666666666666))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (sinh(y) <= -2e+34) tmp = sinh(y); elseif (sinh(y) <= 2e-10) tmp = (sin(x) / x) * y; else tmp = sinh(y) * (1.0 + ((x * x) * -0.16666666666666666)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -2e+34], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 2e-10], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], N[(N[Sinh[y], $MachinePrecision] * N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -2 \cdot 10^{+34}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\sinh y \cdot \left(1 + \left(x \cdot x\right) \cdot -0.16666666666666666\right)\\
\end{array}
\end{array}
if (sinh.f64 y) < -1.99999999999999989e34Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 90.8%
if -1.99999999999999989e34 < (sinh.f64 y) < 2.00000000000000007e-10Initial program 74.7%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 74.7%
associate-/l*99.9%
Simplified99.9%
clear-num99.1%
associate-/r/99.9%
clear-num99.9%
Applied egg-rr99.9%
if 2.00000000000000007e-10 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 84.6%
*-commutative84.6%
unpow284.6%
Simplified84.6%
Final simplification93.7%
(FPCore (x y) :precision binary64 (if (<= (sinh y) -5e-18) (sinh y) (if (<= (sinh y) 2e-10) (* (sin x) (/ y x)) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -5e-18) {
tmp = sinh(y);
} else if (sinh(y) <= 2e-10) {
tmp = sin(x) * (y / x);
} else {
tmp = sinh(y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (sinh(y) <= (-5d-18)) then
tmp = sinh(y)
else if (sinh(y) <= 2d-10) then
tmp = sin(x) * (y / x)
else
tmp = sinh(y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.sinh(y) <= -5e-18) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 2e-10) {
tmp = Math.sin(x) * (y / x);
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -5e-18: tmp = math.sinh(y) elif math.sinh(y) <= 2e-10: tmp = math.sin(x) * (y / x) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -5e-18) tmp = sinh(y); elseif (sinh(y) <= 2e-10) 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) <= -5e-18) tmp = sinh(y); elseif (sinh(y) <= 2e-10) tmp = sin(x) * (y / x); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -5e-18], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 2e-10], 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 -5 \cdot 10^{-18}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -5.00000000000000036e-18 or 2.00000000000000007e-10 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 80.2%
if -5.00000000000000036e-18 < (sinh.f64 y) < 2.00000000000000007e-10Initial program 74.5%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 74.5%
associate-/l*99.9%
associate-/r/99.8%
Simplified99.8%
Final simplification89.7%
(FPCore (x y) :precision binary64 (if (<= (sinh y) -2e+34) (sinh y) (if (<= (sinh y) 2e-10) (* (/ (sin x) x) y) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -2e+34) {
tmp = sinh(y);
} else if (sinh(y) <= 2e-10) {
tmp = (sin(x) / x) * y;
} else {
tmp = sinh(y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (sinh(y) <= (-2d+34)) then
tmp = sinh(y)
else if (sinh(y) <= 2d-10) then
tmp = (sin(x) / x) * y
else
tmp = sinh(y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.sinh(y) <= -2e+34) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 2e-10) {
tmp = (Math.sin(x) / x) * y;
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -2e+34: tmp = math.sinh(y) elif math.sinh(y) <= 2e-10: tmp = (math.sin(x) / x) * y else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -2e+34) tmp = sinh(y); elseif (sinh(y) <= 2e-10) tmp = Float64(Float64(sin(x) / x) * y); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (sinh(y) <= -2e+34) tmp = sinh(y); elseif (sinh(y) <= 2e-10) tmp = (sin(x) / x) * y; else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -2e+34], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 2e-10], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -2 \cdot 10^{+34}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -1.99999999999999989e34 or 2.00000000000000007e-10 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 80.0%
if -1.99999999999999989e34 < (sinh.f64 y) < 2.00000000000000007e-10Initial program 74.7%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 74.7%
associate-/l*99.9%
Simplified99.9%
clear-num99.1%
associate-/r/99.9%
clear-num99.9%
Applied egg-rr99.9%
Final simplification89.8%
(FPCore (x y)
:precision binary64
(if (<= (sinh y) -2e+34)
(sinh y)
(if (<= (sinh y) 2e-10)
(/ y (+ 1.0 (* x (* x 0.16666666666666666))))
(sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -2e+34) {
tmp = sinh(y);
} else if (sinh(y) <= 2e-10) {
tmp = y / (1.0 + (x * (x * 0.16666666666666666)));
} 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+34)) then
tmp = sinh(y)
else if (sinh(y) <= 2d-10) then
tmp = y / (1.0d0 + (x * (x * 0.16666666666666666d0)))
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+34) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 2e-10) {
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) <= -2e+34: tmp = math.sinh(y) elif math.sinh(y) <= 2e-10: 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) <= -2e+34) tmp = sinh(y); elseif (sinh(y) <= 2e-10) tmp = Float64(y / Float64(1.0 + Float64(x * Float64(x * 0.16666666666666666)))); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (sinh(y) <= -2e+34) tmp = sinh(y); elseif (sinh(y) <= 2e-10) 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], -2e+34], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 2e-10], N[(y / N[(1.0 + N[(x * N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -2 \cdot 10^{+34}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\frac{y}{1 + x \cdot \left(x \cdot 0.16666666666666666\right)}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -1.99999999999999989e34 or 2.00000000000000007e-10 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 80.0%
if -1.99999999999999989e34 < (sinh.f64 y) < 2.00000000000000007e-10Initial program 74.7%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 74.7%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around 0 75.8%
*-commutative75.8%
unpow275.8%
Simplified75.8%
Taylor expanded in x around 0 75.8%
*-commutative75.8%
unpow275.8%
associate-*r*75.8%
Simplified75.8%
Final simplification77.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.5%
associate-*r/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= y -280000000000.0)
(* 6.0 (/ y (* x x)))
(if (<= y 4.6e+142)
(/ (/ y x) (+ (* x 0.16666666666666666) (/ 1.0 x)))
(sqrt (* y y)))))
double code(double x, double y) {
double tmp;
if (y <= -280000000000.0) {
tmp = 6.0 * (y / (x * x));
} else if (y <= 4.6e+142) {
tmp = (y / x) / ((x * 0.16666666666666666) + (1.0 / 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 <= (-280000000000.0d0)) then
tmp = 6.0d0 * (y / (x * x))
else if (y <= 4.6d+142) then
tmp = (y / x) / ((x * 0.16666666666666666d0) + (1.0d0 / x))
else
tmp = sqrt((y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -280000000000.0) {
tmp = 6.0 * (y / (x * x));
} else if (y <= 4.6e+142) {
tmp = (y / x) / ((x * 0.16666666666666666) + (1.0 / x));
} else {
tmp = Math.sqrt((y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -280000000000.0: tmp = 6.0 * (y / (x * x)) elif y <= 4.6e+142: tmp = (y / x) / ((x * 0.16666666666666666) + (1.0 / x)) else: tmp = math.sqrt((y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= -280000000000.0) tmp = Float64(6.0 * Float64(y / Float64(x * x))); elseif (y <= 4.6e+142) tmp = Float64(Float64(y / x) / Float64(Float64(x * 0.16666666666666666) + Float64(1.0 / x))); else tmp = sqrt(Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -280000000000.0) tmp = 6.0 * (y / (x * x)); elseif (y <= 4.6e+142) tmp = (y / x) / ((x * 0.16666666666666666) + (1.0 / x)); else tmp = sqrt((y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -280000000000.0], N[(6.0 * N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.6e+142], N[(N[(y / x), $MachinePrecision] / N[(N[(x * 0.16666666666666666), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(y * y), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -280000000000:\\
\;\;\;\;6 \cdot \frac{y}{x \cdot x}\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+142}:\\
\;\;\;\;\frac{\frac{y}{x}}{x \cdot 0.16666666666666666 + \frac{1}{x}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{y \cdot y}\\
\end{array}
\end{array}
if y < -2.8e11Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 5.0%
associate-/l*5.0%
Simplified5.0%
Taylor expanded in x around 0 4.7%
*-commutative4.7%
unpow24.7%
Simplified4.7%
Taylor expanded in x around inf 53.5%
associate-*r/53.5%
unpow253.5%
Simplified53.5%
*-un-lft-identity53.5%
times-frac53.5%
metadata-eval53.5%
Applied egg-rr53.5%
if -2.8e11 < y < 4.60000000000000004e142Initial program 80.3%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 60.2%
associate-/l*79.8%
associate-/r/82.7%
Simplified82.7%
associate-/r/79.8%
div-inv79.7%
associate-/r*82.6%
Applied egg-rr82.6%
Taylor expanded in x around 0 63.8%
if 4.60000000000000004e142 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 6.0%
Taylor expanded in x around 0 13.0%
*-commutative13.0%
Simplified13.0%
div-inv13.0%
associate-*l*4.8%
div-inv4.8%
*-inverses4.8%
*-commutative4.8%
*-un-lft-identity4.8%
add-sqr-sqrt4.8%
sqrt-unprod59.1%
Applied egg-rr59.1%
Final simplification60.7%
(FPCore (x y) :precision binary64 (if (or (<= y -280000000000.0) (not (<= y 220.0))) (* 6.0 (/ y (* x x))) (/ y (+ 1.0 (* x (* x 0.16666666666666666))))))
double code(double x, double y) {
double tmp;
if ((y <= -280000000000.0) || !(y <= 220.0)) {
tmp = 6.0 * (y / (x * x));
} else {
tmp = y / (1.0 + (x * (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 ((y <= (-280000000000.0d0)) .or. (.not. (y <= 220.0d0))) then
tmp = 6.0d0 * (y / (x * x))
else
tmp = y / (1.0d0 + (x * (x * 0.16666666666666666d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -280000000000.0) || !(y <= 220.0)) {
tmp = 6.0 * (y / (x * x));
} else {
tmp = y / (1.0 + (x * (x * 0.16666666666666666)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -280000000000.0) or not (y <= 220.0): tmp = 6.0 * (y / (x * x)) else: tmp = y / (1.0 + (x * (x * 0.16666666666666666))) return tmp
function code(x, y) tmp = 0.0 if ((y <= -280000000000.0) || !(y <= 220.0)) tmp = Float64(6.0 * Float64(y / Float64(x * x))); else tmp = Float64(y / Float64(1.0 + Float64(x * Float64(x * 0.16666666666666666)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -280000000000.0) || ~((y <= 220.0))) tmp = 6.0 * (y / (x * x)); else tmp = y / (1.0 + (x * (x * 0.16666666666666666))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -280000000000.0], N[Not[LessEqual[y, 220.0]], $MachinePrecision]], N[(6.0 * N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(1.0 + N[(x * N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -280000000000 \lor \neg \left(y \leq 220\right):\\
\;\;\;\;6 \cdot \frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{1 + x \cdot \left(x \cdot 0.16666666666666666\right)}\\
\end{array}
\end{array}
if y < -2.8e11 or 220 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.9%
associate-/l*4.9%
Simplified4.9%
Taylor expanded in x around 0 4.2%
*-commutative4.2%
unpow24.2%
Simplified4.2%
Taylor expanded in x around inf 46.7%
associate-*r/46.7%
unpow246.7%
Simplified46.7%
*-un-lft-identity46.7%
times-frac46.7%
metadata-eval46.7%
Applied egg-rr46.7%
if -2.8e11 < y < 220Initial program 76.2%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 72.2%
associate-/l*95.9%
Simplified95.9%
Taylor expanded in x around 0 73.2%
*-commutative73.2%
unpow273.2%
Simplified73.2%
Taylor expanded in x around 0 73.2%
*-commutative73.2%
unpow273.2%
associate-*r*73.2%
Simplified73.2%
Final simplification60.5%
(FPCore (x y) :precision binary64 (if (or (<= y -3100.0) (not (<= y 250.0))) (* 6.0 (/ y (* x x))) (/ x (/ x y))))
double code(double x, double y) {
double tmp;
if ((y <= -3100.0) || !(y <= 250.0)) {
tmp = 6.0 * (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 ((y <= (-3100.0d0)) .or. (.not. (y <= 250.0d0))) then
tmp = 6.0d0 * (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 ((y <= -3100.0) || !(y <= 250.0)) {
tmp = 6.0 * (y / (x * x));
} else {
tmp = x / (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -3100.0) or not (y <= 250.0): tmp = 6.0 * (y / (x * x)) else: tmp = x / (x / y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -3100.0) || !(y <= 250.0)) tmp = Float64(6.0 * 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 ((y <= -3100.0) || ~((y <= 250.0))) tmp = 6.0 * (y / (x * x)); else tmp = x / (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -3100.0], N[Not[LessEqual[y, 250.0]], $MachinePrecision]], N[(6.0 * N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3100 \lor \neg \left(y \leq 250\right):\\
\;\;\;\;6 \cdot \frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\end{array}
\end{array}
if y < -3100 or 250 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.8%
associate-/l*4.8%
Simplified4.8%
Taylor expanded in x around 0 4.2%
*-commutative4.2%
unpow24.2%
Simplified4.2%
Taylor expanded in x around inf 45.6%
associate-*r/45.6%
unpow245.6%
Simplified45.6%
*-un-lft-identity45.6%
times-frac45.6%
metadata-eval45.6%
Applied egg-rr45.6%
if -3100 < y < 250Initial program 75.6%
associate-*r/99.7%
Simplified99.7%
Taylor expanded in y around 0 73.8%
Taylor expanded in x around 0 27.6%
*-commutative27.6%
Simplified27.6%
associate-/l*51.8%
associate-/r/73.0%
Applied egg-rr73.0%
*-commutative73.0%
clear-num73.8%
un-div-inv73.9%
Applied egg-rr73.9%
Final simplification60.1%
(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.5%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 40.1%
Taylor expanded in x around 0 20.0%
*-commutative20.0%
Simplified20.0%
associate-/l*28.7%
associate-/r/52.6%
Applied egg-rr52.6%
Final simplification52.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 87.5%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 40.1%
associate-/l*52.5%
associate-/r/65.5%
Simplified65.5%
Taylor expanded in x around 0 28.7%
Final simplification28.7%
(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 2023297
(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))