
(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 12 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 9.0)) (+ (+ y (/ 1.0 (* x 9.0))) -1.0)))
double code(double x, double y) {
return sqrt((x * 9.0)) * ((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 = sqrt((x * 9.0d0)) * ((y + (1.0d0 / (x * 9.0d0))) + (-1.0d0))
end function
public static double code(double x, double y) {
return Math.sqrt((x * 9.0)) * ((y + (1.0 / (x * 9.0))) + -1.0);
}
def code(x, y): return math.sqrt((x * 9.0)) * ((y + (1.0 / (x * 9.0))) + -1.0)
function code(x, y) return Float64(sqrt(Float64(x * 9.0)) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) + -1.0)) end
function tmp = code(x, y) tmp = sqrt((x * 9.0)) * ((y + (1.0 / (x * 9.0))) + -1.0); end
code[x_, y_] := N[(N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x \cdot 9} \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) + -1\right)
\end{array}
Initial program 99.4%
expm1-log1p-u96.6%
expm1-udef49.8%
*-commutative49.8%
metadata-eval49.8%
sqrt-prod49.8%
Applied egg-rr49.8%
expm1-def96.7%
expm1-log1p99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 3.0 (* y (sqrt x)))))
(if (<= y -2e+87)
t_0
(if (<= y -1.3e-40)
(sqrt (+ (/ 0.1111111111111111 x) -2.0))
(if (<= y 5e-281)
(* (sqrt x) -3.0)
(if (<= y 7.6e+69) (sqrt (/ 0.1111111111111111 x)) t_0))))))
double code(double x, double y) {
double t_0 = 3.0 * (y * sqrt(x));
double tmp;
if (y <= -2e+87) {
tmp = t_0;
} else if (y <= -1.3e-40) {
tmp = sqrt(((0.1111111111111111 / x) + -2.0));
} else if (y <= 5e-281) {
tmp = sqrt(x) * -3.0;
} else if (y <= 7.6e+69) {
tmp = sqrt((0.1111111111111111 / x));
} 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 * (y * sqrt(x))
if (y <= (-2d+87)) then
tmp = t_0
else if (y <= (-1.3d-40)) then
tmp = sqrt(((0.1111111111111111d0 / x) + (-2.0d0)))
else if (y <= 5d-281) then
tmp = sqrt(x) * (-3.0d0)
else if (y <= 7.6d+69) then
tmp = sqrt((0.1111111111111111d0 / x))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 3.0 * (y * Math.sqrt(x));
double tmp;
if (y <= -2e+87) {
tmp = t_0;
} else if (y <= -1.3e-40) {
tmp = Math.sqrt(((0.1111111111111111 / x) + -2.0));
} else if (y <= 5e-281) {
tmp = Math.sqrt(x) * -3.0;
} else if (y <= 7.6e+69) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 3.0 * (y * math.sqrt(x)) tmp = 0 if y <= -2e+87: tmp = t_0 elif y <= -1.3e-40: tmp = math.sqrt(((0.1111111111111111 / x) + -2.0)) elif y <= 5e-281: tmp = math.sqrt(x) * -3.0 elif y <= 7.6e+69: tmp = math.sqrt((0.1111111111111111 / x)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(3.0 * Float64(y * sqrt(x))) tmp = 0.0 if (y <= -2e+87) tmp = t_0; elseif (y <= -1.3e-40) tmp = sqrt(Float64(Float64(0.1111111111111111 / x) + -2.0)); elseif (y <= 5e-281) tmp = Float64(sqrt(x) * -3.0); elseif (y <= 7.6e+69) tmp = sqrt(Float64(0.1111111111111111 / x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 3.0 * (y * sqrt(x)); tmp = 0.0; if (y <= -2e+87) tmp = t_0; elseif (y <= -1.3e-40) tmp = sqrt(((0.1111111111111111 / x) + -2.0)); elseif (y <= 5e-281) tmp = sqrt(x) * -3.0; elseif (y <= 7.6e+69) tmp = sqrt((0.1111111111111111 / x)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(3.0 * N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2e+87], t$95$0, If[LessEqual[y, -1.3e-40], N[Sqrt[N[(N[(0.1111111111111111 / x), $MachinePrecision] + -2.0), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 5e-281], N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision], If[LessEqual[y, 7.6e+69], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 3 \cdot \left(y \cdot \sqrt{x}\right)\\
\mathbf{if}\;y \leq -2 \cdot 10^{+87}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -1.3 \cdot 10^{-40}:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x} + -2}\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-281}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{+69}:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.9999999999999999e87 or 7.60000000000000055e69 < y Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
associate--l+99.7%
distribute-lft-in99.6%
fma-def99.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 y around inf 83.5%
if -1.9999999999999999e87 < y < -1.3000000000000001e-40Initial program 99.4%
*-commutative99.4%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.5%
fma-def99.5%
sub-neg99.5%
+-commutative99.5%
distribute-lft-in99.5%
metadata-eval99.5%
metadata-eval99.5%
*-commutative99.5%
associate-/r*99.2%
associate-*r/99.3%
metadata-eval99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around 0 82.8%
sub-neg82.8%
associate-*r/82.7%
metadata-eval82.7%
metadata-eval82.7%
Simplified82.7%
add-sqr-sqrt74.0%
sqrt-unprod74.4%
swap-sqr38.0%
add-sqr-sqrt38.0%
pow238.0%
Applied egg-rr38.0%
Taylor expanded in x around 0 74.6%
sub-neg74.6%
associate-*r/74.6%
metadata-eval74.6%
metadata-eval74.6%
Simplified74.6%
if -1.3000000000000001e-40 < y < 4.9999999999999998e-281Initial program 99.3%
*-commutative99.3%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-def99.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.3%
metadata-eval99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around inf 65.4%
Taylor expanded in y around 0 65.4%
*-commutative65.4%
Simplified65.4%
if 4.9999999999999998e-281 < y < 7.60000000000000055e69Initial program 99.3%
*-commutative99.3%
associate-*l*99.5%
associate--l+99.5%
distribute-lft-in99.5%
fma-def99.5%
sub-neg99.5%
+-commutative99.5%
distribute-lft-in99.5%
metadata-eval99.5%
metadata-eval99.5%
*-commutative99.5%
associate-/r*99.4%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 58.2%
add-sqr-sqrt57.8%
sqrt-unprod58.2%
swap-sqr24.3%
add-sqr-sqrt24.2%
frac-times24.3%
metadata-eval24.3%
pow224.3%
Applied egg-rr24.3%
associate-*r/25.6%
unpow225.6%
times-frac58.2%
*-inverses58.2%
*-lft-identity58.2%
Simplified58.2%
Final simplification71.0%
(FPCore (x y) :precision binary64 (if (or (<= y -2e+87) (not (<= y 2e+73))) (* 3.0 (* y (sqrt x))) (* (sqrt (* x 9.0)) (+ (/ 0.1111111111111111 x) -1.0))))
double code(double x, double y) {
double tmp;
if ((y <= -2e+87) || !(y <= 2e+73)) {
tmp = 3.0 * (y * sqrt(x));
} else {
tmp = sqrt((x * 9.0)) * ((0.1111111111111111 / x) + -1.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-2d+87)) .or. (.not. (y <= 2d+73))) then
tmp = 3.0d0 * (y * sqrt(x))
else
tmp = sqrt((x * 9.0d0)) * ((0.1111111111111111d0 / x) + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -2e+87) || !(y <= 2e+73)) {
tmp = 3.0 * (y * Math.sqrt(x));
} else {
tmp = Math.sqrt((x * 9.0)) * ((0.1111111111111111 / x) + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -2e+87) or not (y <= 2e+73): tmp = 3.0 * (y * math.sqrt(x)) else: tmp = math.sqrt((x * 9.0)) * ((0.1111111111111111 / x) + -1.0) return tmp
function code(x, y) tmp = 0.0 if ((y <= -2e+87) || !(y <= 2e+73)) tmp = Float64(3.0 * Float64(y * sqrt(x))); else tmp = Float64(sqrt(Float64(x * 9.0)) * Float64(Float64(0.1111111111111111 / x) + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -2e+87) || ~((y <= 2e+73))) tmp = 3.0 * (y * sqrt(x)); else tmp = sqrt((x * 9.0)) * ((0.1111111111111111 / x) + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -2e+87], N[Not[LessEqual[y, 2e+73]], $MachinePrecision]], N[(3.0 * N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision] * N[(N[(0.1111111111111111 / x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+87} \lor \neg \left(y \leq 2 \cdot 10^{+73}\right):\\
\;\;\;\;3 \cdot \left(y \cdot \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x \cdot 9} \cdot \left(\frac{0.1111111111111111}{x} + -1\right)\\
\end{array}
\end{array}
if y < -1.9999999999999999e87 or 1.99999999999999997e73 < y Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
associate--l+99.7%
distribute-lft-in99.6%
fma-def99.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 y around inf 83.5%
if -1.9999999999999999e87 < y < 1.99999999999999997e73Initial program 99.3%
expm1-log1p-u96.0%
expm1-udef47.7%
*-commutative47.7%
metadata-eval47.7%
sqrt-prod47.7%
Applied egg-rr47.7%
expm1-def96.1%
expm1-log1p99.6%
Simplified99.6%
Taylor expanded in x around 0 99.5%
Taylor expanded in y around 0 94.1%
Final simplification90.2%
(FPCore (x y) :precision binary64 (if (or (<= y -7.4e+87) (not (<= y 4.3e+70))) (* 3.0 (* y (sqrt x))) (/ (+ (/ 0.3333333333333333 x) -3.0) (pow x -0.5))))
double code(double x, double y) {
double tmp;
if ((y <= -7.4e+87) || !(y <= 4.3e+70)) {
tmp = 3.0 * (y * sqrt(x));
} else {
tmp = ((0.3333333333333333 / x) + -3.0) / pow(x, -0.5);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-7.4d+87)) .or. (.not. (y <= 4.3d+70))) then
tmp = 3.0d0 * (y * sqrt(x))
else
tmp = ((0.3333333333333333d0 / x) + (-3.0d0)) / (x ** (-0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -7.4e+87) || !(y <= 4.3e+70)) {
tmp = 3.0 * (y * Math.sqrt(x));
} else {
tmp = ((0.3333333333333333 / x) + -3.0) / Math.pow(x, -0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -7.4e+87) or not (y <= 4.3e+70): tmp = 3.0 * (y * math.sqrt(x)) else: tmp = ((0.3333333333333333 / x) + -3.0) / math.pow(x, -0.5) return tmp
function code(x, y) tmp = 0.0 if ((y <= -7.4e+87) || !(y <= 4.3e+70)) tmp = Float64(3.0 * Float64(y * sqrt(x))); else tmp = Float64(Float64(Float64(0.3333333333333333 / x) + -3.0) / (x ^ -0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -7.4e+87) || ~((y <= 4.3e+70))) tmp = 3.0 * (y * sqrt(x)); else tmp = ((0.3333333333333333 / x) + -3.0) / (x ^ -0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -7.4e+87], N[Not[LessEqual[y, 4.3e+70]], $MachinePrecision]], N[(3.0 * N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.3333333333333333 / x), $MachinePrecision] + -3.0), $MachinePrecision] / N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.4 \cdot 10^{+87} \lor \neg \left(y \leq 4.3 \cdot 10^{+70}\right):\\
\;\;\;\;3 \cdot \left(y \cdot \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.3333333333333333}{x} + -3}{{x}^{-0.5}}\\
\end{array}
\end{array}
if y < -7.40000000000000005e87 or 4.3000000000000001e70 < y Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
associate--l+99.7%
distribute-lft-in99.6%
fma-def99.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 y around inf 83.5%
if -7.40000000000000005e87 < y < 4.3000000000000001e70Initial program 99.3%
*-commutative99.3%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-def99.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 0 93.9%
sub-neg93.9%
associate-*r/93.9%
metadata-eval93.9%
metadata-eval93.9%
Simplified93.9%
add-sqr-sqrt50.5%
sqrt-unprod51.4%
swap-sqr23.3%
add-sqr-sqrt23.3%
pow223.3%
Applied egg-rr23.3%
Applied egg-rr93.8%
associate-/r*93.7%
associate-/r/93.8%
pow1/293.8%
metadata-eval93.8%
pow-flip93.8%
metadata-eval93.8%
metadata-eval93.8%
Applied egg-rr93.8%
associate-*l/93.9%
*-lft-identity93.9%
Simplified93.9%
Final simplification90.1%
(FPCore (x y) :precision binary64 (if (or (<= y -3.1e+88) (not (<= y 4.1e+73))) (* 3.0 (* y (sqrt x))) (* (sqrt x) (+ (/ 0.3333333333333333 x) -3.0))))
double code(double x, double y) {
double tmp;
if ((y <= -3.1e+88) || !(y <= 4.1e+73)) {
tmp = 3.0 * (y * sqrt(x));
} 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 <= (-3.1d+88)) .or. (.not. (y <= 4.1d+73))) then
tmp = 3.0d0 * (y * sqrt(x))
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 <= -3.1e+88) || !(y <= 4.1e+73)) {
tmp = 3.0 * (y * Math.sqrt(x));
} else {
tmp = Math.sqrt(x) * ((0.3333333333333333 / x) + -3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -3.1e+88) or not (y <= 4.1e+73): tmp = 3.0 * (y * math.sqrt(x)) else: tmp = math.sqrt(x) * ((0.3333333333333333 / x) + -3.0) return tmp
function code(x, y) tmp = 0.0 if ((y <= -3.1e+88) || !(y <= 4.1e+73)) tmp = Float64(3.0 * Float64(y * sqrt(x))); 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 <= -3.1e+88) || ~((y <= 4.1e+73))) tmp = 3.0 * (y * sqrt(x)); else tmp = sqrt(x) * ((0.3333333333333333 / x) + -3.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -3.1e+88], N[Not[LessEqual[y, 4.1e+73]], $MachinePrecision]], N[(3.0 * N[(y * N[Sqrt[x], $MachinePrecision]), $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 -3.1 \cdot 10^{+88} \lor \neg \left(y \leq 4.1 \cdot 10^{+73}\right):\\
\;\;\;\;3 \cdot \left(y \cdot \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(\frac{0.3333333333333333}{x} + -3\right)\\
\end{array}
\end{array}
if y < -3.1000000000000001e88 or 4.0999999999999998e73 < y Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
associate--l+99.7%
distribute-lft-in99.6%
fma-def99.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 y around inf 83.5%
if -3.1000000000000001e88 < y < 4.0999999999999998e73Initial program 99.3%
*-commutative99.3%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-def99.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 0 93.9%
sub-neg93.9%
associate-*r/93.9%
metadata-eval93.9%
metadata-eval93.9%
Simplified93.9%
Final simplification90.1%
(FPCore (x y) :precision binary64 (* 3.0 (* (sqrt x) (+ (/ 0.1111111111111111 x) (+ y -1.0)))))
double code(double x, double y) {
return 3.0 * (sqrt(x) * ((0.1111111111111111 / x) + (y + -1.0)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 3.0d0 * (sqrt(x) * ((0.1111111111111111d0 / x) + (y + (-1.0d0))))
end function
public static double code(double x, double y) {
return 3.0 * (Math.sqrt(x) * ((0.1111111111111111 / x) + (y + -1.0)));
}
def code(x, y): return 3.0 * (math.sqrt(x) * ((0.1111111111111111 / x) + (y + -1.0)))
function code(x, y) return Float64(3.0 * Float64(sqrt(x) * Float64(Float64(0.1111111111111111 / x) + Float64(y + -1.0)))) end
function tmp = code(x, y) tmp = 3.0 * (sqrt(x) * ((0.1111111111111111 / x) + (y + -1.0))); end
code[x_, y_] := N[(3.0 * N[(N[Sqrt[x], $MachinePrecision] * N[(N[(0.1111111111111111 / x), $MachinePrecision] + N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
3 \cdot \left(\sqrt{x} \cdot \left(\frac{0.1111111111111111}{x} + \left(y + -1\right)\right)\right)
\end{array}
Initial program 99.4%
associate-*l*99.5%
sub-neg99.5%
+-commutative99.5%
associate-+l+99.5%
*-commutative99.5%
associate-/r*99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y) :precision binary64 (* (sqrt x) (+ (+ (* y 3.0) (/ 0.3333333333333333 x)) -3.0)))
double code(double x, double y) {
return sqrt(x) * (((y * 3.0) + (0.3333333333333333 / x)) + -3.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt(x) * (((y * 3.0d0) + (0.3333333333333333d0 / x)) + (-3.0d0))
end function
public static double code(double x, double y) {
return Math.sqrt(x) * (((y * 3.0) + (0.3333333333333333 / x)) + -3.0);
}
def code(x, y): return math.sqrt(x) * (((y * 3.0) + (0.3333333333333333 / x)) + -3.0)
function code(x, y) return Float64(sqrt(x) * Float64(Float64(Float64(y * 3.0) + Float64(0.3333333333333333 / x)) + -3.0)) end
function tmp = code(x, y) tmp = sqrt(x) * (((y * 3.0) + (0.3333333333333333 / x)) + -3.0); end
code[x_, y_] := N[(N[Sqrt[x], $MachinePrecision] * N[(N[(N[(y * 3.0), $MachinePrecision] + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] + -3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x} \cdot \left(\left(y \cdot 3 + \frac{0.3333333333333333}{x}\right) + -3\right)
\end{array}
Initial program 99.4%
*-commutative99.4%
associate-*l*99.5%
associate--l+99.5%
distribute-lft-in99.5%
fma-def99.5%
sub-neg99.5%
+-commutative99.5%
distribute-lft-in99.5%
metadata-eval99.5%
metadata-eval99.5%
*-commutative99.5%
associate-/r*99.4%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
fma-udef99.5%
+-commutative99.5%
associate-+r+99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x y) :precision binary64 (* (sqrt (* x 9.0)) (+ y (+ (/ 0.1111111111111111 x) -1.0))))
double code(double x, double y) {
return sqrt((x * 9.0)) * (y + ((0.1111111111111111 / x) + -1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt((x * 9.0d0)) * (y + ((0.1111111111111111d0 / x) + (-1.0d0)))
end function
public static double code(double x, double y) {
return Math.sqrt((x * 9.0)) * (y + ((0.1111111111111111 / x) + -1.0));
}
def code(x, y): return math.sqrt((x * 9.0)) * (y + ((0.1111111111111111 / x) + -1.0))
function code(x, y) return Float64(sqrt(Float64(x * 9.0)) * Float64(y + Float64(Float64(0.1111111111111111 / x) + -1.0))) end
function tmp = code(x, y) tmp = sqrt((x * 9.0)) * (y + ((0.1111111111111111 / x) + -1.0)); end
code[x_, y_] := N[(N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision] * N[(y + N[(N[(0.1111111111111111 / x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x \cdot 9} \cdot \left(y + \left(\frac{0.1111111111111111}{x} + -1\right)\right)
\end{array}
Initial program 99.4%
associate-*l*99.5%
sub-neg99.5%
+-commutative99.5%
associate-+l+99.5%
*-commutative99.5%
associate-/r*99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
associate-*r*99.4%
+-commutative99.4%
associate-+r+99.4%
+-commutative99.4%
distribute-lft-in99.4%
*-commutative99.4%
metadata-eval99.4%
sqrt-prod99.4%
*-commutative99.4%
metadata-eval99.4%
sqrt-prod99.6%
Applied egg-rr99.6%
distribute-lft-out99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y) :precision binary64 (if (<= x 0.055) (sqrt (+ (/ 0.1111111111111111 x) -2.0)) (* (sqrt x) -3.0)))
double code(double x, double y) {
double tmp;
if (x <= 0.055) {
tmp = sqrt(((0.1111111111111111 / x) + -2.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 <= 0.055d0) then
tmp = sqrt(((0.1111111111111111d0 / x) + (-2.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 <= 0.055) {
tmp = Math.sqrt(((0.1111111111111111 / x) + -2.0));
} else {
tmp = Math.sqrt(x) * -3.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.055: tmp = math.sqrt(((0.1111111111111111 / x) + -2.0)) else: tmp = math.sqrt(x) * -3.0 return tmp
function code(x, y) tmp = 0.0 if (x <= 0.055) tmp = sqrt(Float64(Float64(0.1111111111111111 / x) + -2.0)); else tmp = Float64(sqrt(x) * -3.0); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 0.055) tmp = sqrt(((0.1111111111111111 / x) + -2.0)); else tmp = sqrt(x) * -3.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.055], N[Sqrt[N[(N[(0.1111111111111111 / x), $MachinePrecision] + -2.0), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.055:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x} + -2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\end{array}
\end{array}
if x < 0.0550000000000000003Initial program 99.3%
*-commutative99.3%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-def99.4%
sub-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.2%
associate-*r/99.3%
metadata-eval99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around 0 73.4%
sub-neg73.4%
associate-*r/73.3%
metadata-eval73.3%
metadata-eval73.3%
Simplified73.3%
add-sqr-sqrt73.0%
sqrt-unprod73.3%
swap-sqr29.7%
add-sqr-sqrt29.6%
pow229.6%
Applied egg-rr29.6%
Taylor expanded in x around 0 73.7%
sub-neg73.7%
associate-*r/73.6%
metadata-eval73.6%
metadata-eval73.6%
Simplified73.6%
if 0.0550000000000000003 < x Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
associate--l+99.6%
distribute-lft-in99.7%
fma-def99.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.2%
Taylor expanded in y around 0 56.5%
*-commutative56.5%
Simplified56.5%
Final simplification65.3%
(FPCore (x y) :precision binary64 (if (<= x 6.1) (sqrt (/ 0.1111111111111111 x)) (* (sqrt x) -3.0)))
double code(double x, double y) {
double tmp;
if (x <= 6.1) {
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 <= 6.1d0) 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 <= 6.1) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else {
tmp = Math.sqrt(x) * -3.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 6.1: tmp = math.sqrt((0.1111111111111111 / x)) else: tmp = math.sqrt(x) * -3.0 return tmp
function code(x, y) tmp = 0.0 if (x <= 6.1) 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 <= 6.1) tmp = sqrt((0.1111111111111111 / x)); else tmp = sqrt(x) * -3.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 6.1], 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 6.1:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\end{array}
\end{array}
if x < 6.0999999999999996Initial program 99.3%
*-commutative99.3%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-def99.4%
sub-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.2%
associate-*r/99.3%
metadata-eval99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around 0 72.1%
add-sqr-sqrt71.8%
sqrt-unprod72.1%
swap-sqr29.0%
add-sqr-sqrt29.0%
frac-times29.1%
metadata-eval29.1%
pow229.1%
Applied egg-rr29.1%
associate-*r/30.7%
unpow230.7%
times-frac72.3%
*-inverses72.3%
*-lft-identity72.3%
Simplified72.3%
if 6.0999999999999996 < x Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
associate--l+99.6%
distribute-lft-in99.7%
fma-def99.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.2%
Taylor expanded in y around 0 57.4%
*-commutative57.4%
Simplified57.4%
Final simplification65.2%
(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.5%
associate--l+99.5%
distribute-lft-in99.5%
fma-def99.5%
sub-neg99.5%
+-commutative99.5%
distribute-lft-in99.5%
metadata-eval99.5%
metadata-eval99.5%
*-commutative99.5%
associate-/r*99.4%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in y around 0 65.4%
sub-neg65.4%
associate-*r/65.3%
metadata-eval65.3%
metadata-eval65.3%
Simplified65.3%
add-sqr-sqrt37.4%
sqrt-unprod38.4%
swap-sqr16.0%
add-sqr-sqrt16.0%
pow216.0%
Applied egg-rr16.0%
Taylor expanded in x around inf 3.1%
*-commutative3.1%
Simplified3.1%
Final simplification3.1%
(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.5%
associate--l+99.5%
distribute-lft-in99.5%
fma-def99.5%
sub-neg99.5%
+-commutative99.5%
distribute-lft-in99.5%
metadata-eval99.5%
metadata-eval99.5%
*-commutative99.5%
associate-/r*99.4%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 38.2%
add-sqr-sqrt38.1%
sqrt-unprod38.2%
swap-sqr16.0%
add-sqr-sqrt16.0%
frac-times16.0%
metadata-eval16.0%
pow216.0%
Applied egg-rr16.0%
associate-*r/16.9%
unpow216.9%
times-frac38.4%
*-inverses38.4%
*-lft-identity38.4%
Simplified38.4%
Final simplification38.4%
(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 2023310
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(* 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)))