
(FPCore (x y) :precision binary64 (/ (* (sin x) (sinh y)) x))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(x) * sinh(y)) / x
end function
public static double code(double x, double y) {
return (Math.sin(x) * Math.sinh(y)) / x;
}
def code(x, y): return (math.sin(x) * math.sinh(y)) / x
function code(x, y) return Float64(Float64(sin(x) * sinh(y)) / x) end
function tmp = code(x, y) tmp = (sin(x) * sinh(y)) / x; end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x \cdot \sinh y}{x}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* (sin x) (sinh y)) x))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(x) * sinh(y)) / x
end function
public static double code(double x, double y) {
return (Math.sin(x) * Math.sinh(y)) / x;
}
def code(x, y): return (math.sin(x) * math.sinh(y)) / x
function code(x, y) return Float64(Float64(sin(x) * sinh(y)) / x) end
function tmp = code(x, y) tmp = (sin(x) * sinh(y)) / x; end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x \cdot \sinh y}{x}
\end{array}
(FPCore (x y) :precision binary64 (* (/ (sin x) x) (sinh y)))
double code(double x, double y) {
return (sin(x) / x) * sinh(y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(x) / x) * sinh(y)
end function
public static double code(double x, double y) {
return (Math.sin(x) / x) * Math.sinh(y);
}
def code(x, y): return (math.sin(x) / x) * math.sinh(y)
function code(x, y) return Float64(Float64(sin(x) / x) * sinh(y)) end
function tmp = code(x, y) tmp = (sin(x) / x) * sinh(y); end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x}{x} \cdot \sinh y
\end{array}
Initial program 88.2%
associate-*l/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= (sinh y) -4e-8) (* (+ 1.0 (* (* x x) -0.16666666666666666)) (sinh y)) (if (<= (sinh y) 2e-21) (/ y (/ x (sin x))) (sinh y))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -4e-8) {
tmp = (1.0 + ((x * x) * -0.16666666666666666)) * sinh(y);
} else if (sinh(y) <= 2e-21) {
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) <= (-4d-8)) then
tmp = (1.0d0 + ((x * x) * (-0.16666666666666666d0))) * sinh(y)
else if (sinh(y) <= 2d-21) 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) <= -4e-8) {
tmp = (1.0 + ((x * x) * -0.16666666666666666)) * Math.sinh(y);
} else if (Math.sinh(y) <= 2e-21) {
tmp = y / (x / Math.sin(x));
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -4e-8: tmp = (1.0 + ((x * x) * -0.16666666666666666)) * math.sinh(y) elif math.sinh(y) <= 2e-21: tmp = y / (x / math.sin(x)) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -4e-8) tmp = Float64(Float64(1.0 + Float64(Float64(x * x) * -0.16666666666666666)) * sinh(y)); elseif (sinh(y) <= 2e-21) 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) <= -4e-8) tmp = (1.0 + ((x * x) * -0.16666666666666666)) * sinh(y); elseif (sinh(y) <= 2e-21) tmp = y / (x / sin(x)); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -4e-8], N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 2e-21], 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 -4 \cdot 10^{-8}:\\
\;\;\;\;\left(1 + \left(x \cdot x\right) \cdot -0.16666666666666666\right) \cdot \sinh y\\
\mathbf{elif}\;\sinh y \leq 2 \cdot 10^{-21}:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if (sinh.f64 y) < -4.0000000000000001e-8Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 83.1%
*-commutative83.1%
unpow283.1%
Simplified83.1%
if -4.0000000000000001e-8 < (sinh.f64 y) < 1.99999999999999982e-21Initial program 77.5%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 77.5%
associate-/l*100.0%
Simplified100.0%
if 1.99999999999999982e-21 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 76.2%
Final simplification90.2%
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) x)))
double code(double x, double y) {
return sin(x) * (sinh(y) / x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / x)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / x);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / x)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / x)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / x); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{x}
\end{array}
Initial program 88.2%
associate-*r/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= y -1.9e+140)
(* x (- (* y (* x -0.16666666666666666)) (/ y (- x))))
(if (<= y -4e-8)
(sinh y)
(if (<= y 5.5e-15) (* (sin x) (/ y x)) (sinh y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.9e+140) {
tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x));
} else if (y <= -4e-8) {
tmp = sinh(y);
} else if (y <= 5.5e-15) {
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 (y <= (-1.9d+140)) then
tmp = x * ((y * (x * (-0.16666666666666666d0))) - (y / -x))
else if (y <= (-4d-8)) then
tmp = sinh(y)
else if (y <= 5.5d-15) 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 (y <= -1.9e+140) {
tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x));
} else if (y <= -4e-8) {
tmp = Math.sinh(y);
} else if (y <= 5.5e-15) {
tmp = Math.sin(x) * (y / x);
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.9e+140: tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x)) elif y <= -4e-8: tmp = math.sinh(y) elif y <= 5.5e-15: tmp = math.sin(x) * (y / x) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.9e+140) tmp = Float64(x * Float64(Float64(y * Float64(x * -0.16666666666666666)) - Float64(y / Float64(-x)))); elseif (y <= -4e-8) tmp = sinh(y); elseif (y <= 5.5e-15) 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 (y <= -1.9e+140) tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x)); elseif (y <= -4e-8) tmp = sinh(y); elseif (y <= 5.5e-15) tmp = sin(x) * (y / x); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.9e+140], N[(x * N[(N[(y * N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] - N[(y / (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4e-8], N[Sinh[y], $MachinePrecision], If[LessEqual[y, 5.5e-15], N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+140}:\\
\;\;\;\;x \cdot \left(y \cdot \left(x \cdot -0.16666666666666666\right) - \frac{y}{-x}\right)\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-8}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-15}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if y < -1.9e140Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 5.3%
associate-/l*5.3%
associate-/r/31.4%
Simplified31.4%
Taylor expanded in x around 0 49.6%
unpow249.6%
Simplified49.6%
*-un-lft-identity49.6%
*-commutative49.6%
*-inverses49.6%
div-inv49.6%
associate-*l*13.9%
div-inv13.9%
frac-2neg13.9%
div-inv13.9%
fma-def13.9%
*-commutative13.9%
distribute-rgt-neg-in13.9%
associate-*r*13.9%
*-commutative13.9%
Applied egg-rr13.9%
fma-udef13.9%
associate-*l*75.6%
associate-*l*75.6%
*-commutative75.6%
distribute-lft-out75.6%
associate-*r/75.6%
distribute-lft-neg-in75.6%
*-rgt-identity75.6%
*-commutative75.6%
associate-*l*75.6%
*-commutative75.6%
Simplified75.6%
if -1.9e140 < y < -4.0000000000000001e-8 or 5.5000000000000002e-15 < y Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 78.7%
if -4.0000000000000001e-8 < y < 5.5000000000000002e-15Initial program 77.5%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 77.5%
associate-/l*100.0%
associate-/r/99.8%
Simplified99.8%
Final simplification89.4%
(FPCore (x y)
:precision binary64
(if (<= y -1.9e+140)
(* x (- (* y (* x -0.16666666666666666)) (/ y (- x))))
(if (<= y -4e-8)
(sinh y)
(if (<= y 5.5e-15) (/ y (/ x (sin x))) (sinh y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.9e+140) {
tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x));
} else if (y <= -4e-8) {
tmp = sinh(y);
} else if (y <= 5.5e-15) {
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 (y <= (-1.9d+140)) then
tmp = x * ((y * (x * (-0.16666666666666666d0))) - (y / -x))
else if (y <= (-4d-8)) then
tmp = sinh(y)
else if (y <= 5.5d-15) 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 (y <= -1.9e+140) {
tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x));
} else if (y <= -4e-8) {
tmp = Math.sinh(y);
} else if (y <= 5.5e-15) {
tmp = y / (x / Math.sin(x));
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.9e+140: tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x)) elif y <= -4e-8: tmp = math.sinh(y) elif y <= 5.5e-15: tmp = y / (x / math.sin(x)) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.9e+140) tmp = Float64(x * Float64(Float64(y * Float64(x * -0.16666666666666666)) - Float64(y / Float64(-x)))); elseif (y <= -4e-8) tmp = sinh(y); elseif (y <= 5.5e-15) 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 (y <= -1.9e+140) tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x)); elseif (y <= -4e-8) tmp = sinh(y); elseif (y <= 5.5e-15) tmp = y / (x / sin(x)); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.9e+140], N[(x * N[(N[(y * N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] - N[(y / (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4e-8], N[Sinh[y], $MachinePrecision], If[LessEqual[y, 5.5e-15], N[(y / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+140}:\\
\;\;\;\;x \cdot \left(y \cdot \left(x \cdot -0.16666666666666666\right) - \frac{y}{-x}\right)\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-8}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-15}:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if y < -1.9e140Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 5.3%
associate-/l*5.3%
associate-/r/31.4%
Simplified31.4%
Taylor expanded in x around 0 49.6%
unpow249.6%
Simplified49.6%
*-un-lft-identity49.6%
*-commutative49.6%
*-inverses49.6%
div-inv49.6%
associate-*l*13.9%
div-inv13.9%
frac-2neg13.9%
div-inv13.9%
fma-def13.9%
*-commutative13.9%
distribute-rgt-neg-in13.9%
associate-*r*13.9%
*-commutative13.9%
Applied egg-rr13.9%
fma-udef13.9%
associate-*l*75.6%
associate-*l*75.6%
*-commutative75.6%
distribute-lft-out75.6%
associate-*r/75.6%
distribute-lft-neg-in75.6%
*-rgt-identity75.6%
*-commutative75.6%
associate-*l*75.6%
*-commutative75.6%
Simplified75.6%
if -1.9e140 < y < -4.0000000000000001e-8 or 5.5000000000000002e-15 < y Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 78.7%
if -4.0000000000000001e-8 < y < 5.5000000000000002e-15Initial program 77.5%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 77.5%
associate-/l*100.0%
Simplified100.0%
Final simplification89.5%
(FPCore (x y) :precision binary64 (if (<= y -1e+140) (* x (- (* y (* x -0.16666666666666666)) (/ y (- x)))) (if (<= y -4e-8) (sinh y) (if (<= y 2.1e-72) (/ x (/ x y)) (sinh y)))))
double code(double x, double y) {
double tmp;
if (y <= -1e+140) {
tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x));
} else if (y <= -4e-8) {
tmp = sinh(y);
} else if (y <= 2.1e-72) {
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 (y <= (-1d+140)) then
tmp = x * ((y * (x * (-0.16666666666666666d0))) - (y / -x))
else if (y <= (-4d-8)) then
tmp = sinh(y)
else if (y <= 2.1d-72) 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 (y <= -1e+140) {
tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x));
} else if (y <= -4e-8) {
tmp = Math.sinh(y);
} else if (y <= 2.1e-72) {
tmp = x / (x / y);
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1e+140: tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x)) elif y <= -4e-8: tmp = math.sinh(y) elif y <= 2.1e-72: tmp = x / (x / y) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1e+140) tmp = Float64(x * Float64(Float64(y * Float64(x * -0.16666666666666666)) - Float64(y / Float64(-x)))); elseif (y <= -4e-8) tmp = sinh(y); elseif (y <= 2.1e-72) tmp = Float64(x / Float64(x / y)); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1e+140) tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x)); elseif (y <= -4e-8) tmp = sinh(y); elseif (y <= 2.1e-72) tmp = x / (x / y); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1e+140], N[(x * N[(N[(y * N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] - N[(y / (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4e-8], N[Sinh[y], $MachinePrecision], If[LessEqual[y, 2.1e-72], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+140}:\\
\;\;\;\;x \cdot \left(y \cdot \left(x \cdot -0.16666666666666666\right) - \frac{y}{-x}\right)\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-8}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-72}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if y < -1.00000000000000006e140Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 5.3%
associate-/l*5.3%
associate-/r/31.4%
Simplified31.4%
Taylor expanded in x around 0 49.6%
unpow249.6%
Simplified49.6%
*-un-lft-identity49.6%
*-commutative49.6%
*-inverses49.6%
div-inv49.6%
associate-*l*13.9%
div-inv13.9%
frac-2neg13.9%
div-inv13.9%
fma-def13.9%
*-commutative13.9%
distribute-rgt-neg-in13.9%
associate-*r*13.9%
*-commutative13.9%
Applied egg-rr13.9%
fma-udef13.9%
associate-*l*75.6%
associate-*l*75.6%
*-commutative75.6%
distribute-lft-out75.6%
associate-*r/75.6%
distribute-lft-neg-in75.6%
*-rgt-identity75.6%
*-commutative75.6%
associate-*l*75.6%
*-commutative75.6%
Simplified75.6%
if -1.00000000000000006e140 < y < -4.0000000000000001e-8 or 2.1e-72 < y Initial program 99.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 75.7%
if -4.0000000000000001e-8 < y < 2.1e-72Initial program 76.1%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 76.1%
Taylor expanded in x around 0 29.9%
associate-/l*53.7%
associate-/r/76.5%
Applied egg-rr76.5%
*-commutative76.5%
clear-num79.2%
un-div-inv79.3%
Applied egg-rr79.3%
Final simplification77.4%
(FPCore (x y) :precision binary64 (if (or (<= y -1.3e-10) (not (<= y 1.8e+24))) (* x (- (* y (* x -0.16666666666666666)) (/ y (- x)))) (/ x (/ x y))))
double code(double x, double y) {
double tmp;
if ((y <= -1.3e-10) || !(y <= 1.8e+24)) {
tmp = x * ((y * (x * -0.16666666666666666)) - (y / -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 <= (-1.3d-10)) .or. (.not. (y <= 1.8d+24))) then
tmp = x * ((y * (x * (-0.16666666666666666d0))) - (y / -x))
else
tmp = x / (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.3e-10) || !(y <= 1.8e+24)) {
tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x));
} else {
tmp = x / (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.3e-10) or not (y <= 1.8e+24): tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x)) else: tmp = x / (x / y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.3e-10) || !(y <= 1.8e+24)) tmp = Float64(x * Float64(Float64(y * Float64(x * -0.16666666666666666)) - Float64(y / Float64(-x)))); else tmp = Float64(x / Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.3e-10) || ~((y <= 1.8e+24))) tmp = x * ((y * (x * -0.16666666666666666)) - (y / -x)); else tmp = x / (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.3e-10], N[Not[LessEqual[y, 1.8e+24]], $MachinePrecision]], N[(x * N[(N[(y * N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] - N[(y / (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{-10} \lor \neg \left(y \leq 1.8 \cdot 10^{+24}\right):\\
\;\;\;\;x \cdot \left(y \cdot \left(x \cdot -0.16666666666666666\right) - \frac{y}{-x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\end{array}
\end{array}
if y < -1.29999999999999991e-10 or 1.79999999999999992e24 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 6.2%
associate-/l*6.2%
associate-/r/27.9%
Simplified27.9%
Taylor expanded in x around 0 29.0%
unpow229.0%
Simplified29.0%
*-un-lft-identity29.0%
*-commutative29.0%
*-inverses29.0%
div-inv29.0%
associate-*l*11.6%
div-inv11.6%
frac-2neg11.6%
div-inv11.6%
fma-def11.6%
*-commutative11.6%
distribute-rgt-neg-in11.6%
associate-*r*11.6%
*-commutative11.6%
Applied egg-rr11.6%
fma-udef11.6%
associate-*l*50.8%
associate-*l*50.8%
*-commutative50.8%
distribute-lft-out50.8%
associate-*r/50.8%
distribute-lft-neg-in50.8%
*-rgt-identity50.8%
*-commutative50.8%
associate-*l*50.8%
*-commutative50.8%
Simplified50.8%
if -1.29999999999999991e-10 < y < 1.79999999999999992e24Initial program 78.6%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 75.4%
Taylor expanded in x around 0 32.1%
associate-/l*53.4%
associate-/r/73.1%
Applied egg-rr73.1%
*-commutative73.1%
clear-num75.4%
un-div-inv75.5%
Applied egg-rr75.5%
Final simplification64.4%
(FPCore (x y) :precision binary64 (if (<= y -1.3e+290) (* x (/ y x)) (if (<= y -1.25e+91) (/ (* x (- y)) x) (/ x (/ x y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.3e+290) {
tmp = x * (y / x);
} else if (y <= -1.25e+91) {
tmp = (x * -y) / 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 <= (-1.3d+290)) then
tmp = x * (y / x)
else if (y <= (-1.25d+91)) then
tmp = (x * -y) / x
else
tmp = x / (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.3e+290) {
tmp = x * (y / x);
} else if (y <= -1.25e+91) {
tmp = (x * -y) / x;
} else {
tmp = x / (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.3e+290: tmp = x * (y / x) elif y <= -1.25e+91: tmp = (x * -y) / x else: tmp = x / (x / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.3e+290) tmp = Float64(x * Float64(y / x)); elseif (y <= -1.25e+91) tmp = Float64(Float64(x * Float64(-y)) / x); else tmp = Float64(x / Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.3e+290) tmp = x * (y / x); elseif (y <= -1.25e+91) tmp = (x * -y) / x; else tmp = x / (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.3e+290], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.25e+91], N[(N[(x * (-y)), $MachinePrecision] / x), $MachinePrecision], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+290}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{elif}\;y \leq -1.25 \cdot 10^{+91}:\\
\;\;\;\;\frac{x \cdot \left(-y\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\end{array}
\end{array}
if y < -1.29999999999999999e290Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 9.8%
Taylor expanded in x around 0 28.8%
associate-/l*12.2%
associate-/r/83.4%
Applied egg-rr83.4%
if -1.29999999999999999e290 < y < -1.2500000000000001e91Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.0%
Taylor expanded in x around 0 11.4%
associate-/l*2.8%
associate-/r/14.1%
Applied egg-rr14.1%
associate-*l/11.4%
frac-2neg11.4%
add-sqr-sqrt4.3%
sqrt-unprod7.4%
sqr-neg7.4%
sqrt-unprod21.6%
add-sqr-sqrt37.1%
Applied egg-rr37.1%
if -1.2500000000000001e91 < y Initial program 86.1%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 51.2%
Taylor expanded in x around 0 25.6%
associate-/l*36.4%
associate-/r/57.3%
Applied egg-rr57.3%
*-commutative57.3%
clear-num58.8%
un-div-inv58.4%
Applied egg-rr58.4%
Final simplification56.1%
(FPCore (x y) :precision binary64 (if (<= x 4.3e+18) (* x (/ y x)) (/ (* y (- y)) y)))
double code(double x, double y) {
double tmp;
if (x <= 4.3e+18) {
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 <= 4.3d+18) 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 <= 4.3e+18) {
tmp = x * (y / x);
} else {
tmp = (y * -y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 4.3e+18: tmp = x * (y / x) else: tmp = (y * -y) / y return tmp
function code(x, y) tmp = 0.0 if (x <= 4.3e+18) 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 <= 4.3e+18) tmp = x * (y / x); else tmp = (y * -y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 4.3e+18], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(y * (-y)), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.3 \cdot 10^{+18}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(-y\right)}{y}\\
\end{array}
\end{array}
if x < 4.3e18Initial program 84.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 42.8%
Taylor expanded in x around 0 26.6%
associate-/l*39.4%
associate-/r/60.3%
Applied egg-rr60.3%
if 4.3e18 < x Initial program 99.9%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 49.7%
Taylor expanded in x around 0 13.8%
clear-num13.8%
inv-pow13.8%
*-commutative13.8%
associate-/r*3.6%
*-inverses3.6%
Applied egg-rr3.6%
unpow-13.6%
remove-double-div3.6%
add-sqr-sqrt2.3%
sqrt-unprod37.7%
sqr-neg37.7%
sqrt-unprod2.1%
add-sqr-sqrt4.9%
neg-sub04.9%
metadata-eval4.9%
flip--43.0%
metadata-eval43.0%
metadata-eval43.0%
metadata-eval43.0%
add-sqr-sqrt24.2%
sqrt-unprod1.4%
sqr-neg1.4%
sqrt-unprod9.7%
add-sqr-sqrt28.6%
sub-neg28.6%
metadata-eval28.6%
neg-sub028.6%
add-sqr-sqrt9.7%
sqrt-unprod1.4%
sqr-neg1.4%
sqrt-unprod24.2%
add-sqr-sqrt43.0%
Applied egg-rr43.0%
sub0-neg43.0%
Simplified43.0%
Final simplification56.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 88.2%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 44.3%
Taylor expanded in x around 0 23.8%
associate-/l*31.6%
associate-/r/52.2%
Applied egg-rr52.2%
Final simplification52.2%
(FPCore (x y) :precision binary64 (/ x (/ x y)))
double code(double x, double y) {
return x / (x / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / (x / y)
end function
public static double code(double x, double y) {
return x / (x / y);
}
def code(x, y): return x / (x / y)
function code(x, y) return Float64(x / Float64(x / y)) end
function tmp = code(x, y) tmp = x / (x / y); end
code[x_, y_] := N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{x}{y}}
\end{array}
Initial program 88.2%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 44.3%
Taylor expanded in x around 0 23.8%
associate-/l*31.6%
associate-/r/52.2%
Applied egg-rr52.2%
*-commutative52.2%
clear-num53.5%
un-div-inv53.2%
Applied egg-rr53.2%
Final simplification53.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 88.2%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 44.3%
associate-/l*56.1%
associate-/r/65.8%
Simplified65.8%
Taylor expanded in x around 0 31.6%
Final simplification31.6%
(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 2023200
(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))