
(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 13 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 (- (/ -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(1.0 + Float64(Float64(-1.0 / Float64(x * 9.0)) - Float64(Float64(y / 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[(1.0 + N[(N[(-1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision] - N[(N[(y / 3.0), $MachinePrecision] / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(\frac{-1}{x \cdot 9} - \frac{\frac{y}{3}}{\sqrt{x}}\right)
\end{array}
Initial program 99.7%
add-exp-log_binary6446.3%
Applied rewrite-once46.3%
rem-exp-log99.7%
associate--l-99.7%
associate-/r*99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y) :precision binary64 (- 1.0 (+ (/ 0.1111111111111111 x) (* (/ y 3.0) (pow x -0.5)))))
double code(double x, double y) {
return 1.0 - ((0.1111111111111111 / x) + ((y / 3.0) * pow(x, -0.5)));
}
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) * (x ** (-0.5d0))))
end function
public static double code(double x, double y) {
return 1.0 - ((0.1111111111111111 / x) + ((y / 3.0) * Math.pow(x, -0.5)));
}
def code(x, y): return 1.0 - ((0.1111111111111111 / x) + ((y / 3.0) * math.pow(x, -0.5)))
function code(x, y) return Float64(1.0 - Float64(Float64(0.1111111111111111 / x) + Float64(Float64(y / 3.0) * (x ^ -0.5)))) end
function tmp = code(x, y) tmp = 1.0 - ((0.1111111111111111 / x) + ((y / 3.0) * (x ^ -0.5))); end
code[x_, y_] := N[(1.0 - N[(N[(0.1111111111111111 / x), $MachinePrecision] + N[(N[(y / 3.0), $MachinePrecision] * N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \left(\frac{0.1111111111111111}{x} + \frac{y}{3} \cdot {x}^{-0.5}\right)
\end{array}
Initial program 99.7%
associate--l-99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
associate-/r*99.7%
clear-num99.6%
associate-/r/99.6%
pow1/299.6%
pow-flip99.7%
metadata-eval99.7%
div-inv99.6%
metadata-eval99.6%
Applied egg-rr99.6%
metadata-eval99.6%
div-inv99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (x y) :precision binary64 (- 1.0 (+ (/ 0.1111111111111111 x) (* (/ y (sqrt x)) 0.3333333333333333))))
double code(double x, double y) {
return 1.0 - ((0.1111111111111111 / x) + ((y / sqrt(x)) * 0.3333333333333333));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 - ((0.1111111111111111d0 / x) + ((y / sqrt(x)) * 0.3333333333333333d0))
end function
public static double code(double x, double y) {
return 1.0 - ((0.1111111111111111 / x) + ((y / Math.sqrt(x)) * 0.3333333333333333));
}
def code(x, y): return 1.0 - ((0.1111111111111111 / x) + ((y / math.sqrt(x)) * 0.3333333333333333))
function code(x, y) return Float64(1.0 - Float64(Float64(0.1111111111111111 / x) + Float64(Float64(y / sqrt(x)) * 0.3333333333333333))) end
function tmp = code(x, y) tmp = 1.0 - ((0.1111111111111111 / x) + ((y / sqrt(x)) * 0.3333333333333333)); end
code[x_, y_] := N[(1.0 - N[(N[(0.1111111111111111 / x), $MachinePrecision] + N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \left(\frac{0.1111111111111111}{x} + \frac{y}{\sqrt{x}} \cdot 0.3333333333333333\right)
\end{array}
Initial program 99.7%
associate--l-99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
*-commutative99.7%
associate-/r*99.7%
div-inv99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Final simplification99.6%
(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(1.0 - Float64(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[(1.0 - N[(N[(0.1111111111111111 / x), $MachinePrecision] + N[(y / N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \left(\frac{0.1111111111111111}{x} + \frac{y}{3 \cdot \sqrt{x}}\right)
\end{array}
Initial program 99.7%
associate--l-99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y) :precision binary64 (- 1.0 (+ (/ 0.1111111111111111 x) (/ (/ y (sqrt x)) 3.0))))
double code(double x, double y) {
return 1.0 - ((0.1111111111111111 / x) + ((y / sqrt(x)) / 3.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 - ((0.1111111111111111d0 / x) + ((y / sqrt(x)) / 3.0d0))
end function
public static double code(double x, double y) {
return 1.0 - ((0.1111111111111111 / x) + ((y / Math.sqrt(x)) / 3.0));
}
def code(x, y): return 1.0 - ((0.1111111111111111 / x) + ((y / math.sqrt(x)) / 3.0))
function code(x, y) return Float64(1.0 - Float64(Float64(0.1111111111111111 / x) + Float64(Float64(y / sqrt(x)) / 3.0))) end
function tmp = code(x, y) tmp = 1.0 - ((0.1111111111111111 / x) + ((y / sqrt(x)) / 3.0)); end
code[x_, y_] := N[(1.0 - N[(N[(0.1111111111111111 / x), $MachinePrecision] + N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \left(\frac{0.1111111111111111}{x} + \frac{\frac{y}{\sqrt{x}}}{3}\right)
\end{array}
Initial program 99.7%
associate--l-99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
*-commutative99.7%
associate-/r*99.7%
div-inv99.6%
metadata-eval99.6%
Applied egg-rr99.6%
metadata-eval99.6%
div-inv99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (x y) :precision binary64 (if (or (<= y -1.72e+100) (not (<= y 1.9e+32))) (/ (pow x -0.5) (/ -3.0 y)) (- 1.0 (/ 0.1111111111111111 x))))
double code(double x, double y) {
double tmp;
if ((y <= -1.72e+100) || !(y <= 1.9e+32)) {
tmp = pow(x, -0.5) / (-3.0 / y);
} 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 <= (-1.72d+100)) .or. (.not. (y <= 1.9d+32))) then
tmp = (x ** (-0.5d0)) / ((-3.0d0) / y)
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 <= -1.72e+100) || !(y <= 1.9e+32)) {
tmp = Math.pow(x, -0.5) / (-3.0 / y);
} else {
tmp = 1.0 - (0.1111111111111111 / x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.72e+100) or not (y <= 1.9e+32): tmp = math.pow(x, -0.5) / (-3.0 / y) else: tmp = 1.0 - (0.1111111111111111 / x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.72e+100) || !(y <= 1.9e+32)) tmp = Float64((x ^ -0.5) / Float64(-3.0 / y)); else tmp = Float64(1.0 - Float64(0.1111111111111111 / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.72e+100) || ~((y <= 1.9e+32))) tmp = (x ^ -0.5) / (-3.0 / y); else tmp = 1.0 - (0.1111111111111111 / x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.72e+100], N[Not[LessEqual[y, 1.9e+32]], $MachinePrecision]], N[(N[Power[x, -0.5], $MachinePrecision] / N[(-3.0 / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.72 \cdot 10^{+100} \lor \neg \left(y \leq 1.9 \cdot 10^{+32}\right):\\
\;\;\;\;\frac{{x}^{-0.5}}{\frac{-3}{y}}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{0.1111111111111111}{x}\\
\end{array}
\end{array}
if y < -1.7200000000000001e100 or 1.9000000000000002e32 < y Initial program 99.6%
add-exp-log_binary6444.6%
Applied rewrite-once44.6%
rem-exp-log99.6%
associate--l-99.6%
associate-/r*99.6%
Simplified99.6%
Taylor expanded in y around inf 90.0%
associate-*r*89.9%
*-commutative89.9%
*-commutative89.9%
Simplified89.9%
*-commutative89.9%
sqrt-div89.8%
metadata-eval89.8%
un-div-inv89.9%
Applied egg-rr89.9%
associate-*r/89.9%
associate-*l/90.0%
metadata-eval90.0%
metadata-eval90.0%
div-inv90.2%
div-inv90.1%
metadata-eval90.1%
sqrt-div90.1%
*-commutative90.1%
associate-/l*90.1%
remove-double-neg90.1%
frac-2neg90.1%
inv-pow90.1%
metadata-eval90.1%
sqrt-pow190.2%
metadata-eval90.2%
metadata-eval90.2%
frac-2neg90.2%
metadata-eval90.2%
remove-double-neg90.2%
Applied egg-rr90.2%
if -1.7200000000000001e100 < y < 1.9000000000000002e32Initial program 99.8%
associate--l-99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 97.4%
Final simplification94.4%
(FPCore (x y) :precision binary64 (if (or (<= y -7.2e+103) (not (<= y 1.9e+32))) (* y (/ -0.3333333333333333 (sqrt x))) (- 1.0 (/ 0.1111111111111111 x))))
double code(double x, double y) {
double tmp;
if ((y <= -7.2e+103) || !(y <= 1.9e+32)) {
tmp = y * (-0.3333333333333333 / 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 <= (-7.2d+103)) .or. (.not. (y <= 1.9d+32))) then
tmp = y * ((-0.3333333333333333d0) / 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 <= -7.2e+103) || !(y <= 1.9e+32)) {
tmp = y * (-0.3333333333333333 / Math.sqrt(x));
} else {
tmp = 1.0 - (0.1111111111111111 / x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -7.2e+103) or not (y <= 1.9e+32): tmp = y * (-0.3333333333333333 / math.sqrt(x)) else: tmp = 1.0 - (0.1111111111111111 / x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -7.2e+103) || !(y <= 1.9e+32)) tmp = Float64(y * Float64(-0.3333333333333333 / 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 <= -7.2e+103) || ~((y <= 1.9e+32))) tmp = y * (-0.3333333333333333 / sqrt(x)); else tmp = 1.0 - (0.1111111111111111 / x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -7.2e+103], N[Not[LessEqual[y, 1.9e+32]], $MachinePrecision]], N[(y * N[(-0.3333333333333333 / 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 -7.2 \cdot 10^{+103} \lor \neg \left(y \leq 1.9 \cdot 10^{+32}\right):\\
\;\;\;\;y \cdot \frac{-0.3333333333333333}{\sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{0.1111111111111111}{x}\\
\end{array}
\end{array}
if y < -7.20000000000000033e103 or 1.9000000000000002e32 < y Initial program 99.6%
add-exp-log_binary6443.6%
Applied rewrite-once43.6%
rem-exp-log99.6%
associate--l-99.6%
associate-/r*99.6%
Simplified99.6%
Taylor expanded in y around inf 90.7%
associate-*r*90.6%
*-commutative90.6%
*-commutative90.6%
Simplified90.6%
*-commutative90.6%
sqrt-div90.6%
metadata-eval90.6%
un-div-inv90.6%
Applied egg-rr90.6%
if -7.20000000000000033e103 < y < 1.9000000000000002e32Initial program 99.8%
associate--l-99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 96.8%
Final simplification94.3%
(FPCore (x y) :precision binary64 (if (or (<= y -1.72e+100) (not (<= y 1.9e+32))) (/ (/ y (sqrt x)) -3.0) (- 1.0 (/ 0.1111111111111111 x))))
double code(double x, double y) {
double tmp;
if ((y <= -1.72e+100) || !(y <= 1.9e+32)) {
tmp = (y / sqrt(x)) / -3.0;
} 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 <= (-1.72d+100)) .or. (.not. (y <= 1.9d+32))) then
tmp = (y / sqrt(x)) / (-3.0d0)
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 <= -1.72e+100) || !(y <= 1.9e+32)) {
tmp = (y / Math.sqrt(x)) / -3.0;
} else {
tmp = 1.0 - (0.1111111111111111 / x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.72e+100) or not (y <= 1.9e+32): tmp = (y / math.sqrt(x)) / -3.0 else: tmp = 1.0 - (0.1111111111111111 / x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.72e+100) || !(y <= 1.9e+32)) tmp = Float64(Float64(y / sqrt(x)) / -3.0); else tmp = Float64(1.0 - Float64(0.1111111111111111 / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.72e+100) || ~((y <= 1.9e+32))) tmp = (y / sqrt(x)) / -3.0; else tmp = 1.0 - (0.1111111111111111 / x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.72e+100], N[Not[LessEqual[y, 1.9e+32]], $MachinePrecision]], N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / -3.0), $MachinePrecision], N[(1.0 - N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.72 \cdot 10^{+100} \lor \neg \left(y \leq 1.9 \cdot 10^{+32}\right):\\
\;\;\;\;\frac{\frac{y}{\sqrt{x}}}{-3}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{0.1111111111111111}{x}\\
\end{array}
\end{array}
if y < -1.7200000000000001e100 or 1.9000000000000002e32 < y Initial program 99.6%
add-exp-log_binary6444.6%
Applied rewrite-once44.6%
rem-exp-log99.6%
associate--l-99.6%
associate-/r*99.6%
Simplified99.6%
Taylor expanded in y around inf 90.0%
associate-*r*89.9%
*-commutative89.9%
*-commutative89.9%
Simplified89.9%
*-commutative89.9%
sqrt-div89.8%
metadata-eval89.8%
un-div-inv89.9%
Applied egg-rr89.9%
associate-*r/89.9%
associate-*l/90.0%
metadata-eval90.0%
metadata-eval90.0%
div-inv90.2%
metadata-eval90.2%
Applied egg-rr90.2%
if -1.7200000000000001e100 < y < 1.9000000000000002e32Initial program 99.8%
associate--l-99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 97.4%
Final simplification94.4%
(FPCore (x y)
:precision binary64
(if (<= y -2.7e+109)
(* y (/ -0.3333333333333333 (sqrt x)))
(if (<= y 1.9e+32)
(- 1.0 (/ 0.1111111111111111 x))
(* (/ y (sqrt x)) -0.3333333333333333))))
double code(double x, double y) {
double tmp;
if (y <= -2.7e+109) {
tmp = y * (-0.3333333333333333 / sqrt(x));
} else if (y <= 1.9e+32) {
tmp = 1.0 - (0.1111111111111111 / x);
} else {
tmp = (y / sqrt(x)) * -0.3333333333333333;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-2.7d+109)) then
tmp = y * ((-0.3333333333333333d0) / sqrt(x))
else if (y <= 1.9d+32) then
tmp = 1.0d0 - (0.1111111111111111d0 / x)
else
tmp = (y / sqrt(x)) * (-0.3333333333333333d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.7e+109) {
tmp = y * (-0.3333333333333333 / Math.sqrt(x));
} else if (y <= 1.9e+32) {
tmp = 1.0 - (0.1111111111111111 / x);
} else {
tmp = (y / Math.sqrt(x)) * -0.3333333333333333;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.7e+109: tmp = y * (-0.3333333333333333 / math.sqrt(x)) elif y <= 1.9e+32: tmp = 1.0 - (0.1111111111111111 / x) else: tmp = (y / math.sqrt(x)) * -0.3333333333333333 return tmp
function code(x, y) tmp = 0.0 if (y <= -2.7e+109) tmp = Float64(y * Float64(-0.3333333333333333 / sqrt(x))); elseif (y <= 1.9e+32) tmp = Float64(1.0 - Float64(0.1111111111111111 / x)); else tmp = Float64(Float64(y / sqrt(x)) * -0.3333333333333333); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.7e+109) tmp = y * (-0.3333333333333333 / sqrt(x)); elseif (y <= 1.9e+32) tmp = 1.0 - (0.1111111111111111 / x); else tmp = (y / sqrt(x)) * -0.3333333333333333; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.7e+109], N[(y * N[(-0.3333333333333333 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+32], N[(1.0 - N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+109}:\\
\;\;\;\;y \cdot \frac{-0.3333333333333333}{\sqrt{x}}\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+32}:\\
\;\;\;\;1 - \frac{0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\sqrt{x}} \cdot -0.3333333333333333\\
\end{array}
\end{array}
if y < -2.70000000000000001e109Initial program 99.6%
add-exp-log_binary6493.1%
Applied rewrite-once93.1%
rem-exp-log99.6%
associate--l-99.6%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around inf 97.4%
associate-*r*97.5%
*-commutative97.5%
*-commutative97.5%
Simplified97.5%
*-commutative97.5%
sqrt-div97.6%
metadata-eval97.6%
un-div-inv97.5%
Applied egg-rr97.5%
if -2.70000000000000001e109 < y < 1.9000000000000002e32Initial program 99.8%
associate--l-99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 96.8%
if 1.9000000000000002e32 < y Initial program 99.5%
Taylor expanded in y around inf 85.7%
*-commutative85.7%
Simplified85.7%
*-commutative85.7%
sqrt-div85.7%
metadata-eval85.7%
div-inv85.7%
remove-double-neg85.7%
neg-sub085.7%
frac-2neg85.7%
distribute-frac-neg85.7%
remove-double-neg85.7%
Applied egg-rr85.7%
sub0-neg85.7%
distribute-frac-neg85.7%
neg-mul-185.7%
neg-mul-185.7%
times-frac85.7%
metadata-eval85.7%
*-lft-identity85.7%
Simplified85.7%
Final simplification94.4%
(FPCore (x y)
:precision binary64
(if (<= y -1.72e+100)
(/ y (* (sqrt x) -3.0))
(if (<= y 1.9e+32)
(- 1.0 (/ 0.1111111111111111 x))
(* (/ y (sqrt x)) -0.3333333333333333))))
double code(double x, double y) {
double tmp;
if (y <= -1.72e+100) {
tmp = y / (sqrt(x) * -3.0);
} else if (y <= 1.9e+32) {
tmp = 1.0 - (0.1111111111111111 / x);
} else {
tmp = (y / sqrt(x)) * -0.3333333333333333;
}
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+100)) then
tmp = y / (sqrt(x) * (-3.0d0))
else if (y <= 1.9d+32) then
tmp = 1.0d0 - (0.1111111111111111d0 / x)
else
tmp = (y / sqrt(x)) * (-0.3333333333333333d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.72e+100) {
tmp = y / (Math.sqrt(x) * -3.0);
} else if (y <= 1.9e+32) {
tmp = 1.0 - (0.1111111111111111 / x);
} else {
tmp = (y / Math.sqrt(x)) * -0.3333333333333333;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.72e+100: tmp = y / (math.sqrt(x) * -3.0) elif y <= 1.9e+32: tmp = 1.0 - (0.1111111111111111 / x) else: tmp = (y / math.sqrt(x)) * -0.3333333333333333 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.72e+100) tmp = Float64(y / Float64(sqrt(x) * -3.0)); elseif (y <= 1.9e+32) tmp = Float64(1.0 - Float64(0.1111111111111111 / x)); else tmp = Float64(Float64(y / sqrt(x)) * -0.3333333333333333); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.72e+100) tmp = y / (sqrt(x) * -3.0); elseif (y <= 1.9e+32) tmp = 1.0 - (0.1111111111111111 / x); else tmp = (y / sqrt(x)) * -0.3333333333333333; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.72e+100], N[(y / N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+32], N[(1.0 - N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.72 \cdot 10^{+100}:\\
\;\;\;\;\frac{y}{\sqrt{x} \cdot -3}\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+32}:\\
\;\;\;\;1 - \frac{0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\sqrt{x}} \cdot -0.3333333333333333\\
\end{array}
\end{array}
if y < -1.7200000000000001e100Initial program 99.6%
add-exp-log_binary6493.2%
Applied rewrite-once93.2%
rem-exp-log99.6%
associate--l-99.6%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around inf 95.5%
associate-*r*95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
*-commutative95.6%
sqrt-div95.7%
metadata-eval95.7%
un-div-inv95.6%
Applied egg-rr95.6%
associate-*r/95.5%
associate-*l/95.5%
metadata-eval95.5%
metadata-eval95.5%
distribute-rgt-neg-in95.5%
metadata-eval95.5%
metadata-eval95.5%
div-inv95.8%
neg-sub095.8%
associate-/l/95.8%
div-inv95.6%
associate-/r*95.6%
metadata-eval95.6%
Applied egg-rr95.6%
sub0-neg95.6%
neg-mul-195.6%
associate-*r/95.5%
metadata-eval95.5%
times-frac95.5%
*-commutative95.5%
*-rgt-identity95.5%
associate-/r*95.5%
associate-/l*95.9%
metadata-eval95.9%
associate-/l/95.8%
Simplified95.8%
if -1.7200000000000001e100 < y < 1.9000000000000002e32Initial program 99.8%
associate--l-99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 97.4%
if 1.9000000000000002e32 < y Initial program 99.5%
Taylor expanded in y around inf 85.7%
*-commutative85.7%
Simplified85.7%
*-commutative85.7%
sqrt-div85.7%
metadata-eval85.7%
div-inv85.7%
remove-double-neg85.7%
neg-sub085.7%
frac-2neg85.7%
distribute-frac-neg85.7%
remove-double-neg85.7%
Applied egg-rr85.7%
sub0-neg85.7%
distribute-frac-neg85.7%
neg-mul-185.7%
neg-mul-185.7%
times-frac85.7%
metadata-eval85.7%
*-lft-identity85.7%
Simplified85.7%
Final simplification94.4%
(FPCore (x y) :precision binary64 (if (<= x 5e+26) (/ -0.1111111111111111 x) 1.0))
double code(double x, double y) {
double tmp;
if (x <= 5e+26) {
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 <= 5d+26) 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 <= 5e+26) {
tmp = -0.1111111111111111 / x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 5e+26: tmp = -0.1111111111111111 / x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= 5e+26) tmp = Float64(-0.1111111111111111 / x); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 5e+26) tmp = -0.1111111111111111 / x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 5e+26], N[(-0.1111111111111111 / x), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{+26}:\\
\;\;\;\;\frac{-0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < 5.0000000000000001e26Initial program 99.7%
Taylor expanded in x around 0 57.3%
if 5.0000000000000001e26 < x Initial program 99.8%
Taylor expanded in x around inf 64.9%
Final simplification60.7%
(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%
associate--l-99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 61.1%
Final simplification61.1%
(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%
Taylor expanded in x around inf 29.8%
Final simplification29.8%
(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 2023297
(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)))))