
(FPCore (x y) :precision binary64 (- (- 1.0 (/ 1.0 (* x 9.0))) (/ y (* 3.0 (sqrt x)))))
double code(double x, double y) {
return (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * sqrt(x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 - (1.0d0 / (x * 9.0d0))) - (y / (3.0d0 * sqrt(x)))
end function
public static double code(double x, double y) {
return (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * Math.sqrt(x)));
}
def code(x, y): return (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * math.sqrt(x)))
function code(x, y) return Float64(Float64(1.0 - Float64(1.0 / Float64(x * 9.0))) - Float64(y / Float64(3.0 * sqrt(x)))) end
function tmp = code(x, y) tmp = (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * sqrt(x))); end
code[x_, y_] := N[(N[(1.0 - N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y / N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - \frac{1}{x \cdot 9}\right) - \frac{y}{3 \cdot \sqrt{x}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (- (- 1.0 (/ 1.0 (* x 9.0))) (/ y (* 3.0 (sqrt x)))))
double code(double x, double y) {
return (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * sqrt(x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 - (1.0d0 / (x * 9.0d0))) - (y / (3.0d0 * sqrt(x)))
end function
public static double code(double x, double y) {
return (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * Math.sqrt(x)));
}
def code(x, y): return (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * math.sqrt(x)))
function code(x, y) return Float64(Float64(1.0 - Float64(1.0 / Float64(x * 9.0))) - Float64(y / Float64(3.0 * sqrt(x)))) end
function tmp = code(x, y) tmp = (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * sqrt(x))); end
code[x_, y_] := N[(N[(1.0 - N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y / N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - \frac{1}{x \cdot 9}\right) - \frac{y}{3 \cdot \sqrt{x}}
\end{array}
(FPCore (x y) :precision binary64 (- (- 1.0 (/ 0.1111111111111111 x)) (/ y (* 3.0 (sqrt x)))))
double code(double x, double y) {
return (1.0 - (0.1111111111111111 / x)) - (y / (3.0 * sqrt(x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 - (0.1111111111111111d0 / x)) - (y / (3.0d0 * sqrt(x)))
end function
public static double code(double x, double y) {
return (1.0 - (0.1111111111111111 / x)) - (y / (3.0 * Math.sqrt(x)));
}
def code(x, y): return (1.0 - (0.1111111111111111 / x)) - (y / (3.0 * math.sqrt(x)))
function code(x, y) return Float64(Float64(1.0 - Float64(0.1111111111111111 / x)) - Float64(y / Float64(3.0 * sqrt(x)))) end
function tmp = code(x, y) tmp = (1.0 - (0.1111111111111111 / x)) - (y / (3.0 * sqrt(x))); end
code[x_, y_] := N[(N[(1.0 - N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision] - N[(y / N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - \frac{0.1111111111111111}{x}\right) - \frac{y}{3 \cdot \sqrt{x}}
\end{array}
Initial program 99.7%
sub-neg99.7%
neg-sub099.7%
associate-+r-99.7%
associate-+l-99.7%
associate-+l-99.7%
+-rgt-identity99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y) :precision binary64 (if (or (<= y -9.5e+76) (not (<= y 6e+112))) (* -0.3333333333333333 (/ y (sqrt x))) (+ 1.0 (/ -0.1111111111111111 x))))
double code(double x, double y) {
double tmp;
if ((y <= -9.5e+76) || !(y <= 6e+112)) {
tmp = -0.3333333333333333 * (y / sqrt(x));
} else {
tmp = 1.0 + (-0.1111111111111111 / x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-9.5d+76)) .or. (.not. (y <= 6d+112))) then
tmp = (-0.3333333333333333d0) * (y / sqrt(x))
else
tmp = 1.0d0 + ((-0.1111111111111111d0) / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -9.5e+76) || !(y <= 6e+112)) {
tmp = -0.3333333333333333 * (y / Math.sqrt(x));
} else {
tmp = 1.0 + (-0.1111111111111111 / x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -9.5e+76) or not (y <= 6e+112): tmp = -0.3333333333333333 * (y / math.sqrt(x)) else: tmp = 1.0 + (-0.1111111111111111 / x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -9.5e+76) || !(y <= 6e+112)) tmp = Float64(-0.3333333333333333 * Float64(y / sqrt(x))); else tmp = Float64(1.0 + Float64(-0.1111111111111111 / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -9.5e+76) || ~((y <= 6e+112))) tmp = -0.3333333333333333 * (y / sqrt(x)); else tmp = 1.0 + (-0.1111111111111111 / x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -9.5e+76], N[Not[LessEqual[y, 6e+112]], $MachinePrecision]], N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+76} \lor \neg \left(y \leq 6 \cdot 10^{+112}\right):\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-0.1111111111111111}{x}\\
\end{array}
\end{array}
if y < -9.5000000000000003e76 or 5.99999999999999958e112 < y Initial program 99.6%
sub-neg99.6%
neg-sub099.6%
associate-+r-99.6%
associate-+l-99.6%
associate-+l-99.6%
+-rgt-identity99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 96.7%
*-commutative96.7%
associate-*l*96.7%
Simplified96.7%
sqrt-div96.6%
metadata-eval96.6%
associate-*l/96.8%
*-un-lft-identity96.8%
add-sqr-sqrt56.6%
sqrt-unprod28.1%
swap-sqr28.1%
metadata-eval28.1%
metadata-eval28.1%
swap-sqr28.1%
*-commutative28.1%
*-commutative28.1%
sqrt-unprod0.2%
add-sqr-sqrt0.6%
frac-2neg0.6%
Applied egg-rr96.8%
*-commutative96.8%
associate-/l*96.7%
add-sqr-sqrt0.0%
sqrt-unprod0.6%
sqr-neg0.6%
add-sqr-sqrt0.6%
frac-2neg0.6%
add-sqr-sqrt0.0%
sqrt-unprod96.7%
sqr-neg96.7%
add-sqr-sqrt96.7%
associate-/r/96.8%
metadata-eval96.8%
Applied egg-rr96.8%
if -9.5000000000000003e76 < y < 5.99999999999999958e112Initial program 99.7%
sub-neg99.7%
neg-sub099.7%
associate-+r-99.7%
associate-+l-99.7%
associate-+l-99.7%
+-rgt-identity99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 90.7%
cancel-sign-sub-inv90.7%
metadata-eval90.7%
associate-*r/90.7%
metadata-eval90.7%
Simplified90.7%
Final simplification93.0%
(FPCore (x y)
:precision binary64
(if (<= y -3.3e+76)
(/ -0.3333333333333333 (/ (sqrt x) y))
(if (<= y 6e+112)
(+ 1.0 (/ -0.1111111111111111 x))
(* -0.3333333333333333 (/ y (sqrt x))))))
double code(double x, double y) {
double tmp;
if (y <= -3.3e+76) {
tmp = -0.3333333333333333 / (sqrt(x) / y);
} else if (y <= 6e+112) {
tmp = 1.0 + (-0.1111111111111111 / x);
} else {
tmp = -0.3333333333333333 * (y / sqrt(x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-3.3d+76)) then
tmp = (-0.3333333333333333d0) / (sqrt(x) / y)
else if (y <= 6d+112) then
tmp = 1.0d0 + ((-0.1111111111111111d0) / x)
else
tmp = (-0.3333333333333333d0) * (y / sqrt(x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.3e+76) {
tmp = -0.3333333333333333 / (Math.sqrt(x) / y);
} else if (y <= 6e+112) {
tmp = 1.0 + (-0.1111111111111111 / x);
} else {
tmp = -0.3333333333333333 * (y / Math.sqrt(x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.3e+76: tmp = -0.3333333333333333 / (math.sqrt(x) / y) elif y <= 6e+112: tmp = 1.0 + (-0.1111111111111111 / x) else: tmp = -0.3333333333333333 * (y / math.sqrt(x)) return tmp
function code(x, y) tmp = 0.0 if (y <= -3.3e+76) tmp = Float64(-0.3333333333333333 / Float64(sqrt(x) / y)); elseif (y <= 6e+112) tmp = Float64(1.0 + Float64(-0.1111111111111111 / x)); else tmp = Float64(-0.3333333333333333 * Float64(y / sqrt(x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.3e+76) tmp = -0.3333333333333333 / (sqrt(x) / y); elseif (y <= 6e+112) tmp = 1.0 + (-0.1111111111111111 / x); else tmp = -0.3333333333333333 * (y / sqrt(x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.3e+76], N[(-0.3333333333333333 / N[(N[Sqrt[x], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e+112], N[(1.0 + N[(-0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{+76}:\\
\;\;\;\;\frac{-0.3333333333333333}{\frac{\sqrt{x}}{y}}\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+112}:\\
\;\;\;\;1 + \frac{-0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\end{array}
\end{array}
if y < -3.3000000000000001e76Initial program 99.6%
sub-neg99.6%
neg-sub099.6%
associate-+r-99.6%
associate-+l-99.6%
associate-+l-99.6%
+-rgt-identity99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 96.5%
*-commutative96.5%
associate-*l*96.6%
Simplified96.6%
associate-*r*96.5%
*-commutative96.5%
metadata-eval96.5%
associate-/r/96.5%
sqrt-div96.5%
metadata-eval96.5%
associate-*l/96.7%
*-un-lft-identity96.7%
clear-num96.7%
Applied egg-rr96.7%
if -3.3000000000000001e76 < y < 5.99999999999999958e112Initial program 99.7%
sub-neg99.7%
neg-sub099.7%
associate-+r-99.7%
associate-+l-99.7%
associate-+l-99.7%
+-rgt-identity99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 90.7%
cancel-sign-sub-inv90.7%
metadata-eval90.7%
associate-*r/90.7%
metadata-eval90.7%
Simplified90.7%
if 5.99999999999999958e112 < y Initial program 99.6%
sub-neg99.6%
neg-sub099.6%
associate-+r-99.6%
associate-+l-99.6%
associate-+l-99.6%
+-rgt-identity99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 96.9%
*-commutative96.9%
associate-*l*96.9%
Simplified96.9%
sqrt-div97.0%
metadata-eval97.0%
associate-*l/97.0%
*-un-lft-identity97.0%
add-sqr-sqrt0.0%
sqrt-unprod0.5%
swap-sqr0.5%
metadata-eval0.5%
metadata-eval0.5%
swap-sqr0.5%
*-commutative0.5%
*-commutative0.5%
sqrt-unprod0.6%
add-sqr-sqrt0.6%
frac-2neg0.6%
Applied egg-rr97.0%
*-commutative97.0%
associate-/l*96.8%
add-sqr-sqrt0.0%
sqrt-unprod0.6%
sqr-neg0.6%
add-sqr-sqrt0.6%
frac-2neg0.6%
add-sqr-sqrt0.0%
sqrt-unprod96.8%
sqr-neg96.8%
add-sqr-sqrt96.8%
associate-/r/97.1%
metadata-eval97.1%
Applied egg-rr97.1%
Final simplification93.0%
(FPCore (x y)
:precision binary64
(if (<= y -1.72e+87)
(* y (* -0.3333333333333333 (pow x -0.5)))
(if (<= y 7.5e+112)
(+ 1.0 (/ -0.1111111111111111 x))
(* -0.3333333333333333 (/ y (sqrt x))))))
double code(double x, double y) {
double tmp;
if (y <= -1.72e+87) {
tmp = y * (-0.3333333333333333 * pow(x, -0.5));
} else if (y <= 7.5e+112) {
tmp = 1.0 + (-0.1111111111111111 / x);
} else {
tmp = -0.3333333333333333 * (y / sqrt(x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.72d+87)) then
tmp = y * ((-0.3333333333333333d0) * (x ** (-0.5d0)))
else if (y <= 7.5d+112) then
tmp = 1.0d0 + ((-0.1111111111111111d0) / x)
else
tmp = (-0.3333333333333333d0) * (y / sqrt(x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.72e+87) {
tmp = y * (-0.3333333333333333 * Math.pow(x, -0.5));
} else if (y <= 7.5e+112) {
tmp = 1.0 + (-0.1111111111111111 / x);
} else {
tmp = -0.3333333333333333 * (y / Math.sqrt(x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.72e+87: tmp = y * (-0.3333333333333333 * math.pow(x, -0.5)) elif y <= 7.5e+112: tmp = 1.0 + (-0.1111111111111111 / x) else: tmp = -0.3333333333333333 * (y / math.sqrt(x)) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.72e+87) tmp = Float64(y * Float64(-0.3333333333333333 * (x ^ -0.5))); elseif (y <= 7.5e+112) tmp = Float64(1.0 + Float64(-0.1111111111111111 / x)); else tmp = Float64(-0.3333333333333333 * Float64(y / sqrt(x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.72e+87) tmp = y * (-0.3333333333333333 * (x ^ -0.5)); elseif (y <= 7.5e+112) tmp = 1.0 + (-0.1111111111111111 / x); else tmp = -0.3333333333333333 * (y / sqrt(x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.72e+87], N[(y * N[(-0.3333333333333333 * N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+112], N[(1.0 + N[(-0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.72 \cdot 10^{+87}:\\
\;\;\;\;y \cdot \left(-0.3333333333333333 \cdot {x}^{-0.5}\right)\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+112}:\\
\;\;\;\;1 + \frac{-0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\end{array}
\end{array}
if y < -1.72000000000000008e87Initial program 99.6%
sub-neg99.6%
neg-sub099.6%
associate-+r-99.6%
associate-+l-99.6%
associate-+l-99.6%
+-rgt-identity99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 96.5%
*-commutative96.5%
associate-*l*96.6%
Simplified96.6%
sqrt-div96.4%
metadata-eval96.4%
associate-*l/96.6%
*-un-lft-identity96.6%
add-sqr-sqrt96.3%
sqrt-unprod47.4%
swap-sqr47.5%
metadata-eval47.5%
metadata-eval47.5%
swap-sqr47.4%
*-commutative47.4%
*-commutative47.4%
sqrt-unprod0.0%
add-sqr-sqrt0.6%
frac-2neg0.6%
Applied egg-rr96.6%
frac-2neg96.6%
remove-double-neg96.6%
clear-num96.7%
associate-/r/96.4%
pow1/296.4%
pow-flip96.6%
metadata-eval96.6%
*-commutative96.6%
distribute-rgt-neg-in96.6%
metadata-eval96.6%
Applied egg-rr96.6%
*-commutative96.6%
associate-*l*96.8%
Simplified96.8%
if -1.72000000000000008e87 < y < 7.5e112Initial program 99.7%
sub-neg99.7%
neg-sub099.7%
associate-+r-99.7%
associate-+l-99.7%
associate-+l-99.7%
+-rgt-identity99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 90.7%
cancel-sign-sub-inv90.7%
metadata-eval90.7%
associate-*r/90.7%
metadata-eval90.7%
Simplified90.7%
if 7.5e112 < y Initial program 99.6%
sub-neg99.6%
neg-sub099.6%
associate-+r-99.6%
associate-+l-99.6%
associate-+l-99.6%
+-rgt-identity99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 96.9%
*-commutative96.9%
associate-*l*96.9%
Simplified96.9%
sqrt-div97.0%
metadata-eval97.0%
associate-*l/97.0%
*-un-lft-identity97.0%
add-sqr-sqrt0.0%
sqrt-unprod0.5%
swap-sqr0.5%
metadata-eval0.5%
metadata-eval0.5%
swap-sqr0.5%
*-commutative0.5%
*-commutative0.5%
sqrt-unprod0.6%
add-sqr-sqrt0.6%
frac-2neg0.6%
Applied egg-rr97.0%
*-commutative97.0%
associate-/l*96.8%
add-sqr-sqrt0.0%
sqrt-unprod0.6%
sqr-neg0.6%
add-sqr-sqrt0.6%
frac-2neg0.6%
add-sqr-sqrt0.0%
sqrt-unprod96.8%
sqr-neg96.8%
add-sqr-sqrt96.8%
associate-/r/97.1%
metadata-eval97.1%
Applied egg-rr97.1%
Final simplification93.0%
(FPCore (x y)
:precision binary64
(if (<= y -1.7e+85)
(* y (* -0.3333333333333333 (sqrt (/ 1.0 x))))
(if (<= y 6e+112)
(+ 1.0 (/ -0.1111111111111111 x))
(* -0.3333333333333333 (/ y (sqrt x))))))
double code(double x, double y) {
double tmp;
if (y <= -1.7e+85) {
tmp = y * (-0.3333333333333333 * sqrt((1.0 / x)));
} else if (y <= 6e+112) {
tmp = 1.0 + (-0.1111111111111111 / x);
} else {
tmp = -0.3333333333333333 * (y / sqrt(x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.7d+85)) then
tmp = y * ((-0.3333333333333333d0) * sqrt((1.0d0 / x)))
else if (y <= 6d+112) then
tmp = 1.0d0 + ((-0.1111111111111111d0) / x)
else
tmp = (-0.3333333333333333d0) * (y / sqrt(x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.7e+85) {
tmp = y * (-0.3333333333333333 * Math.sqrt((1.0 / x)));
} else if (y <= 6e+112) {
tmp = 1.0 + (-0.1111111111111111 / x);
} else {
tmp = -0.3333333333333333 * (y / Math.sqrt(x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.7e+85: tmp = y * (-0.3333333333333333 * math.sqrt((1.0 / x))) elif y <= 6e+112: tmp = 1.0 + (-0.1111111111111111 / x) else: tmp = -0.3333333333333333 * (y / math.sqrt(x)) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.7e+85) tmp = Float64(y * Float64(-0.3333333333333333 * sqrt(Float64(1.0 / x)))); elseif (y <= 6e+112) tmp = Float64(1.0 + Float64(-0.1111111111111111 / x)); else tmp = Float64(-0.3333333333333333 * Float64(y / sqrt(x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.7e+85) tmp = y * (-0.3333333333333333 * sqrt((1.0 / x))); elseif (y <= 6e+112) tmp = 1.0 + (-0.1111111111111111 / x); else tmp = -0.3333333333333333 * (y / sqrt(x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.7e+85], N[(y * N[(-0.3333333333333333 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e+112], N[(1.0 + N[(-0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{+85}:\\
\;\;\;\;y \cdot \left(-0.3333333333333333 \cdot \sqrt{\frac{1}{x}}\right)\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+112}:\\
\;\;\;\;1 + \frac{-0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\end{array}
\end{array}
if y < -1.7000000000000002e85Initial program 99.6%
sub-neg99.6%
neg-sub099.6%
associate-+r-99.6%
associate-+l-99.6%
associate-+l-99.6%
+-rgt-identity99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
expm1-log1p-u0.0%
expm1-udef0.0%
div-inv0.0%
associate-/r*0.0%
metadata-eval0.0%
Applied egg-rr0.0%
expm1-def0.0%
expm1-log1p99.4%
associate-*r/99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in y around inf 96.5%
associate-*r*96.8%
Simplified96.8%
if -1.7000000000000002e85 < y < 5.99999999999999958e112Initial program 99.7%
sub-neg99.7%
neg-sub099.7%
associate-+r-99.7%
associate-+l-99.7%
associate-+l-99.7%
+-rgt-identity99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 90.7%
cancel-sign-sub-inv90.7%
metadata-eval90.7%
associate-*r/90.7%
metadata-eval90.7%
Simplified90.7%
if 5.99999999999999958e112 < y Initial program 99.6%
sub-neg99.6%
neg-sub099.6%
associate-+r-99.6%
associate-+l-99.6%
associate-+l-99.6%
+-rgt-identity99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 96.9%
*-commutative96.9%
associate-*l*96.9%
Simplified96.9%
sqrt-div97.0%
metadata-eval97.0%
associate-*l/97.0%
*-un-lft-identity97.0%
add-sqr-sqrt0.0%
sqrt-unprod0.5%
swap-sqr0.5%
metadata-eval0.5%
metadata-eval0.5%
swap-sqr0.5%
*-commutative0.5%
*-commutative0.5%
sqrt-unprod0.6%
add-sqr-sqrt0.6%
frac-2neg0.6%
Applied egg-rr97.0%
*-commutative97.0%
associate-/l*96.8%
add-sqr-sqrt0.0%
sqrt-unprod0.6%
sqr-neg0.6%
add-sqr-sqrt0.6%
frac-2neg0.6%
add-sqr-sqrt0.0%
sqrt-unprod96.8%
sqr-neg96.8%
add-sqr-sqrt96.8%
associate-/r/97.1%
metadata-eval97.1%
Applied egg-rr97.1%
Final simplification93.1%
(FPCore (x y) :precision binary64 (if (<= x 2.9) (/ -0.1111111111111111 x) 1.0))
double code(double x, double y) {
double tmp;
if (x <= 2.9) {
tmp = -0.1111111111111111 / x;
} else {
tmp = 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 <= 2.9d0) then
tmp = (-0.1111111111111111d0) / x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 2.9) {
tmp = -0.1111111111111111 / x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 2.9: tmp = -0.1111111111111111 / x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= 2.9) tmp = Float64(-0.1111111111111111 / x); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 2.9) tmp = -0.1111111111111111 / x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 2.9], N[(-0.1111111111111111 / x), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.9:\\
\;\;\;\;\frac{-0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < 2.89999999999999991Initial program 99.6%
sub-neg99.6%
neg-sub099.6%
associate-+r-99.6%
associate-+l-99.6%
associate-+l-99.6%
+-rgt-identity99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 49.8%
if 2.89999999999999991 < x Initial program 99.8%
sub-neg99.8%
neg-sub099.8%
associate-+r-99.8%
associate-+l-99.8%
associate-+l-99.8%
+-rgt-identity99.8%
*-commutative99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf 64.6%
Final simplification56.9%
(FPCore (x y) :precision binary64 (+ 1.0 (/ -0.1111111111111111 x)))
double code(double x, double y) {
return 1.0 + (-0.1111111111111111 / x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 + ((-0.1111111111111111d0) / x)
end function
public static double code(double x, double y) {
return 1.0 + (-0.1111111111111111 / x);
}
def code(x, y): return 1.0 + (-0.1111111111111111 / x)
function code(x, y) return Float64(1.0 + Float64(-0.1111111111111111 / x)) end
function tmp = code(x, y) tmp = 1.0 + (-0.1111111111111111 / x); end
code[x_, y_] := N[(1.0 + N[(-0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{-0.1111111111111111}{x}
\end{array}
Initial program 99.7%
sub-neg99.7%
neg-sub099.7%
associate-+r-99.7%
associate-+l-99.7%
associate-+l-99.7%
+-rgt-identity99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 58.3%
cancel-sign-sub-inv58.3%
metadata-eval58.3%
associate-*r/58.3%
metadata-eval58.3%
Simplified58.3%
Final simplification58.3%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.7%
sub-neg99.7%
neg-sub099.7%
associate-+r-99.7%
associate-+l-99.7%
associate-+l-99.7%
+-rgt-identity99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 31.9%
Final simplification31.9%
(FPCore (x y) :precision binary64 (- (- 1.0 (/ (/ 1.0 x) 9.0)) (/ y (* 3.0 (sqrt x)))))
double code(double x, double y) {
return (1.0 - ((1.0 / x) / 9.0)) - (y / (3.0 * sqrt(x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 - ((1.0d0 / x) / 9.0d0)) - (y / (3.0d0 * sqrt(x)))
end function
public static double code(double x, double y) {
return (1.0 - ((1.0 / x) / 9.0)) - (y / (3.0 * Math.sqrt(x)));
}
def code(x, y): return (1.0 - ((1.0 / x) / 9.0)) - (y / (3.0 * math.sqrt(x)))
function code(x, y) return Float64(Float64(1.0 - Float64(Float64(1.0 / x) / 9.0)) - Float64(y / Float64(3.0 * sqrt(x)))) end
function tmp = code(x, y) tmp = (1.0 - ((1.0 / x) / 9.0)) - (y / (3.0 * sqrt(x))); end
code[x_, y_] := N[(N[(1.0 - N[(N[(1.0 / x), $MachinePrecision] / 9.0), $MachinePrecision]), $MachinePrecision] - N[(y / N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - \frac{\frac{1}{x}}{9}\right) - \frac{y}{3 \cdot \sqrt{x}}
\end{array}
herbie shell --seed 2023301
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, D"
:precision binary64
:herbie-target
(- (- 1.0 (/ (/ 1.0 x) 9.0)) (/ y (* 3.0 (sqrt x))))
(- (- 1.0 (/ 1.0 (* x 9.0))) (/ y (* 3.0 (sqrt x)))))