
(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 6 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 (* (sqrt x) (+ (+ (/ 0.3333333333333333 x) -3.0) (* 3.0 y))))
double code(double x, double y) {
return sqrt(x) * (((0.3333333333333333 / x) + -3.0) + (3.0 * y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt(x) * (((0.3333333333333333d0 / x) + (-3.0d0)) + (3.0d0 * y))
end function
public static double code(double x, double y) {
return Math.sqrt(x) * (((0.3333333333333333 / x) + -3.0) + (3.0 * y));
}
def code(x, y): return math.sqrt(x) * (((0.3333333333333333 / x) + -3.0) + (3.0 * y))
function code(x, y) return Float64(sqrt(x) * Float64(Float64(Float64(0.3333333333333333 / x) + -3.0) + Float64(3.0 * y))) end
function tmp = code(x, y) tmp = sqrt(x) * (((0.3333333333333333 / x) + -3.0) + (3.0 * y)); end
code[x_, y_] := N[(N[Sqrt[x], $MachinePrecision] * N[(N[(N[(0.3333333333333333 / x), $MachinePrecision] + -3.0), $MachinePrecision] + N[(3.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x} \cdot \left(\left(\frac{0.3333333333333333}{x} + -3\right) + 3 \cdot y\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.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
fma-undefine99.5%
+-commutative99.5%
+-commutative99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 3.0 (* (sqrt x) y))))
(if (<= y -1.12e+24)
t_0
(if (<= y -8.8e-96)
(sqrt (/ 0.1111111111111111 x))
(if (<= y 1.76e-68)
(* (sqrt x) -3.0)
(if (<= y 9.8e+27) (pow (* x 9.0) -0.5) t_0))))))
double code(double x, double y) {
double t_0 = 3.0 * (sqrt(x) * y);
double tmp;
if (y <= -1.12e+24) {
tmp = t_0;
} else if (y <= -8.8e-96) {
tmp = sqrt((0.1111111111111111 / x));
} else if (y <= 1.76e-68) {
tmp = sqrt(x) * -3.0;
} else if (y <= 9.8e+27) {
tmp = pow((x * 9.0), -0.5);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 3.0d0 * (sqrt(x) * y)
if (y <= (-1.12d+24)) then
tmp = t_0
else if (y <= (-8.8d-96)) then
tmp = sqrt((0.1111111111111111d0 / x))
else if (y <= 1.76d-68) then
tmp = sqrt(x) * (-3.0d0)
else if (y <= 9.8d+27) then
tmp = (x * 9.0d0) ** (-0.5d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 3.0 * (Math.sqrt(x) * y);
double tmp;
if (y <= -1.12e+24) {
tmp = t_0;
} else if (y <= -8.8e-96) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else if (y <= 1.76e-68) {
tmp = Math.sqrt(x) * -3.0;
} else if (y <= 9.8e+27) {
tmp = Math.pow((x * 9.0), -0.5);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 3.0 * (math.sqrt(x) * y) tmp = 0 if y <= -1.12e+24: tmp = t_0 elif y <= -8.8e-96: tmp = math.sqrt((0.1111111111111111 / x)) elif y <= 1.76e-68: tmp = math.sqrt(x) * -3.0 elif y <= 9.8e+27: tmp = math.pow((x * 9.0), -0.5) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(3.0 * Float64(sqrt(x) * y)) tmp = 0.0 if (y <= -1.12e+24) tmp = t_0; elseif (y <= -8.8e-96) tmp = sqrt(Float64(0.1111111111111111 / x)); elseif (y <= 1.76e-68) tmp = Float64(sqrt(x) * -3.0); elseif (y <= 9.8e+27) tmp = Float64(x * 9.0) ^ -0.5; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 3.0 * (sqrt(x) * y); tmp = 0.0; if (y <= -1.12e+24) tmp = t_0; elseif (y <= -8.8e-96) tmp = sqrt((0.1111111111111111 / x)); elseif (y <= 1.76e-68) tmp = sqrt(x) * -3.0; elseif (y <= 9.8e+27) tmp = (x * 9.0) ^ -0.5; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(3.0 * N[(N[Sqrt[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.12e+24], t$95$0, If[LessEqual[y, -8.8e-96], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 1.76e-68], N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision], If[LessEqual[y, 9.8e+27], N[Power[N[(x * 9.0), $MachinePrecision], -0.5], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 3 \cdot \left(\sqrt{x} \cdot y\right)\\
\mathbf{if}\;y \leq -1.12 \cdot 10^{+24}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -8.8 \cdot 10^{-96}:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{elif}\;y \leq 1.76 \cdot 10^{-68}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{+27}:\\
\;\;\;\;{\left(x \cdot 9\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.12e24 or 9.8000000000000003e27 < y Initial program 99.5%
*-commutative99.5%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.5%
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.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around inf 80.8%
if -1.12e24 < y < -8.79999999999999918e-96Initial program 99.3%
*-commutative99.3%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.5%
fma-define99.5%
sub-neg99.5%
+-commutative99.5%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.3%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 62.0%
metadata-eval62.0%
sqrt-prod62.4%
div-inv62.4%
pow1/262.4%
Applied egg-rr62.4%
unpow1/262.4%
Simplified62.4%
if -8.79999999999999918e-96 < y < 1.76e-68Initial 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.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around inf 61.3%
Taylor expanded in y around 0 61.3%
*-commutative61.3%
Simplified61.3%
if 1.76e-68 < y < 9.8000000000000003e27Initial program 99.2%
*-commutative99.2%
associate-*l*99.4%
associate--l+99.4%
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 73.0%
metadata-eval73.0%
sqrt-prod73.1%
div-inv73.2%
pow1/273.2%
Applied egg-rr73.2%
unpow1/273.2%
Simplified73.2%
clear-num73.4%
sqrt-div73.2%
metadata-eval73.2%
inv-pow73.2%
sqrt-pow273.4%
div-inv73.5%
metadata-eval73.5%
metadata-eval73.5%
Applied egg-rr73.5%
Final simplification71.3%
(FPCore (x y) :precision binary64 (if (or (<= y -5.6e+26) (not (<= y 1.32e+22))) (* 3.0 (* (sqrt x) y)) (* (sqrt x) (+ (/ 0.3333333333333333 x) -3.0))))
double code(double x, double y) {
double tmp;
if ((y <= -5.6e+26) || !(y <= 1.32e+22)) {
tmp = 3.0 * (sqrt(x) * y);
} else {
tmp = sqrt(x) * ((0.3333333333333333 / 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 ((y <= (-5.6d+26)) .or. (.not. (y <= 1.32d+22))) then
tmp = 3.0d0 * (sqrt(x) * y)
else
tmp = sqrt(x) * ((0.3333333333333333d0 / x) + (-3.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -5.6e+26) || !(y <= 1.32e+22)) {
tmp = 3.0 * (Math.sqrt(x) * y);
} else {
tmp = Math.sqrt(x) * ((0.3333333333333333 / x) + -3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -5.6e+26) or not (y <= 1.32e+22): tmp = 3.0 * (math.sqrt(x) * y) else: tmp = math.sqrt(x) * ((0.3333333333333333 / x) + -3.0) return tmp
function code(x, y) tmp = 0.0 if ((y <= -5.6e+26) || !(y <= 1.32e+22)) tmp = Float64(3.0 * Float64(sqrt(x) * y)); else tmp = Float64(sqrt(x) * Float64(Float64(0.3333333333333333 / x) + -3.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -5.6e+26) || ~((y <= 1.32e+22))) tmp = 3.0 * (sqrt(x) * y); else tmp = sqrt(x) * ((0.3333333333333333 / x) + -3.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -5.6e+26], N[Not[LessEqual[y, 1.32e+22]], $MachinePrecision]], N[(3.0 * N[(N[Sqrt[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(N[(0.3333333333333333 / x), $MachinePrecision] + -3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.6 \cdot 10^{+26} \lor \neg \left(y \leq 1.32 \cdot 10^{+22}\right):\\
\;\;\;\;3 \cdot \left(\sqrt{x} \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(\frac{0.3333333333333333}{x} + -3\right)\\
\end{array}
\end{array}
if y < -5.59999999999999999e26 or 1.32e22 < y Initial program 99.5%
*-commutative99.5%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.5%
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.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around inf 80.3%
if -5.59999999999999999e26 < y < 1.32e22Initial 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.3%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around 0 96.7%
sub-neg96.7%
metadata-eval96.7%
associate-*r/96.7%
metadata-eval96.7%
+-commutative96.7%
Simplified96.7%
Final simplification89.2%
(FPCore (x y) :precision binary64 (if (<= x 9.5) (pow (* x 9.0) -0.5) (* (sqrt x) -3.0)))
double code(double x, double y) {
double tmp;
if (x <= 9.5) {
tmp = pow((x * 9.0), -0.5);
} 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 <= 9.5d0) then
tmp = (x * 9.0d0) ** (-0.5d0)
else
tmp = sqrt(x) * (-3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 9.5) {
tmp = Math.pow((x * 9.0), -0.5);
} else {
tmp = Math.sqrt(x) * -3.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 9.5: tmp = math.pow((x * 9.0), -0.5) else: tmp = math.sqrt(x) * -3.0 return tmp
function code(x, y) tmp = 0.0 if (x <= 9.5) tmp = Float64(x * 9.0) ^ -0.5; else tmp = Float64(sqrt(x) * -3.0); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 9.5) tmp = (x * 9.0) ^ -0.5; else tmp = sqrt(x) * -3.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 9.5], N[Power[N[(x * 9.0), $MachinePrecision], -0.5], $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.5:\\
\;\;\;\;{\left(x \cdot 9\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\end{array}
\end{array}
if x < 9.5Initial 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.2%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 66.7%
metadata-eval66.7%
sqrt-prod66.8%
div-inv66.9%
pow1/266.9%
Applied egg-rr66.9%
unpow1/266.9%
Simplified66.9%
clear-num66.9%
sqrt-div66.8%
metadata-eval66.8%
inv-pow66.8%
sqrt-pow266.9%
div-inv67.0%
metadata-eval67.0%
metadata-eval67.0%
Applied egg-rr67.0%
if 9.5 < x 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.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 99.3%
Taylor expanded in y around 0 53.5%
*-commutative53.5%
Simplified53.5%
Final simplification60.3%
(FPCore (x y) :precision binary64 (if (<= x 9.5) (sqrt (/ 0.1111111111111111 x)) (* (sqrt x) -3.0)))
double code(double x, double y) {
double tmp;
if (x <= 9.5) {
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 <= 9.5d0) 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 <= 9.5) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else {
tmp = Math.sqrt(x) * -3.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 9.5: tmp = math.sqrt((0.1111111111111111 / x)) else: tmp = math.sqrt(x) * -3.0 return tmp
function code(x, y) tmp = 0.0 if (x <= 9.5) 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 <= 9.5) tmp = sqrt((0.1111111111111111 / x)); else tmp = sqrt(x) * -3.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 9.5], 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 9.5:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\end{array}
\end{array}
if x < 9.5Initial 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.2%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 66.7%
metadata-eval66.7%
sqrt-prod66.8%
div-inv66.9%
pow1/266.9%
Applied egg-rr66.9%
unpow1/266.9%
Simplified66.9%
if 9.5 < x 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.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 99.3%
Taylor expanded in y around 0 53.5%
*-commutative53.5%
Simplified53.5%
Final simplification60.3%
(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.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 34.6%
metadata-eval34.6%
sqrt-prod34.6%
div-inv34.7%
pow1/234.7%
Applied egg-rr34.7%
unpow1/234.7%
Simplified34.7%
Final simplification34.7%
(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 2024115
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:alt
(* 3.0 (+ (* y (sqrt x)) (* (- (/ 1.0 (* x 9.0)) 1.0) (sqrt x))))
(* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))