
(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 (/ (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.5%
Simplified99.5%
associate-*r/87.7%
*-commutative87.7%
associate-/l*100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= (sinh y) -0.002)
(sinh y)
(if (<= (sinh y) 0.0005)
(/ (sin x) (+ (* -0.16666666666666666 (* y x)) (/ x y)))
(sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -0.002) {
tmp = sinh(y);
} else if (sinh(y) <= 0.0005) {
tmp = sin(x) / ((-0.16666666666666666 * (y * 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) <= (-0.002d0)) then
tmp = sinh(y)
else if (sinh(y) <= 0.0005d0) then
tmp = sin(x) / (((-0.16666666666666666d0) * (y * 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) <= -0.002) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 0.0005) {
tmp = Math.sin(x) / ((-0.16666666666666666 * (y * x)) + (x / y));
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -0.002: tmp = math.sinh(y) elif math.sinh(y) <= 0.0005: tmp = math.sin(x) / ((-0.16666666666666666 * (y * x)) + (x / y)) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -0.002) tmp = sinh(y); elseif (sinh(y) <= 0.0005) tmp = Float64(sin(x) / Float64(Float64(-0.16666666666666666 * Float64(y * x)) + Float64(x / y))); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (sinh(y) <= -0.002) tmp = sinh(y); elseif (sinh(y) <= 0.0005) tmp = sin(x) / ((-0.16666666666666666 * (y * x)) + (x / y)); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -0.002], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 0.0005], N[(N[Sin[x], $MachinePrecision] / N[(N[(-0.16666666666666666 * N[(y * x), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -0.002:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 0.0005:\\
\;\;\;\;\frac{\sin x}{-0.16666666666666666 \cdot \left(y \cdot x\right) + \frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -2e-3 or 5.0000000000000001e-4 < (sinh.f64 y) Initial program 100.0%
associate-*r/99.3%
Simplified99.3%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 79.6%
if -2e-3 < (sinh.f64 y) < 5.0000000000000001e-4Initial program 73.4%
associate-/l*99.4%
Simplified99.4%
Taylor expanded in y around 0 99.4%
Final simplification88.8%
(FPCore (x y) :precision binary64 (if (<= (sinh y) -0.002) (sinh y) (if (<= (sinh y) 0.0005) (* (sin x) (/ y x)) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -0.002) {
tmp = sinh(y);
} else if (sinh(y) <= 0.0005) {
tmp = sin(x) * (y / x);
} else {
tmp = sinh(y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (sinh(y) <= (-0.002d0)) then
tmp = sinh(y)
else if (sinh(y) <= 0.0005d0) then
tmp = sin(x) * (y / x)
else
tmp = sinh(y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.sinh(y) <= -0.002) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 0.0005) {
tmp = Math.sin(x) * (y / x);
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -0.002: tmp = math.sinh(y) elif math.sinh(y) <= 0.0005: tmp = math.sin(x) * (y / x) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -0.002) tmp = sinh(y); elseif (sinh(y) <= 0.0005) tmp = Float64(sin(x) * Float64(y / x)); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (sinh(y) <= -0.002) tmp = sinh(y); elseif (sinh(y) <= 0.0005) tmp = sin(x) * (y / x); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -0.002], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 0.0005], N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -0.002:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 0.0005:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -2e-3 or 5.0000000000000001e-4 < (sinh.f64 y) Initial program 100.0%
associate-*r/99.3%
Simplified99.3%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 79.6%
if -2e-3 < (sinh.f64 y) < 5.0000000000000001e-4Initial program 73.4%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 72.7%
associate-/l*99.2%
associate-/r/99.1%
Simplified99.1%
Final simplification88.6%
(FPCore (x y) :precision binary64 (if (<= (sinh y) -0.002) (sinh y) (if (<= (sinh y) 0.0005) (/ y (/ x (sin x))) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -0.002) {
tmp = sinh(y);
} else if (sinh(y) <= 0.0005) {
tmp = y / (x / sin(x));
} else {
tmp = sinh(y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (sinh(y) <= (-0.002d0)) then
tmp = sinh(y)
else if (sinh(y) <= 0.0005d0) then
tmp = y / (x / sin(x))
else
tmp = sinh(y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.sinh(y) <= -0.002) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 0.0005) {
tmp = y / (x / Math.sin(x));
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -0.002: tmp = math.sinh(y) elif math.sinh(y) <= 0.0005: tmp = y / (x / math.sin(x)) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -0.002) tmp = sinh(y); elseif (sinh(y) <= 0.0005) tmp = Float64(y / Float64(x / sin(x))); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (sinh(y) <= -0.002) tmp = sinh(y); elseif (sinh(y) <= 0.0005) tmp = y / (x / sin(x)); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -0.002], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 0.0005], N[(y / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -0.002:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 0.0005:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -2e-3 or 5.0000000000000001e-4 < (sinh.f64 y) Initial program 100.0%
associate-*r/99.3%
Simplified99.3%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 79.6%
if -2e-3 < (sinh.f64 y) < 5.0000000000000001e-4Initial program 73.4%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 72.7%
associate-/l*99.2%
Simplified99.2%
Final simplification88.7%
(FPCore (x y)
:precision binary64
(if (<= (sinh y) -0.002)
(sinh y)
(if (<= (sinh y) 0.0005)
(/ y (+ 1.0 (* 0.16666666666666666 (* x x))))
(sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -0.002) {
tmp = sinh(y);
} else if (sinh(y) <= 0.0005) {
tmp = y / (1.0 + (0.16666666666666666 * (x * x)));
} else {
tmp = sinh(y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (sinh(y) <= (-0.002d0)) then
tmp = sinh(y)
else if (sinh(y) <= 0.0005d0) then
tmp = y / (1.0d0 + (0.16666666666666666d0 * (x * x)))
else
tmp = sinh(y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.sinh(y) <= -0.002) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 0.0005) {
tmp = y / (1.0 + (0.16666666666666666 * (x * x)));
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -0.002: tmp = math.sinh(y) elif math.sinh(y) <= 0.0005: tmp = y / (1.0 + (0.16666666666666666 * (x * x))) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -0.002) tmp = sinh(y); elseif (sinh(y) <= 0.0005) tmp = Float64(y / Float64(1.0 + Float64(0.16666666666666666 * Float64(x * x)))); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (sinh(y) <= -0.002) tmp = sinh(y); elseif (sinh(y) <= 0.0005) tmp = y / (1.0 + (0.16666666666666666 * (x * x))); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -0.002], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 0.0005], N[(y / N[(1.0 + N[(0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -0.002:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 0.0005:\\
\;\;\;\;\frac{y}{1 + 0.16666666666666666 \cdot \left(x \cdot x\right)}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -2e-3 or 5.0000000000000001e-4 < (sinh.f64 y) Initial program 100.0%
associate-*r/99.3%
Simplified99.3%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 79.6%
if -2e-3 < (sinh.f64 y) < 5.0000000000000001e-4Initial program 73.4%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 72.7%
associate-/l*99.2%
associate-/r/99.1%
Simplified99.1%
associate-/r/99.2%
div-inv99.1%
associate-/r*98.9%
Applied egg-rr98.9%
Taylor expanded in x around 0 79.5%
Taylor expanded in y around 0 79.6%
*-commutative79.6%
+-commutative79.6%
*-commutative79.6%
distribute-lft-in79.6%
rgt-mult-inverse79.8%
associate-*r*79.8%
*-commutative79.8%
Simplified79.8%
Final simplification79.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}
Initial program 87.7%
associate-*r/99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y)
:precision binary64
(if (<= y -300.0)
(* (/ y x) (/ 6.0 x))
(if (<= y 330.0)
(/ y (+ 1.0 (* 0.16666666666666666 (* x x))))
(if (<= y 2.7e+198) (/ (* y 6.0) (* x x)) (sqrt (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= -300.0) {
tmp = (y / x) * (6.0 / x);
} else if (y <= 330.0) {
tmp = y / (1.0 + (0.16666666666666666 * (x * x)));
} else if (y <= 2.7e+198) {
tmp = (y * 6.0) / (x * 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 <= (-300.0d0)) then
tmp = (y / x) * (6.0d0 / x)
else if (y <= 330.0d0) then
tmp = y / (1.0d0 + (0.16666666666666666d0 * (x * x)))
else if (y <= 2.7d+198) then
tmp = (y * 6.0d0) / (x * x)
else
tmp = sqrt((y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -300.0) {
tmp = (y / x) * (6.0 / x);
} else if (y <= 330.0) {
tmp = y / (1.0 + (0.16666666666666666 * (x * x)));
} else if (y <= 2.7e+198) {
tmp = (y * 6.0) / (x * x);
} else {
tmp = Math.sqrt((y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -300.0: tmp = (y / x) * (6.0 / x) elif y <= 330.0: tmp = y / (1.0 + (0.16666666666666666 * (x * x))) elif y <= 2.7e+198: tmp = (y * 6.0) / (x * x) else: tmp = math.sqrt((y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= -300.0) tmp = Float64(Float64(y / x) * Float64(6.0 / x)); elseif (y <= 330.0) tmp = Float64(y / Float64(1.0 + Float64(0.16666666666666666 * Float64(x * x)))); elseif (y <= 2.7e+198) tmp = Float64(Float64(y * 6.0) / Float64(x * x)); else tmp = sqrt(Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -300.0) tmp = (y / x) * (6.0 / x); elseif (y <= 330.0) tmp = y / (1.0 + (0.16666666666666666 * (x * x))); elseif (y <= 2.7e+198) tmp = (y * 6.0) / (x * x); else tmp = sqrt((y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -300.0], N[(N[(y / x), $MachinePrecision] * N[(6.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 330.0], N[(y / N[(1.0 + N[(0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.7e+198], N[(N[(y * 6.0), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(y * y), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -300:\\
\;\;\;\;\frac{y}{x} \cdot \frac{6}{x}\\
\mathbf{elif}\;y \leq 330:\\
\;\;\;\;\frac{y}{1 + 0.16666666666666666 \cdot \left(x \cdot x\right)}\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+198}:\\
\;\;\;\;\frac{y \cdot 6}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{y \cdot y}\\
\end{array}
\end{array}
if y < -300Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.9%
associate-/l*4.9%
associate-/r/37.3%
Simplified37.3%
associate-/r/4.9%
div-inv4.9%
associate-/r*37.3%
Applied egg-rr37.3%
Taylor expanded in x around 0 36.5%
Taylor expanded in x around inf 52.8%
unpow252.8%
associate-*r/52.8%
times-frac52.8%
Simplified52.8%
if -300 < y < 330Initial program 74.1%
associate-*r/99.0%
Simplified99.0%
Taylor expanded in y around 0 71.5%
associate-/l*97.4%
associate-/r/97.2%
Simplified97.2%
associate-/r/97.4%
div-inv97.2%
associate-/r*97.0%
Applied egg-rr97.0%
Taylor expanded in x around 0 78.1%
Taylor expanded in y around 0 78.2%
*-commutative78.2%
+-commutative78.2%
*-commutative78.2%
distribute-lft-in78.2%
rgt-mult-inverse78.4%
associate-*r*78.4%
*-commutative78.4%
Simplified78.4%
if 330 < y < 2.6999999999999999e198Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 3.7%
associate-/l*3.7%
associate-/r/29.6%
Simplified29.6%
associate-/r/3.7%
div-inv3.7%
associate-/r*29.6%
Applied egg-rr29.6%
Taylor expanded in x around 0 29.1%
Taylor expanded in x around inf 57.4%
unpow257.4%
associate-*r/57.4%
Simplified57.4%
if 2.6999999999999999e198 < y Initial program 100.0%
Taylor expanded in y around 0 5.8%
Taylor expanded in x around 0 19.6%
div-inv19.6%
associate-*l*5.8%
div-inv5.8%
*-inverses5.8%
*-commutative5.8%
*-un-lft-identity5.8%
add-sqr-sqrt5.8%
sqrt-unprod80.0%
Applied egg-rr80.0%
Final simplification68.0%
(FPCore (x y)
:precision binary64
(if (<= y -300.0)
(* (/ y x) (/ 6.0 x))
(if (<= y 330.0)
(/ y (+ 1.0 (* 0.16666666666666666 (* x x))))
(/ (* y 6.0) (* x x)))))
double code(double x, double y) {
double tmp;
if (y <= -300.0) {
tmp = (y / x) * (6.0 / x);
} else if (y <= 330.0) {
tmp = y / (1.0 + (0.16666666666666666 * (x * x)));
} else {
tmp = (y * 6.0) / (x * x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-300.0d0)) then
tmp = (y / x) * (6.0d0 / x)
else if (y <= 330.0d0) then
tmp = y / (1.0d0 + (0.16666666666666666d0 * (x * x)))
else
tmp = (y * 6.0d0) / (x * x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -300.0) {
tmp = (y / x) * (6.0 / x);
} else if (y <= 330.0) {
tmp = y / (1.0 + (0.16666666666666666 * (x * x)));
} else {
tmp = (y * 6.0) / (x * x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -300.0: tmp = (y / x) * (6.0 / x) elif y <= 330.0: tmp = y / (1.0 + (0.16666666666666666 * (x * x))) else: tmp = (y * 6.0) / (x * x) return tmp
function code(x, y) tmp = 0.0 if (y <= -300.0) tmp = Float64(Float64(y / x) * Float64(6.0 / x)); elseif (y <= 330.0) tmp = Float64(y / Float64(1.0 + Float64(0.16666666666666666 * Float64(x * x)))); else tmp = Float64(Float64(y * 6.0) / Float64(x * x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -300.0) tmp = (y / x) * (6.0 / x); elseif (y <= 330.0) tmp = y / (1.0 + (0.16666666666666666 * (x * x))); else tmp = (y * 6.0) / (x * x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -300.0], N[(N[(y / x), $MachinePrecision] * N[(6.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 330.0], N[(y / N[(1.0 + N[(0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 6.0), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -300:\\
\;\;\;\;\frac{y}{x} \cdot \frac{6}{x}\\
\mathbf{elif}\;y \leq 330:\\
\;\;\;\;\frac{y}{1 + 0.16666666666666666 \cdot \left(x \cdot x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 6}{x \cdot x}\\
\end{array}
\end{array}
if y < -300Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.9%
associate-/l*4.9%
associate-/r/37.3%
Simplified37.3%
associate-/r/4.9%
div-inv4.9%
associate-/r*37.3%
Applied egg-rr37.3%
Taylor expanded in x around 0 36.5%
Taylor expanded in x around inf 52.8%
unpow252.8%
associate-*r/52.8%
times-frac52.8%
Simplified52.8%
if -300 < y < 330Initial program 74.1%
associate-*r/99.0%
Simplified99.0%
Taylor expanded in y around 0 71.5%
associate-/l*97.4%
associate-/r/97.2%
Simplified97.2%
associate-/r/97.4%
div-inv97.2%
associate-/r*97.0%
Applied egg-rr97.0%
Taylor expanded in x around 0 78.1%
Taylor expanded in y around 0 78.2%
*-commutative78.2%
+-commutative78.2%
*-commutative78.2%
distribute-lft-in78.2%
rgt-mult-inverse78.4%
associate-*r*78.4%
*-commutative78.4%
Simplified78.4%
if 330 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.3%
associate-/l*4.3%
associate-/r/34.9%
Simplified34.9%
associate-/r/4.3%
div-inv4.3%
associate-/r*34.9%
Applied egg-rr34.9%
Taylor expanded in x around 0 34.3%
Taylor expanded in x around inf 54.3%
unpow254.3%
associate-*r/54.3%
Simplified54.3%
Final simplification65.4%
(FPCore (x y) :precision binary64 (if (or (<= y -250.0) (not (<= y 270.0))) (* (/ y x) (/ 6.0 x)) (/ x (/ x y))))
double code(double x, double y) {
double tmp;
if ((y <= -250.0) || !(y <= 270.0)) {
tmp = (y / x) * (6.0 / 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 <= (-250.0d0)) .or. (.not. (y <= 270.0d0))) then
tmp = (y / x) * (6.0d0 / x)
else
tmp = x / (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -250.0) || !(y <= 270.0)) {
tmp = (y / x) * (6.0 / x);
} else {
tmp = x / (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -250.0) or not (y <= 270.0): tmp = (y / x) * (6.0 / x) else: tmp = x / (x / y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -250.0) || !(y <= 270.0)) tmp = Float64(Float64(y / x) * Float64(6.0 / x)); else tmp = Float64(x / Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -250.0) || ~((y <= 270.0))) tmp = (y / x) * (6.0 / x); else tmp = x / (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -250.0], N[Not[LessEqual[y, 270.0]], $MachinePrecision]], N[(N[(y / x), $MachinePrecision] * N[(6.0 / x), $MachinePrecision]), $MachinePrecision], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -250 \lor \neg \left(y \leq 270\right):\\
\;\;\;\;\frac{y}{x} \cdot \frac{6}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\end{array}
\end{array}
if y < -250 or 270 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.6%
associate-/l*4.6%
associate-/r/36.0%
Simplified36.0%
associate-/r/4.6%
div-inv4.6%
associate-/r*36.0%
Applied egg-rr36.0%
Taylor expanded in x around 0 35.4%
Taylor expanded in x around inf 53.5%
unpow253.5%
associate-*r/53.5%
times-frac53.5%
Simplified53.5%
if -250 < y < 270Initial program 74.1%
Taylor expanded in y around 0 71.5%
Taylor expanded in x around 0 30.9%
associate-/l*56.7%
associate-/r/76.6%
Applied egg-rr76.6%
*-commutative76.6%
clear-num77.6%
un-div-inv77.7%
Applied egg-rr77.7%
Final simplification65.1%
(FPCore (x y) :precision binary64 (if (<= y -290.0) (* (/ y x) (/ 6.0 x)) (if (<= y 300.0) (/ x (/ x y)) (/ (* y 6.0) (* x x)))))
double code(double x, double y) {
double tmp;
if (y <= -290.0) {
tmp = (y / x) * (6.0 / x);
} else if (y <= 300.0) {
tmp = x / (x / y);
} else {
tmp = (y * 6.0) / (x * x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-290.0d0)) then
tmp = (y / x) * (6.0d0 / x)
else if (y <= 300.0d0) then
tmp = x / (x / y)
else
tmp = (y * 6.0d0) / (x * x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -290.0) {
tmp = (y / x) * (6.0 / x);
} else if (y <= 300.0) {
tmp = x / (x / y);
} else {
tmp = (y * 6.0) / (x * x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -290.0: tmp = (y / x) * (6.0 / x) elif y <= 300.0: tmp = x / (x / y) else: tmp = (y * 6.0) / (x * x) return tmp
function code(x, y) tmp = 0.0 if (y <= -290.0) tmp = Float64(Float64(y / x) * Float64(6.0 / x)); elseif (y <= 300.0) tmp = Float64(x / Float64(x / y)); else tmp = Float64(Float64(y * 6.0) / Float64(x * x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -290.0) tmp = (y / x) * (6.0 / x); elseif (y <= 300.0) tmp = x / (x / y); else tmp = (y * 6.0) / (x * x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -290.0], N[(N[(y / x), $MachinePrecision] * N[(6.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 300.0], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(y * 6.0), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -290:\\
\;\;\;\;\frac{y}{x} \cdot \frac{6}{x}\\
\mathbf{elif}\;y \leq 300:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 6}{x \cdot x}\\
\end{array}
\end{array}
if y < -290Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.9%
associate-/l*4.9%
associate-/r/37.3%
Simplified37.3%
associate-/r/4.9%
div-inv4.9%
associate-/r*37.3%
Applied egg-rr37.3%
Taylor expanded in x around 0 36.5%
Taylor expanded in x around inf 52.8%
unpow252.8%
associate-*r/52.8%
times-frac52.8%
Simplified52.8%
if -290 < y < 300Initial program 74.1%
Taylor expanded in y around 0 71.5%
Taylor expanded in x around 0 30.9%
associate-/l*56.7%
associate-/r/76.6%
Applied egg-rr76.6%
*-commutative76.6%
clear-num77.6%
un-div-inv77.7%
Applied egg-rr77.7%
if 300 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.3%
associate-/l*4.3%
associate-/r/34.9%
Simplified34.9%
associate-/r/4.3%
div-inv4.3%
associate-/r*34.9%
Applied egg-rr34.9%
Taylor expanded in x around 0 34.3%
Taylor expanded in x around inf 54.3%
unpow254.3%
associate-*r/54.3%
Simplified54.3%
Final simplification65.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.7%
Taylor expanded in y around 0 36.5%
Taylor expanded in x around 0 21.0%
associate-/l*29.3%
associate-/r/55.2%
Applied egg-rr55.2%
Final simplification55.2%
(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-*r/99.5%
Simplified99.5%
Taylor expanded in y around 0 36.5%
associate-/l*48.8%
associate-/r/65.2%
Simplified65.2%
Taylor expanded in x around 0 29.3%
Final simplification29.3%
(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 2023173
(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))