
(FPCore (x y) :precision binary64 (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))
double code(double x, double y) {
return (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (3.0d0 * sqrt(x)) * ((y + (1.0d0 / (x * 9.0d0))) - 1.0d0)
end function
public static double code(double x, double y) {
return (3.0 * Math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
def code(x, y): return (3.0 * math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0)
function code(x, y) return Float64(Float64(3.0 * sqrt(x)) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) - 1.0)) end
function tmp = code(x, y) tmp = (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0); end
code[x_, y_] := N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))
double code(double x, double y) {
return (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (3.0d0 * sqrt(x)) * ((y + (1.0d0 / (x * 9.0d0))) - 1.0d0)
end function
public static double code(double x, double y) {
return (3.0 * Math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
def code(x, y): return (3.0 * math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0)
function code(x, y) return Float64(Float64(3.0 * sqrt(x)) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) - 1.0)) end
function tmp = code(x, y) tmp = (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0); end
code[x_, y_] := N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)
\end{array}
(FPCore (x y) :precision binary64 (fma 3.0 (* (sqrt x) y) (* (sqrt x) (+ -3.0 (/ 0.3333333333333333 x)))))
double code(double x, double y) {
return fma(3.0, (sqrt(x) * y), (sqrt(x) * (-3.0 + (0.3333333333333333 / x))));
}
function code(x, y) return fma(3.0, Float64(sqrt(x) * y), Float64(sqrt(x) * Float64(-3.0 + Float64(0.3333333333333333 / x)))) end
code[x_, y_] := N[(3.0 * N[(N[Sqrt[x], $MachinePrecision] * y), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * N[(-3.0 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(3, \sqrt{x} \cdot y, \sqrt{x} \cdot \left(-3 + \frac{0.3333333333333333}{x}\right)\right)
\end{array}
Initial program 99.4%
*-commutative99.4%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-define99.4%
sub-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.4%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
fma-undefine99.5%
+-commutative99.5%
associate-+r+99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 99.4%
fma-define99.4%
sub-neg99.4%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
+-commutative99.5%
Simplified99.5%
(FPCore (x y)
:precision binary64
(if (<= y -2.45e+62)
(* y (sqrt (* x 9.0)))
(if (<= y 1.32e+25)
(* (sqrt x) (- -3.0 (/ -0.3333333333333333 x)))
(* (sqrt x) (* 3.0 y)))))
double code(double x, double y) {
double tmp;
if (y <= -2.45e+62) {
tmp = y * sqrt((x * 9.0));
} else if (y <= 1.32e+25) {
tmp = sqrt(x) * (-3.0 - (-0.3333333333333333 / x));
} else {
tmp = sqrt(x) * (3.0 * 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.45d+62)) then
tmp = y * sqrt((x * 9.0d0))
else if (y <= 1.32d+25) then
tmp = sqrt(x) * ((-3.0d0) - ((-0.3333333333333333d0) / x))
else
tmp = sqrt(x) * (3.0d0 * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.45e+62) {
tmp = y * Math.sqrt((x * 9.0));
} else if (y <= 1.32e+25) {
tmp = Math.sqrt(x) * (-3.0 - (-0.3333333333333333 / x));
} else {
tmp = Math.sqrt(x) * (3.0 * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.45e+62: tmp = y * math.sqrt((x * 9.0)) elif y <= 1.32e+25: tmp = math.sqrt(x) * (-3.0 - (-0.3333333333333333 / x)) else: tmp = math.sqrt(x) * (3.0 * y) return tmp
function code(x, y) tmp = 0.0 if (y <= -2.45e+62) tmp = Float64(y * sqrt(Float64(x * 9.0))); elseif (y <= 1.32e+25) tmp = Float64(sqrt(x) * Float64(-3.0 - Float64(-0.3333333333333333 / x))); else tmp = Float64(sqrt(x) * Float64(3.0 * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.45e+62) tmp = y * sqrt((x * 9.0)); elseif (y <= 1.32e+25) tmp = sqrt(x) * (-3.0 - (-0.3333333333333333 / x)); else tmp = sqrt(x) * (3.0 * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.45e+62], N[(y * N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.32e+25], N[(N[Sqrt[x], $MachinePrecision] * N[(-3.0 - N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(3.0 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.45 \cdot 10^{+62}:\\
\;\;\;\;y \cdot \sqrt{x \cdot 9}\\
\mathbf{elif}\;y \leq 1.32 \cdot 10^{+25}:\\
\;\;\;\;\sqrt{x} \cdot \left(-3 - \frac{-0.3333333333333333}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(3 \cdot y\right)\\
\end{array}
\end{array}
if y < -2.4499999999999998e62Initial program 99.7%
+-commutative99.7%
associate--l+99.7%
*-commutative99.7%
associate-/r*99.6%
metadata-eval99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
*-commutative99.6%
metadata-eval99.6%
sqrt-prod99.8%
pow1/299.8%
Applied egg-rr99.8%
unpow1/299.8%
Simplified99.8%
Taylor expanded in y around inf 78.3%
if -2.4499999999999998e62 < y < 1.32e25Initial program 99.4%
*-commutative99.4%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-define99.4%
sub-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.4%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in y around 0 93.6%
sub-neg93.6%
metadata-eval93.6%
associate-*r/93.7%
metadata-eval93.7%
+-commutative93.7%
metadata-eval93.7%
distribute-neg-frac93.7%
unsub-neg93.7%
Simplified93.7%
if 1.32e25 < y Initial program 99.5%
*-commutative99.5%
associate-*l*99.5%
associate--l+99.5%
distribute-lft-in99.5%
fma-define99.5%
sub-neg99.5%
+-commutative99.5%
distribute-lft-in99.5%
metadata-eval99.5%
metadata-eval99.5%
*-commutative99.5%
associate-/r*99.5%
associate-*r/99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 73.8%
*-commutative73.8%
associate-*l*73.9%
*-commutative73.9%
Simplified73.9%
Final simplification86.2%
(FPCore (x y) :precision binary64 (if (<= x 6.5e-27) (sqrt (/ 0.1111111111111111 x)) (if (<= x 7.2e+71) (* y (sqrt (* x 9.0))) (* (sqrt x) -3.0))))
double code(double x, double y) {
double tmp;
if (x <= 6.5e-27) {
tmp = sqrt((0.1111111111111111 / x));
} else if (x <= 7.2e+71) {
tmp = y * sqrt((x * 9.0));
} else {
tmp = sqrt(x) * -3.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 6.5d-27) then
tmp = sqrt((0.1111111111111111d0 / x))
else if (x <= 7.2d+71) then
tmp = y * sqrt((x * 9.0d0))
else
tmp = sqrt(x) * (-3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 6.5e-27) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else if (x <= 7.2e+71) {
tmp = y * Math.sqrt((x * 9.0));
} else {
tmp = Math.sqrt(x) * -3.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 6.5e-27: tmp = math.sqrt((0.1111111111111111 / x)) elif x <= 7.2e+71: tmp = y * math.sqrt((x * 9.0)) else: tmp = math.sqrt(x) * -3.0 return tmp
function code(x, y) tmp = 0.0 if (x <= 6.5e-27) tmp = sqrt(Float64(0.1111111111111111 / x)); elseif (x <= 7.2e+71) tmp = Float64(y * sqrt(Float64(x * 9.0))); else tmp = Float64(sqrt(x) * -3.0); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 6.5e-27) tmp = sqrt((0.1111111111111111 / x)); elseif (x <= 7.2e+71) tmp = y * sqrt((x * 9.0)); else tmp = sqrt(x) * -3.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 6.5e-27], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 7.2e+71], N[(y * N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{-27}:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+71}:\\
\;\;\;\;y \cdot \sqrt{x \cdot 9}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\end{array}
\end{array}
if x < 6.50000000000000025e-27Initial program 99.3%
*-commutative99.3%
associate-*l*99.3%
associate--l+99.3%
distribute-lft-in99.3%
fma-define99.3%
sub-neg99.3%
+-commutative99.3%
distribute-lft-in99.3%
metadata-eval99.3%
metadata-eval99.3%
*-commutative99.3%
associate-/r*99.3%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 78.5%
associate-*r/78.4%
Applied egg-rr78.4%
add-sqr-sqrt78.1%
sqrt-unprod78.4%
frac-times28.6%
swap-sqr28.6%
add-sqr-sqrt28.6%
metadata-eval28.6%
pow228.6%
Applied egg-rr28.6%
unpow228.6%
times-frac78.7%
*-inverses78.7%
*-lft-identity78.7%
Simplified78.7%
if 6.50000000000000025e-27 < x < 7.1999999999999999e71Initial program 99.5%
+-commutative99.5%
associate--l+99.5%
*-commutative99.5%
associate-/r*99.5%
metadata-eval99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
*-commutative99.5%
metadata-eval99.5%
sqrt-prod99.6%
pow1/299.6%
Applied egg-rr99.6%
unpow1/299.6%
Simplified99.6%
Taylor expanded in y around inf 51.9%
if 7.1999999999999999e71 < x Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
associate--l+99.6%
distribute-lft-in99.7%
fma-define99.7%
sub-neg99.7%
+-commutative99.7%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
*-commutative99.7%
associate-/r*99.7%
associate-*r/99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 99.7%
Taylor expanded in y around 0 53.6%
*-commutative53.6%
Simplified53.6%
Final simplification65.1%
(FPCore (x y) :precision binary64 (if (<= x 2.9e-26) (sqrt (/ 0.1111111111111111 x)) (if (<= x 1.16e+73) (* (sqrt x) (* 3.0 y)) (* (sqrt x) -3.0))))
double code(double x, double y) {
double tmp;
if (x <= 2.9e-26) {
tmp = sqrt((0.1111111111111111 / x));
} else if (x <= 1.16e+73) {
tmp = sqrt(x) * (3.0 * y);
} else {
tmp = sqrt(x) * -3.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 2.9d-26) then
tmp = sqrt((0.1111111111111111d0 / x))
else if (x <= 1.16d+73) then
tmp = sqrt(x) * (3.0d0 * y)
else
tmp = sqrt(x) * (-3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 2.9e-26) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else if (x <= 1.16e+73) {
tmp = Math.sqrt(x) * (3.0 * y);
} else {
tmp = Math.sqrt(x) * -3.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 2.9e-26: tmp = math.sqrt((0.1111111111111111 / x)) elif x <= 1.16e+73: tmp = math.sqrt(x) * (3.0 * y) else: tmp = math.sqrt(x) * -3.0 return tmp
function code(x, y) tmp = 0.0 if (x <= 2.9e-26) tmp = sqrt(Float64(0.1111111111111111 / x)); elseif (x <= 1.16e+73) tmp = Float64(sqrt(x) * Float64(3.0 * y)); else tmp = Float64(sqrt(x) * -3.0); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 2.9e-26) tmp = sqrt((0.1111111111111111 / x)); elseif (x <= 1.16e+73) tmp = sqrt(x) * (3.0 * y); else tmp = sqrt(x) * -3.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 2.9e-26], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.16e+73], N[(N[Sqrt[x], $MachinePrecision] * N[(3.0 * y), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.9 \cdot 10^{-26}:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{elif}\;x \leq 1.16 \cdot 10^{+73}:\\
\;\;\;\;\sqrt{x} \cdot \left(3 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\end{array}
\end{array}
if x < 2.8999999999999998e-26Initial program 99.3%
*-commutative99.3%
associate-*l*99.3%
associate--l+99.3%
distribute-lft-in99.3%
fma-define99.3%
sub-neg99.3%
+-commutative99.3%
distribute-lft-in99.3%
metadata-eval99.3%
metadata-eval99.3%
*-commutative99.3%
associate-/r*99.3%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 78.5%
associate-*r/78.4%
Applied egg-rr78.4%
add-sqr-sqrt78.1%
sqrt-unprod78.4%
frac-times28.6%
swap-sqr28.6%
add-sqr-sqrt28.6%
metadata-eval28.6%
pow228.6%
Applied egg-rr28.6%
unpow228.6%
times-frac78.7%
*-inverses78.7%
*-lft-identity78.7%
Simplified78.7%
if 2.8999999999999998e-26 < x < 1.16000000000000007e73Initial program 99.5%
*-commutative99.5%
associate-*l*99.3%
associate--l+99.3%
distribute-lft-in99.3%
fma-define99.3%
sub-neg99.3%
+-commutative99.3%
distribute-lft-in99.3%
metadata-eval99.3%
metadata-eval99.3%
*-commutative99.3%
associate-/r*99.3%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around inf 51.8%
*-commutative51.8%
associate-*l*51.8%
*-commutative51.8%
Simplified51.8%
if 1.16000000000000007e73 < x Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
associate--l+99.6%
distribute-lft-in99.7%
fma-define99.7%
sub-neg99.7%
+-commutative99.7%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
*-commutative99.7%
associate-/r*99.7%
associate-*r/99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 99.7%
Taylor expanded in y around 0 53.6%
*-commutative53.6%
Simplified53.6%
(FPCore (x y) :precision binary64 (if (<= x 5.9e-27) (sqrt (/ 0.1111111111111111 x)) (if (<= x 1.12e+72) (* 3.0 (* (sqrt x) y)) (* (sqrt x) -3.0))))
double code(double x, double y) {
double tmp;
if (x <= 5.9e-27) {
tmp = sqrt((0.1111111111111111 / x));
} else if (x <= 1.12e+72) {
tmp = 3.0 * (sqrt(x) * y);
} else {
tmp = sqrt(x) * -3.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 5.9d-27) then
tmp = sqrt((0.1111111111111111d0 / x))
else if (x <= 1.12d+72) then
tmp = 3.0d0 * (sqrt(x) * y)
else
tmp = sqrt(x) * (-3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 5.9e-27) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else if (x <= 1.12e+72) {
tmp = 3.0 * (Math.sqrt(x) * y);
} else {
tmp = Math.sqrt(x) * -3.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 5.9e-27: tmp = math.sqrt((0.1111111111111111 / x)) elif x <= 1.12e+72: tmp = 3.0 * (math.sqrt(x) * y) else: tmp = math.sqrt(x) * -3.0 return tmp
function code(x, y) tmp = 0.0 if (x <= 5.9e-27) tmp = sqrt(Float64(0.1111111111111111 / x)); elseif (x <= 1.12e+72) tmp = Float64(3.0 * Float64(sqrt(x) * y)); else tmp = Float64(sqrt(x) * -3.0); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 5.9e-27) tmp = sqrt((0.1111111111111111 / x)); elseif (x <= 1.12e+72) tmp = 3.0 * (sqrt(x) * y); else tmp = sqrt(x) * -3.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 5.9e-27], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.12e+72], N[(3.0 * N[(N[Sqrt[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.9 \cdot 10^{-27}:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{+72}:\\
\;\;\;\;3 \cdot \left(\sqrt{x} \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\end{array}
\end{array}
if x < 5.8999999999999998e-27Initial program 99.3%
*-commutative99.3%
associate-*l*99.3%
associate--l+99.3%
distribute-lft-in99.3%
fma-define99.3%
sub-neg99.3%
+-commutative99.3%
distribute-lft-in99.3%
metadata-eval99.3%
metadata-eval99.3%
*-commutative99.3%
associate-/r*99.3%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 78.5%
associate-*r/78.4%
Applied egg-rr78.4%
add-sqr-sqrt78.1%
sqrt-unprod78.4%
frac-times28.6%
swap-sqr28.6%
add-sqr-sqrt28.6%
metadata-eval28.6%
pow228.6%
Applied egg-rr28.6%
unpow228.6%
times-frac78.7%
*-inverses78.7%
*-lft-identity78.7%
Simplified78.7%
if 5.8999999999999998e-27 < x < 1.12000000000000001e72Initial program 99.5%
*-commutative99.5%
associate-*l*99.3%
associate--l+99.3%
distribute-lft-in99.3%
fma-define99.3%
sub-neg99.3%
+-commutative99.3%
distribute-lft-in99.3%
metadata-eval99.3%
metadata-eval99.3%
*-commutative99.3%
associate-/r*99.3%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around inf 51.8%
if 1.12000000000000001e72 < x Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
associate--l+99.6%
distribute-lft-in99.7%
fma-define99.7%
sub-neg99.7%
+-commutative99.7%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
*-commutative99.7%
associate-/r*99.7%
associate-*r/99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 99.7%
Taylor expanded in y around 0 53.6%
*-commutative53.6%
Simplified53.6%
(FPCore (x y) :precision binary64 (if (<= x 3900000000000.0) (* (sqrt x) (- -3.0 (/ -0.3333333333333333 x))) (* (* 3.0 (sqrt x)) (+ y -1.0))))
double code(double x, double y) {
double tmp;
if (x <= 3900000000000.0) {
tmp = sqrt(x) * (-3.0 - (-0.3333333333333333 / x));
} else {
tmp = (3.0 * sqrt(x)) * (y + -1.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 3900000000000.0d0) then
tmp = sqrt(x) * ((-3.0d0) - ((-0.3333333333333333d0) / x))
else
tmp = (3.0d0 * sqrt(x)) * (y + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 3900000000000.0) {
tmp = Math.sqrt(x) * (-3.0 - (-0.3333333333333333 / x));
} else {
tmp = (3.0 * Math.sqrt(x)) * (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 3900000000000.0: tmp = math.sqrt(x) * (-3.0 - (-0.3333333333333333 / x)) else: tmp = (3.0 * math.sqrt(x)) * (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= 3900000000000.0) tmp = Float64(sqrt(x) * Float64(-3.0 - Float64(-0.3333333333333333 / x))); else tmp = Float64(Float64(3.0 * sqrt(x)) * Float64(y + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 3900000000000.0) tmp = sqrt(x) * (-3.0 - (-0.3333333333333333 / x)); else tmp = (3.0 * sqrt(x)) * (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 3900000000000.0], N[(N[Sqrt[x], $MachinePrecision] * N[(-3.0 - N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3900000000000:\\
\;\;\;\;\sqrt{x} \cdot \left(-3 - \frac{-0.3333333333333333}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3 \cdot \sqrt{x}\right) \cdot \left(y + -1\right)\\
\end{array}
\end{array}
if x < 3.9e12Initial program 99.3%
*-commutative99.3%
associate-*l*99.3%
associate--l+99.3%
distribute-lft-in99.3%
fma-define99.3%
sub-neg99.3%
+-commutative99.3%
distribute-lft-in99.3%
metadata-eval99.3%
metadata-eval99.3%
*-commutative99.3%
associate-/r*99.3%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around 0 75.9%
sub-neg75.9%
metadata-eval75.9%
associate-*r/76.0%
metadata-eval76.0%
+-commutative76.0%
metadata-eval76.0%
distribute-neg-frac76.0%
unsub-neg76.0%
Simplified76.0%
if 3.9e12 < x Initial program 99.6%
+-commutative99.6%
associate--l+99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 99.6%
Final simplification86.6%
(FPCore (x y) :precision binary64 (if (<= x 3900000000000.0) (* (sqrt x) (- -3.0 (/ -0.3333333333333333 x))) (* (sqrt x) (- (* 3.0 y) 3.0))))
double code(double x, double y) {
double tmp;
if (x <= 3900000000000.0) {
tmp = sqrt(x) * (-3.0 - (-0.3333333333333333 / x));
} else {
tmp = sqrt(x) * ((3.0 * y) - 3.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 3900000000000.0d0) then
tmp = sqrt(x) * ((-3.0d0) - ((-0.3333333333333333d0) / x))
else
tmp = sqrt(x) * ((3.0d0 * y) - 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 3900000000000.0) {
tmp = Math.sqrt(x) * (-3.0 - (-0.3333333333333333 / x));
} else {
tmp = Math.sqrt(x) * ((3.0 * y) - 3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 3900000000000.0: tmp = math.sqrt(x) * (-3.0 - (-0.3333333333333333 / x)) else: tmp = math.sqrt(x) * ((3.0 * y) - 3.0) return tmp
function code(x, y) tmp = 0.0 if (x <= 3900000000000.0) tmp = Float64(sqrt(x) * Float64(-3.0 - Float64(-0.3333333333333333 / x))); else tmp = Float64(sqrt(x) * Float64(Float64(3.0 * y) - 3.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 3900000000000.0) tmp = sqrt(x) * (-3.0 - (-0.3333333333333333 / x)); else tmp = sqrt(x) * ((3.0 * y) - 3.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 3900000000000.0], N[(N[Sqrt[x], $MachinePrecision] * N[(-3.0 - N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(N[(3.0 * y), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3900000000000:\\
\;\;\;\;\sqrt{x} \cdot \left(-3 - \frac{-0.3333333333333333}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(3 \cdot y - 3\right)\\
\end{array}
\end{array}
if x < 3.9e12Initial program 99.3%
*-commutative99.3%
associate-*l*99.3%
associate--l+99.3%
distribute-lft-in99.3%
fma-define99.3%
sub-neg99.3%
+-commutative99.3%
distribute-lft-in99.3%
metadata-eval99.3%
metadata-eval99.3%
*-commutative99.3%
associate-/r*99.3%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around 0 75.9%
sub-neg75.9%
metadata-eval75.9%
associate-*r/76.0%
metadata-eval76.0%
+-commutative76.0%
metadata-eval76.0%
distribute-neg-frac76.0%
unsub-neg76.0%
Simplified76.0%
if 3.9e12 < x Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
associate--l+99.6%
distribute-lft-in99.6%
fma-define99.6%
sub-neg99.6%
+-commutative99.6%
distribute-lft-in99.6%
metadata-eval99.6%
metadata-eval99.6%
*-commutative99.6%
associate-/r*99.6%
associate-*r/99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 99.6%
(FPCore (x y) :precision binary64 (* (sqrt x) (+ -3.0 (+ (/ 0.3333333333333333 x) (* 3.0 y)))))
double code(double x, double y) {
return sqrt(x) * (-3.0 + ((0.3333333333333333 / x) + (3.0 * y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt(x) * ((-3.0d0) + ((0.3333333333333333d0 / x) + (3.0d0 * y)))
end function
public static double code(double x, double y) {
return Math.sqrt(x) * (-3.0 + ((0.3333333333333333 / x) + (3.0 * y)));
}
def code(x, y): return math.sqrt(x) * (-3.0 + ((0.3333333333333333 / x) + (3.0 * y)))
function code(x, y) return Float64(sqrt(x) * Float64(-3.0 + Float64(Float64(0.3333333333333333 / x) + Float64(3.0 * y)))) end
function tmp = code(x, y) tmp = sqrt(x) * (-3.0 + ((0.3333333333333333 / x) + (3.0 * y))); end
code[x_, y_] := N[(N[Sqrt[x], $MachinePrecision] * N[(-3.0 + N[(N[(0.3333333333333333 / x), $MachinePrecision] + N[(3.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x} \cdot \left(-3 + \left(\frac{0.3333333333333333}{x} + 3 \cdot y\right)\right)
\end{array}
Initial program 99.4%
*-commutative99.4%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-define99.4%
sub-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.4%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
fma-undefine99.5%
+-commutative99.5%
associate-+r+99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x y) :precision binary64 (if (<= x 0.11) (sqrt (/ 0.1111111111111111 x)) (* (sqrt x) -3.0)))
double code(double x, double y) {
double tmp;
if (x <= 0.11) {
tmp = sqrt((0.1111111111111111 / x));
} else {
tmp = sqrt(x) * -3.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 0.11d0) then
tmp = sqrt((0.1111111111111111d0 / x))
else
tmp = sqrt(x) * (-3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 0.11) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else {
tmp = Math.sqrt(x) * -3.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.11: tmp = math.sqrt((0.1111111111111111 / x)) else: tmp = math.sqrt(x) * -3.0 return tmp
function code(x, y) tmp = 0.0 if (x <= 0.11) tmp = sqrt(Float64(0.1111111111111111 / x)); else tmp = Float64(sqrt(x) * -3.0); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 0.11) tmp = sqrt((0.1111111111111111 / x)); else tmp = sqrt(x) * -3.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.11], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.11:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\end{array}
\end{array}
if x < 0.110000000000000001Initial program 99.3%
*-commutative99.3%
associate-*l*99.3%
associate--l+99.3%
distribute-lft-in99.3%
fma-define99.3%
sub-neg99.3%
+-commutative99.3%
distribute-lft-in99.3%
metadata-eval99.3%
metadata-eval99.3%
*-commutative99.3%
associate-/r*99.3%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 72.5%
associate-*r/72.4%
Applied egg-rr72.4%
add-sqr-sqrt72.1%
sqrt-unprod72.4%
frac-times27.8%
swap-sqr27.8%
add-sqr-sqrt27.8%
metadata-eval27.8%
pow227.8%
Applied egg-rr27.8%
unpow227.8%
times-frac72.7%
*-inverses72.7%
*-lft-identity72.7%
Simplified72.7%
if 0.110000000000000001 < x Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
associate--l+99.6%
distribute-lft-in99.6%
fma-define99.6%
sub-neg99.6%
+-commutative99.6%
distribute-lft-in99.6%
metadata-eval99.6%
metadata-eval99.6%
*-commutative99.6%
associate-/r*99.6%
associate-*r/99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 97.3%
Taylor expanded in y around 0 50.8%
*-commutative50.8%
Simplified50.8%
(FPCore (x y) :precision binary64 (sqrt (/ 0.1111111111111111 x)))
double code(double x, double y) {
return sqrt((0.1111111111111111 / x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt((0.1111111111111111d0 / x))
end function
public static double code(double x, double y) {
return Math.sqrt((0.1111111111111111 / x));
}
def code(x, y): return math.sqrt((0.1111111111111111 / x))
function code(x, y) return sqrt(Float64(0.1111111111111111 / x)) end
function tmp = code(x, y) tmp = sqrt((0.1111111111111111 / x)); end
code[x_, y_] := N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{0.1111111111111111}{x}}
\end{array}
Initial program 99.4%
*-commutative99.4%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-define99.4%
sub-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.4%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 38.9%
associate-*r/38.8%
Applied egg-rr38.8%
add-sqr-sqrt38.7%
sqrt-unprod38.8%
frac-times15.5%
swap-sqr15.5%
add-sqr-sqrt15.5%
metadata-eval15.5%
pow215.5%
Applied egg-rr15.5%
unpow215.5%
times-frac38.9%
*-inverses38.9%
*-lft-identity38.9%
Simplified38.9%
(FPCore (x y) :precision binary64 (sqrt (* x 9.0)))
double code(double x, double y) {
return sqrt((x * 9.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt((x * 9.0d0))
end function
public static double code(double x, double y) {
return Math.sqrt((x * 9.0));
}
def code(x, y): return math.sqrt((x * 9.0))
function code(x, y) return sqrt(Float64(x * 9.0)) end
function tmp = code(x, y) tmp = sqrt((x * 9.0)); end
code[x_, y_] := N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x \cdot 9}
\end{array}
Initial program 99.4%
*-commutative99.4%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-define99.4%
sub-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.4%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 59.5%
Taylor expanded in y around 0 25.2%
*-commutative25.2%
Simplified25.2%
pow125.2%
add-sqr-sqrt0.0%
sqrt-unprod3.3%
swap-sqr3.3%
add-sqr-sqrt3.3%
metadata-eval3.3%
Applied egg-rr3.3%
unpow13.3%
Simplified3.3%
(FPCore (x y) :precision binary64 (* 3.0 (+ (* y (sqrt x)) (* (- (/ 1.0 (* x 9.0)) 1.0) (sqrt x)))))
double code(double x, double y) {
return 3.0 * ((y * sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * sqrt(x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 3.0d0 * ((y * sqrt(x)) + (((1.0d0 / (x * 9.0d0)) - 1.0d0) * sqrt(x)))
end function
public static double code(double x, double y) {
return 3.0 * ((y * Math.sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * Math.sqrt(x)));
}
def code(x, y): return 3.0 * ((y * math.sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * math.sqrt(x)))
function code(x, y) return Float64(3.0 * Float64(Float64(y * sqrt(x)) + Float64(Float64(Float64(1.0 / Float64(x * 9.0)) - 1.0) * sqrt(x)))) end
function tmp = code(x, y) tmp = 3.0 * ((y * sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * sqrt(x))); end
code[x_, y_] := N[(3.0 * N[(N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
3 \cdot \left(y \cdot \sqrt{x} + \left(\frac{1}{x \cdot 9} - 1\right) \cdot \sqrt{x}\right)
\end{array}
herbie shell --seed 2024170
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:alt
(! :herbie-platform default (* 3 (+ (* y (sqrt x)) (* (- (/ 1 (* x 9)) 1) (sqrt x)))))
(* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))