
(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 12 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 (sqrt (* x 9.0)))))
double code(double x, double y) {
return (1.0 + (-1.0 / (x * 9.0))) - (y / sqrt((x * 9.0)));
}
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 / sqrt((x * 9.0d0)))
end function
public static double code(double x, double y) {
return (1.0 + (-1.0 / (x * 9.0))) - (y / Math.sqrt((x * 9.0)));
}
def code(x, y): return (1.0 + (-1.0 / (x * 9.0))) - (y / math.sqrt((x * 9.0)))
function code(x, y) return Float64(Float64(1.0 + Float64(-1.0 / Float64(x * 9.0))) - Float64(y / sqrt(Float64(x * 9.0)))) end
function tmp = code(x, y) tmp = (1.0 + (-1.0 / (x * 9.0))) - (y / sqrt((x * 9.0))); end
code[x_, y_] := N[(N[(1.0 + N[(-1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y / N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + \frac{-1}{x \cdot 9}\right) - \frac{y}{\sqrt{x \cdot 9}}
\end{array}
Initial program 99.6%
*-commutative99.6%
metadata-eval99.6%
sqrt-prod99.6%
pow1/299.6%
Applied egg-rr99.6%
unpow1/299.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y) :precision binary64 (if (or (<= y -9.6e+26) (not (<= y 1.45e+56))) (- 1.0 (/ y (sqrt (* x 9.0)))) (- 1.0 (/ 0.3333333333333333 (* x 3.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -9.6e+26) || !(y <= 1.45e+56)) {
tmp = 1.0 - (y / sqrt((x * 9.0)));
} else {
tmp = 1.0 - (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 <= (-9.6d+26)) .or. (.not. (y <= 1.45d+56))) then
tmp = 1.0d0 - (y / sqrt((x * 9.0d0)))
else
tmp = 1.0d0 - (0.3333333333333333d0 / (x * 3.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -9.6e+26) || !(y <= 1.45e+56)) {
tmp = 1.0 - (y / Math.sqrt((x * 9.0)));
} else {
tmp = 1.0 - (0.3333333333333333 / (x * 3.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -9.6e+26) or not (y <= 1.45e+56): tmp = 1.0 - (y / math.sqrt((x * 9.0))) else: tmp = 1.0 - (0.3333333333333333 / (x * 3.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -9.6e+26) || !(y <= 1.45e+56)) tmp = Float64(1.0 - Float64(y / sqrt(Float64(x * 9.0)))); else tmp = Float64(1.0 - Float64(0.3333333333333333 / Float64(x * 3.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -9.6e+26) || ~((y <= 1.45e+56))) tmp = 1.0 - (y / sqrt((x * 9.0))); else tmp = 1.0 - (0.3333333333333333 / (x * 3.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -9.6e+26], N[Not[LessEqual[y, 1.45e+56]], $MachinePrecision]], N[(1.0 - N[(y / N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(0.3333333333333333 / N[(x * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.6 \cdot 10^{+26} \lor \neg \left(y \leq 1.45 \cdot 10^{+56}\right):\\
\;\;\;\;1 - \frac{y}{\sqrt{x \cdot 9}}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{0.3333333333333333}{x \cdot 3}\\
\end{array}
\end{array}
if y < -9.60000000000000018e26 or 1.45000000000000004e56 < y Initial program 99.5%
*-commutative99.5%
metadata-eval99.5%
sqrt-prod99.6%
pow1/299.6%
Applied egg-rr99.6%
unpow1/299.6%
Simplified99.6%
Taylor expanded in x around inf 90.3%
if -9.60000000000000018e26 < y < 1.45000000000000004e56Initial program 99.7%
associate--l-99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
distribute-frac-neg99.7%
sub-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
fmm-def99.7%
associate-/r*99.7%
metadata-eval99.7%
*-commutative99.7%
associate-/r*99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 97.4%
associate-*r/97.4%
metadata-eval97.4%
Simplified97.4%
expm1-log1p-u93.3%
expm1-undefine93.3%
log1p-undefine93.3%
add-exp-log97.4%
add-sqr-sqrt97.1%
sqrt-unprod76.4%
frac-times76.5%
metadata-eval76.5%
metadata-eval76.5%
frac-times76.4%
sqrt-unprod0.0%
add-sqr-sqrt43.3%
Applied egg-rr43.3%
+-commutative43.3%
associate--l+43.3%
metadata-eval43.3%
Simplified43.3%
+-rgt-identity43.3%
add-sqr-sqrt0.0%
sqrt-unprod76.5%
frac-times76.5%
metadata-eval76.5%
metadata-eval76.5%
frac-times76.5%
sqrt-unprod97.1%
add-sqr-sqrt97.4%
metadata-eval97.4%
associate-/r*97.4%
*-commutative97.4%
add-sqr-sqrt97.2%
associate-/r*97.2%
sqrt-prod97.3%
metadata-eval97.3%
*-commutative97.3%
associate-/r*97.3%
metadata-eval97.3%
sqrt-prod97.2%
metadata-eval97.2%
Applied egg-rr97.2%
associate-/l/97.2%
*-commutative97.2%
associate-*l*97.3%
rem-square-sqrt97.5%
*-commutative97.5%
Simplified97.5%
Final simplification94.5%
(FPCore (x y) :precision binary64 (if (or (<= y -1.85e+24) (not (<= y 7.2e+52))) (+ 1.0 (* -0.3333333333333333 (/ y (sqrt x)))) (- 1.0 (/ 0.3333333333333333 (* x 3.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.85e+24) || !(y <= 7.2e+52)) {
tmp = 1.0 + (-0.3333333333333333 * (y / sqrt(x)));
} else {
tmp = 1.0 - (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 <= (-1.85d+24)) .or. (.not. (y <= 7.2d+52))) then
tmp = 1.0d0 + ((-0.3333333333333333d0) * (y / sqrt(x)))
else
tmp = 1.0d0 - (0.3333333333333333d0 / (x * 3.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.85e+24) || !(y <= 7.2e+52)) {
tmp = 1.0 + (-0.3333333333333333 * (y / Math.sqrt(x)));
} else {
tmp = 1.0 - (0.3333333333333333 / (x * 3.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.85e+24) or not (y <= 7.2e+52): tmp = 1.0 + (-0.3333333333333333 * (y / math.sqrt(x))) else: tmp = 1.0 - (0.3333333333333333 / (x * 3.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.85e+24) || !(y <= 7.2e+52)) tmp = Float64(1.0 + Float64(-0.3333333333333333 * Float64(y / sqrt(x)))); else tmp = Float64(1.0 - Float64(0.3333333333333333 / Float64(x * 3.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.85e+24) || ~((y <= 7.2e+52))) tmp = 1.0 + (-0.3333333333333333 * (y / sqrt(x))); else tmp = 1.0 - (0.3333333333333333 / (x * 3.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.85e+24], N[Not[LessEqual[y, 7.2e+52]], $MachinePrecision]], N[(1.0 + N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(0.3333333333333333 / N[(x * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \cdot 10^{+24} \lor \neg \left(y \leq 7.2 \cdot 10^{+52}\right):\\
\;\;\;\;1 + -0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{0.3333333333333333}{x \cdot 3}\\
\end{array}
\end{array}
if y < -1.85e24 or 7.2e52 < y Initial program 99.5%
sub-neg99.5%
*-commutative99.5%
associate-/r*99.4%
metadata-eval99.4%
distribute-frac-neg99.4%
neg-mul-199.4%
times-frac99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 90.2%
if -1.85e24 < y < 7.2e52Initial program 99.7%
associate--l-99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
distribute-frac-neg99.7%
sub-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
fmm-def99.7%
associate-/r*99.7%
metadata-eval99.7%
*-commutative99.7%
associate-/r*99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 97.4%
associate-*r/97.4%
metadata-eval97.4%
Simplified97.4%
expm1-log1p-u93.3%
expm1-undefine93.3%
log1p-undefine93.3%
add-exp-log97.4%
add-sqr-sqrt97.1%
sqrt-unprod76.4%
frac-times76.5%
metadata-eval76.5%
metadata-eval76.5%
frac-times76.4%
sqrt-unprod0.0%
add-sqr-sqrt43.3%
Applied egg-rr43.3%
+-commutative43.3%
associate--l+43.3%
metadata-eval43.3%
Simplified43.3%
+-rgt-identity43.3%
add-sqr-sqrt0.0%
sqrt-unprod76.5%
frac-times76.5%
metadata-eval76.5%
metadata-eval76.5%
frac-times76.5%
sqrt-unprod97.1%
add-sqr-sqrt97.4%
metadata-eval97.4%
associate-/r*97.4%
*-commutative97.4%
add-sqr-sqrt97.2%
associate-/r*97.2%
sqrt-prod97.3%
metadata-eval97.3%
*-commutative97.3%
associate-/r*97.3%
metadata-eval97.3%
sqrt-prod97.2%
metadata-eval97.2%
Applied egg-rr97.2%
associate-/l/97.2%
*-commutative97.2%
associate-*l*97.3%
rem-square-sqrt97.5%
*-commutative97.5%
Simplified97.5%
Final simplification94.5%
(FPCore (x y)
:precision binary64
(if (<= y -9.6e+26)
(* -0.3333333333333333 (/ y (sqrt x)))
(if (<= y 1.4e+59)
(- 1.0 (/ 0.3333333333333333 (* x 3.0)))
(* -0.3333333333333333 (* y (sqrt (/ 1.0 x)))))))
double code(double x, double y) {
double tmp;
if (y <= -9.6e+26) {
tmp = -0.3333333333333333 * (y / sqrt(x));
} else if (y <= 1.4e+59) {
tmp = 1.0 - (0.3333333333333333 / (x * 3.0));
} else {
tmp = -0.3333333333333333 * (y * sqrt((1.0 / 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.6d+26)) then
tmp = (-0.3333333333333333d0) * (y / sqrt(x))
else if (y <= 1.4d+59) then
tmp = 1.0d0 - (0.3333333333333333d0 / (x * 3.0d0))
else
tmp = (-0.3333333333333333d0) * (y * sqrt((1.0d0 / x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -9.6e+26) {
tmp = -0.3333333333333333 * (y / Math.sqrt(x));
} else if (y <= 1.4e+59) {
tmp = 1.0 - (0.3333333333333333 / (x * 3.0));
} else {
tmp = -0.3333333333333333 * (y * Math.sqrt((1.0 / x)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -9.6e+26: tmp = -0.3333333333333333 * (y / math.sqrt(x)) elif y <= 1.4e+59: tmp = 1.0 - (0.3333333333333333 / (x * 3.0)) else: tmp = -0.3333333333333333 * (y * math.sqrt((1.0 / x))) return tmp
function code(x, y) tmp = 0.0 if (y <= -9.6e+26) tmp = Float64(-0.3333333333333333 * Float64(y / sqrt(x))); elseif (y <= 1.4e+59) tmp = Float64(1.0 - Float64(0.3333333333333333 / Float64(x * 3.0))); else tmp = Float64(-0.3333333333333333 * Float64(y * sqrt(Float64(1.0 / x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -9.6e+26) tmp = -0.3333333333333333 * (y / sqrt(x)); elseif (y <= 1.4e+59) tmp = 1.0 - (0.3333333333333333 / (x * 3.0)); else tmp = -0.3333333333333333 * (y * sqrt((1.0 / x))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -9.6e+26], N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+59], N[(1.0 - N[(0.3333333333333333 / N[(x * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(y * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.6 \cdot 10^{+26}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+59}:\\
\;\;\;\;1 - \frac{0.3333333333333333}{x \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \left(y \cdot \sqrt{\frac{1}{x}}\right)\\
\end{array}
\end{array}
if y < -9.60000000000000018e26Initial program 99.5%
associate--l-99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
distribute-frac-neg99.5%
sub-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-/l*99.5%
fmm-def99.5%
associate-/r*99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.4%
distribute-neg-frac99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 82.5%
Taylor expanded in x around inf 69.2%
*-un-lft-identity69.2%
add-sqr-sqrt69.2%
times-frac69.1%
*-commutative69.1%
associate-*r*69.2%
Applied egg-rr69.2%
associate-*l/69.3%
*-lft-identity69.3%
associate-*l*69.2%
associate-*r/69.2%
associate-/l*69.3%
associate-/l*77.4%
*-inverses77.4%
*-rgt-identity77.4%
Simplified77.4%
if -9.60000000000000018e26 < y < 1.3999999999999999e59Initial program 99.7%
associate--l-99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
distribute-frac-neg99.7%
sub-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
fmm-def99.7%
associate-/r*99.7%
metadata-eval99.7%
*-commutative99.7%
associate-/r*99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 97.4%
associate-*r/97.4%
metadata-eval97.4%
Simplified97.4%
expm1-log1p-u93.3%
expm1-undefine93.3%
log1p-undefine93.3%
add-exp-log97.4%
add-sqr-sqrt97.1%
sqrt-unprod76.4%
frac-times76.5%
metadata-eval76.5%
metadata-eval76.5%
frac-times76.4%
sqrt-unprod0.0%
add-sqr-sqrt43.3%
Applied egg-rr43.3%
+-commutative43.3%
associate--l+43.3%
metadata-eval43.3%
Simplified43.3%
+-rgt-identity43.3%
add-sqr-sqrt0.0%
sqrt-unprod76.5%
frac-times76.5%
metadata-eval76.5%
metadata-eval76.5%
frac-times76.5%
sqrt-unprod97.1%
add-sqr-sqrt97.4%
metadata-eval97.4%
associate-/r*97.4%
*-commutative97.4%
add-sqr-sqrt97.2%
associate-/r*97.2%
sqrt-prod97.3%
metadata-eval97.3%
*-commutative97.3%
associate-/r*97.3%
metadata-eval97.3%
sqrt-prod97.2%
metadata-eval97.2%
Applied egg-rr97.2%
associate-/l/97.2%
*-commutative97.2%
associate-*l*97.3%
rem-square-sqrt97.5%
*-commutative97.5%
Simplified97.5%
if 1.3999999999999999e59 < y Initial program 99.4%
associate--l-99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
distribute-frac-neg99.4%
sub-neg99.4%
neg-mul-199.4%
*-commutative99.4%
associate-/l*99.3%
fmm-def99.3%
associate-/r*99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.3%
distribute-neg-frac99.3%
metadata-eval99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around inf 90.3%
Final simplification91.6%
(FPCore (x y) :precision binary64 (if (or (<= y -9.6e+26) (not (<= y 7.8e+58))) (* -0.3333333333333333 (/ y (sqrt x))) (- 1.0 (/ 0.3333333333333333 (* x 3.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -9.6e+26) || !(y <= 7.8e+58)) {
tmp = -0.3333333333333333 * (y / sqrt(x));
} else {
tmp = 1.0 - (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 <= (-9.6d+26)) .or. (.not. (y <= 7.8d+58))) then
tmp = (-0.3333333333333333d0) * (y / sqrt(x))
else
tmp = 1.0d0 - (0.3333333333333333d0 / (x * 3.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -9.6e+26) || !(y <= 7.8e+58)) {
tmp = -0.3333333333333333 * (y / Math.sqrt(x));
} else {
tmp = 1.0 - (0.3333333333333333 / (x * 3.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -9.6e+26) or not (y <= 7.8e+58): tmp = -0.3333333333333333 * (y / math.sqrt(x)) else: tmp = 1.0 - (0.3333333333333333 / (x * 3.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -9.6e+26) || !(y <= 7.8e+58)) tmp = Float64(-0.3333333333333333 * Float64(y / sqrt(x))); else tmp = Float64(1.0 - Float64(0.3333333333333333 / Float64(x * 3.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -9.6e+26) || ~((y <= 7.8e+58))) tmp = -0.3333333333333333 * (y / sqrt(x)); else tmp = 1.0 - (0.3333333333333333 / (x * 3.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -9.6e+26], N[Not[LessEqual[y, 7.8e+58]], $MachinePrecision]], N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(0.3333333333333333 / N[(x * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.6 \cdot 10^{+26} \lor \neg \left(y \leq 7.8 \cdot 10^{+58}\right):\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{0.3333333333333333}{x \cdot 3}\\
\end{array}
\end{array}
if y < -9.60000000000000018e26 or 7.8000000000000002e58 < y Initial program 99.5%
associate--l-99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
distribute-frac-neg99.5%
sub-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-/l*99.4%
fmm-def99.4%
associate-/r*99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.4%
distribute-neg-frac99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 82.5%
Taylor expanded in x around inf 73.3%
*-un-lft-identity73.3%
add-sqr-sqrt73.2%
times-frac73.0%
*-commutative73.0%
associate-*r*73.2%
Applied egg-rr73.2%
associate-*l/73.2%
*-lft-identity73.2%
associate-*l*73.1%
associate-*r/73.2%
associate-/l*73.3%
associate-/l*83.2%
*-inverses83.2%
*-rgt-identity83.2%
Simplified83.2%
if -9.60000000000000018e26 < y < 7.8000000000000002e58Initial program 99.7%
associate--l-99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
distribute-frac-neg99.7%
sub-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
fmm-def99.7%
associate-/r*99.7%
metadata-eval99.7%
*-commutative99.7%
associate-/r*99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 97.4%
associate-*r/97.4%
metadata-eval97.4%
Simplified97.4%
expm1-log1p-u93.3%
expm1-undefine93.3%
log1p-undefine93.3%
add-exp-log97.4%
add-sqr-sqrt97.1%
sqrt-unprod76.4%
frac-times76.5%
metadata-eval76.5%
metadata-eval76.5%
frac-times76.4%
sqrt-unprod0.0%
add-sqr-sqrt43.3%
Applied egg-rr43.3%
+-commutative43.3%
associate--l+43.3%
metadata-eval43.3%
Simplified43.3%
+-rgt-identity43.3%
add-sqr-sqrt0.0%
sqrt-unprod76.5%
frac-times76.5%
metadata-eval76.5%
metadata-eval76.5%
frac-times76.5%
sqrt-unprod97.1%
add-sqr-sqrt97.4%
metadata-eval97.4%
associate-/r*97.4%
*-commutative97.4%
add-sqr-sqrt97.2%
associate-/r*97.2%
sqrt-prod97.3%
metadata-eval97.3%
*-commutative97.3%
associate-/r*97.3%
metadata-eval97.3%
sqrt-prod97.2%
metadata-eval97.2%
Applied egg-rr97.2%
associate-/l/97.2%
*-commutative97.2%
associate-*l*97.3%
rem-square-sqrt97.5%
*-commutative97.5%
Simplified97.5%
Final simplification91.6%
(FPCore (x y) :precision binary64 (if (<= x 0.112) (/ (- (* -0.3333333333333333 (* y (sqrt x))) 0.1111111111111111) x) (- 1.0 (/ y (sqrt (* x 9.0))))))
double code(double x, double y) {
double tmp;
if (x <= 0.112) {
tmp = ((-0.3333333333333333 * (y * sqrt(x))) - 0.1111111111111111) / x;
} else {
tmp = 1.0 - (y / sqrt((x * 9.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.112d0) then
tmp = (((-0.3333333333333333d0) * (y * sqrt(x))) - 0.1111111111111111d0) / x
else
tmp = 1.0d0 - (y / sqrt((x * 9.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 0.112) {
tmp = ((-0.3333333333333333 * (y * Math.sqrt(x))) - 0.1111111111111111) / x;
} else {
tmp = 1.0 - (y / Math.sqrt((x * 9.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.112: tmp = ((-0.3333333333333333 * (y * math.sqrt(x))) - 0.1111111111111111) / x else: tmp = 1.0 - (y / math.sqrt((x * 9.0))) return tmp
function code(x, y) tmp = 0.0 if (x <= 0.112) tmp = Float64(Float64(Float64(-0.3333333333333333 * Float64(y * sqrt(x))) - 0.1111111111111111) / x); else tmp = Float64(1.0 - Float64(y / sqrt(Float64(x * 9.0)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 0.112) tmp = ((-0.3333333333333333 * (y * sqrt(x))) - 0.1111111111111111) / x; else tmp = 1.0 - (y / sqrt((x * 9.0))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.112], N[(N[(N[(-0.3333333333333333 * N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.1111111111111111), $MachinePrecision] / x), $MachinePrecision], N[(1.0 - N[(y / N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.112:\\
\;\;\;\;\frac{-0.3333333333333333 \cdot \left(y \cdot \sqrt{x}\right) - 0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{\sqrt{x \cdot 9}}\\
\end{array}
\end{array}
if x < 0.112000000000000002Initial program 99.4%
associate--l-99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
distribute-frac-neg99.4%
sub-neg99.4%
neg-mul-199.4%
*-commutative99.4%
associate-/l*99.4%
fmm-def99.4%
associate-/r*99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.4%
distribute-neg-frac99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 97.3%
if 0.112000000000000002 < x Initial program 99.8%
*-commutative99.8%
metadata-eval99.8%
sqrt-prod99.9%
pow1/299.9%
Applied egg-rr99.9%
unpow1/299.9%
Simplified99.9%
Taylor expanded in x around inf 98.7%
Final simplification97.9%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ y (sqrt (* x 9.0))))) (if (<= x 0.112) (- (/ -0.1111111111111111 x) t_0) (- 1.0 t_0))))
double code(double x, double y) {
double t_0 = y / sqrt((x * 9.0));
double tmp;
if (x <= 0.112) {
tmp = (-0.1111111111111111 / x) - t_0;
} else {
tmp = 1.0 - 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 = y / sqrt((x * 9.0d0))
if (x <= 0.112d0) then
tmp = ((-0.1111111111111111d0) / x) - t_0
else
tmp = 1.0d0 - t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / Math.sqrt((x * 9.0));
double tmp;
if (x <= 0.112) {
tmp = (-0.1111111111111111 / x) - t_0;
} else {
tmp = 1.0 - t_0;
}
return tmp;
}
def code(x, y): t_0 = y / math.sqrt((x * 9.0)) tmp = 0 if x <= 0.112: tmp = (-0.1111111111111111 / x) - t_0 else: tmp = 1.0 - t_0 return tmp
function code(x, y) t_0 = Float64(y / sqrt(Float64(x * 9.0))) tmp = 0.0 if (x <= 0.112) tmp = Float64(Float64(-0.1111111111111111 / x) - t_0); else tmp = Float64(1.0 - t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = y / sqrt((x * 9.0)); tmp = 0.0; if (x <= 0.112) tmp = (-0.1111111111111111 / x) - t_0; else tmp = 1.0 - t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 0.112], N[(N[(-0.1111111111111111 / x), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{\sqrt{x \cdot 9}}\\
\mathbf{if}\;x \leq 0.112:\\
\;\;\;\;\frac{-0.1111111111111111}{x} - t\_0\\
\mathbf{else}:\\
\;\;\;\;1 - t\_0\\
\end{array}
\end{array}
if x < 0.112000000000000002Initial program 99.4%
*-commutative99.4%
metadata-eval99.4%
sqrt-prod99.5%
pow1/299.5%
Applied egg-rr99.5%
unpow1/299.5%
Simplified99.5%
Taylor expanded in x around 0 97.3%
if 0.112000000000000002 < x Initial program 99.8%
*-commutative99.8%
metadata-eval99.8%
sqrt-prod99.9%
pow1/299.9%
Applied egg-rr99.9%
unpow1/299.9%
Simplified99.9%
Taylor expanded in x around inf 98.7%
(FPCore (x y) :precision binary64 (+ (- 1.0 (/ 0.1111111111111111 x)) (* -0.3333333333333333 (/ y (sqrt x)))))
double code(double x, double y) {
return (1.0 - (0.1111111111111111 / x)) + (-0.3333333333333333 * (y / sqrt(x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 - (0.1111111111111111d0 / x)) + ((-0.3333333333333333d0) * (y / sqrt(x)))
end function
public static double code(double x, double y) {
return (1.0 - (0.1111111111111111 / x)) + (-0.3333333333333333 * (y / Math.sqrt(x)));
}
def code(x, y): return (1.0 - (0.1111111111111111 / x)) + (-0.3333333333333333 * (y / math.sqrt(x)))
function code(x, y) return Float64(Float64(1.0 - Float64(0.1111111111111111 / x)) + Float64(-0.3333333333333333 * Float64(y / sqrt(x)))) end
function tmp = code(x, y) tmp = (1.0 - (0.1111111111111111 / x)) + (-0.3333333333333333 * (y / sqrt(x))); end
code[x_, y_] := N[(N[(1.0 - N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision] + N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - \frac{0.1111111111111111}{x}\right) + -0.3333333333333333 \cdot \frac{y}{\sqrt{x}}
\end{array}
Initial program 99.6%
sub-neg99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
distribute-frac-neg99.6%
neg-mul-199.6%
times-frac99.6%
metadata-eval99.6%
Simplified99.6%
(FPCore (x y) :precision binary64 (if (<= x 0.112) (/ -0.1111111111111111 x) 1.0))
double code(double x, double y) {
double tmp;
if (x <= 0.112) {
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 <= 0.112d0) 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 <= 0.112) {
tmp = -0.1111111111111111 / x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.112: tmp = -0.1111111111111111 / x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= 0.112) tmp = Float64(-0.1111111111111111 / x); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 0.112) tmp = -0.1111111111111111 / x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.112], N[(-0.1111111111111111 / x), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.112:\\
\;\;\;\;\frac{-0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < 0.112000000000000002Initial program 99.4%
associate--l-99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
distribute-frac-neg99.4%
sub-neg99.4%
neg-mul-199.4%
*-commutative99.4%
associate-/l*99.4%
fmm-def99.4%
associate-/r*99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.4%
distribute-neg-frac99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 97.3%
Taylor expanded in y around 0 63.0%
if 0.112000000000000002 < x Initial program 99.8%
associate--l-99.8%
sub-neg99.8%
+-commutative99.8%
distribute-neg-in99.8%
distribute-frac-neg99.8%
sub-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-/l*99.8%
fmm-def99.8%
associate-/r*99.8%
metadata-eval99.8%
*-commutative99.8%
associate-/r*99.8%
distribute-neg-frac99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 61.4%
associate-*r/61.4%
metadata-eval61.4%
Simplified61.4%
Taylor expanded in x around inf 60.2%
(FPCore (x y) :precision binary64 (- 1.0 (/ 0.3333333333333333 (* x 3.0))))
double code(double x, double y) {
return 1.0 - (0.3333333333333333 / (x * 3.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 - (0.3333333333333333d0 / (x * 3.0d0))
end function
public static double code(double x, double y) {
return 1.0 - (0.3333333333333333 / (x * 3.0));
}
def code(x, y): return 1.0 - (0.3333333333333333 / (x * 3.0))
function code(x, y) return Float64(1.0 - Float64(0.3333333333333333 / Float64(x * 3.0))) end
function tmp = code(x, y) tmp = 1.0 - (0.3333333333333333 / (x * 3.0)); end
code[x_, y_] := N[(1.0 - N[(0.3333333333333333 / N[(x * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{0.3333333333333333}{x \cdot 3}
\end{array}
Initial program 99.6%
associate--l-99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
distribute-frac-neg99.6%
sub-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-/l*99.6%
fmm-def99.6%
associate-/r*99.6%
metadata-eval99.6%
*-commutative99.6%
associate-/r*99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 63.4%
associate-*r/63.4%
metadata-eval63.4%
Simplified63.4%
expm1-log1p-u60.7%
expm1-undefine60.7%
log1p-undefine60.7%
add-exp-log63.4%
add-sqr-sqrt63.2%
sqrt-unprod49.5%
frac-times49.5%
metadata-eval49.5%
metadata-eval49.5%
frac-times49.5%
sqrt-unprod0.0%
add-sqr-sqrt28.9%
Applied egg-rr28.9%
+-commutative28.9%
associate--l+28.9%
metadata-eval28.9%
Simplified28.9%
+-rgt-identity28.9%
add-sqr-sqrt0.0%
sqrt-unprod49.5%
frac-times49.5%
metadata-eval49.5%
metadata-eval49.5%
frac-times49.5%
sqrt-unprod63.2%
add-sqr-sqrt63.4%
metadata-eval63.4%
associate-/r*63.4%
*-commutative63.4%
add-sqr-sqrt63.2%
associate-/r*63.3%
sqrt-prod63.3%
metadata-eval63.3%
*-commutative63.3%
associate-/r*63.3%
metadata-eval63.3%
sqrt-prod63.3%
metadata-eval63.3%
Applied egg-rr63.3%
associate-/l/63.2%
*-commutative63.2%
associate-*l*63.3%
rem-square-sqrt63.4%
*-commutative63.4%
Simplified63.4%
(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.6%
associate--l-99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
distribute-frac-neg99.6%
sub-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-/l*99.6%
fmm-def99.6%
associate-/r*99.6%
metadata-eval99.6%
*-commutative99.6%
associate-/r*99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 63.4%
associate-*r/63.4%
metadata-eval63.4%
Simplified63.4%
(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.6%
associate--l-99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
distribute-frac-neg99.6%
sub-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-/l*99.6%
fmm-def99.6%
associate-/r*99.6%
metadata-eval99.6%
*-commutative99.6%
associate-/r*99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 63.4%
associate-*r/63.4%
metadata-eval63.4%
Simplified63.4%
Taylor expanded in x around inf 28.7%
(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 2024180
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, D"
:precision binary64
:alt
(! :herbie-platform default (- (- 1 (/ (/ 1 x) 9)) (/ y (* 3 (sqrt x)))))
(- (- 1.0 (/ 1.0 (* x 9.0))) (/ y (* 3.0 (sqrt x)))))