
(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 (* 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}
Initial program 99.7%
Final simplification99.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* y (/ -0.1111111111111111 (* x y)))))
(if (<= x 7.6e-227)
(/ y (* (sqrt x) -3.0))
(if (<= x 8.5e-149)
t_0
(if (<= x 2.1e-106)
(* y (* -0.3333333333333333 (sqrt (/ 1.0 x))))
(if (<= x 1.85e-22) t_0 (- 1.0 (/ y (* 3.0 (sqrt x))))))))))
double code(double x, double y) {
double t_0 = y * (-0.1111111111111111 / (x * y));
double tmp;
if (x <= 7.6e-227) {
tmp = y / (sqrt(x) * -3.0);
} else if (x <= 8.5e-149) {
tmp = t_0;
} else if (x <= 2.1e-106) {
tmp = y * (-0.3333333333333333 * sqrt((1.0 / x)));
} else if (x <= 1.85e-22) {
tmp = t_0;
} else {
tmp = 1.0 - (y / (3.0 * sqrt(x)));
}
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 * ((-0.1111111111111111d0) / (x * y))
if (x <= 7.6d-227) then
tmp = y / (sqrt(x) * (-3.0d0))
else if (x <= 8.5d-149) then
tmp = t_0
else if (x <= 2.1d-106) then
tmp = y * ((-0.3333333333333333d0) * sqrt((1.0d0 / x)))
else if (x <= 1.85d-22) then
tmp = t_0
else
tmp = 1.0d0 - (y / (3.0d0 * sqrt(x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y * (-0.1111111111111111 / (x * y));
double tmp;
if (x <= 7.6e-227) {
tmp = y / (Math.sqrt(x) * -3.0);
} else if (x <= 8.5e-149) {
tmp = t_0;
} else if (x <= 2.1e-106) {
tmp = y * (-0.3333333333333333 * Math.sqrt((1.0 / x)));
} else if (x <= 1.85e-22) {
tmp = t_0;
} else {
tmp = 1.0 - (y / (3.0 * Math.sqrt(x)));
}
return tmp;
}
def code(x, y): t_0 = y * (-0.1111111111111111 / (x * y)) tmp = 0 if x <= 7.6e-227: tmp = y / (math.sqrt(x) * -3.0) elif x <= 8.5e-149: tmp = t_0 elif x <= 2.1e-106: tmp = y * (-0.3333333333333333 * math.sqrt((1.0 / x))) elif x <= 1.85e-22: tmp = t_0 else: tmp = 1.0 - (y / (3.0 * math.sqrt(x))) return tmp
function code(x, y) t_0 = Float64(y * Float64(-0.1111111111111111 / Float64(x * y))) tmp = 0.0 if (x <= 7.6e-227) tmp = Float64(y / Float64(sqrt(x) * -3.0)); elseif (x <= 8.5e-149) tmp = t_0; elseif (x <= 2.1e-106) tmp = Float64(y * Float64(-0.3333333333333333 * sqrt(Float64(1.0 / x)))); elseif (x <= 1.85e-22) tmp = t_0; else tmp = Float64(1.0 - Float64(y / Float64(3.0 * sqrt(x)))); end return tmp end
function tmp_2 = code(x, y) t_0 = y * (-0.1111111111111111 / (x * y)); tmp = 0.0; if (x <= 7.6e-227) tmp = y / (sqrt(x) * -3.0); elseif (x <= 8.5e-149) tmp = t_0; elseif (x <= 2.1e-106) tmp = y * (-0.3333333333333333 * sqrt((1.0 / x))); elseif (x <= 1.85e-22) tmp = t_0; else tmp = 1.0 - (y / (3.0 * sqrt(x))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(-0.1111111111111111 / N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 7.6e-227], N[(y / N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.5e-149], t$95$0, If[LessEqual[x, 2.1e-106], N[(y * N[(-0.3333333333333333 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.85e-22], t$95$0, N[(1.0 - N[(y / N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{-0.1111111111111111}{x \cdot y}\\
\mathbf{if}\;x \leq 7.6 \cdot 10^{-227}:\\
\;\;\;\;\frac{y}{\sqrt{x} \cdot -3}\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-149}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-106}:\\
\;\;\;\;y \cdot \left(-0.3333333333333333 \cdot \sqrt{\frac{1}{x}}\right)\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-22}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{3 \cdot \sqrt{x}}\\
\end{array}
\end{array}
if x < 7.60000000000000019e-227Initial program 99.6%
sub-neg99.6%
*-commutative99.6%
associate-/r*99.5%
metadata-eval99.5%
distribute-frac-neg99.5%
neg-mul-199.5%
times-frac99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around inf 37.0%
Taylor expanded in y around inf 37.3%
*-commutative37.3%
associate-*l*37.3%
*-commutative37.3%
Simplified37.3%
*-commutative37.3%
sqrt-div37.3%
metadata-eval37.3%
un-div-inv37.3%
*-commutative37.3%
Applied egg-rr37.3%
associate-/l*37.3%
Simplified37.3%
clear-num37.3%
un-div-inv37.3%
div-inv37.4%
metadata-eval37.4%
Applied egg-rr37.4%
if 7.60000000000000019e-227 < x < 8.5000000000000006e-149 or 2.10000000000000003e-106 < x < 1.85e-22Initial program 99.6%
sub-neg99.6%
*-commutative99.6%
associate-/r*99.5%
metadata-eval99.5%
distribute-frac-neg99.5%
neg-mul-199.5%
times-frac99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 99.4%
Taylor expanded in y around inf 84.2%
associate-*r/84.4%
metadata-eval84.4%
Simplified84.4%
Taylor expanded in x around 0 99.3%
associate-/l*84.2%
*-commutative84.2%
associate-*r/84.3%
metadata-eval84.3%
Simplified84.3%
Taylor expanded in y around 0 63.8%
if 8.5000000000000006e-149 < x < 2.10000000000000003e-106Initial program 99.3%
Taylor expanded in x around 0 99.4%
add-sqr-sqrt99.3%
pow299.3%
Applied egg-rr99.3%
Taylor expanded in y around inf 73.7%
*-commutative73.7%
*-commutative73.7%
associate-*l*73.9%
Simplified73.9%
if 1.85e-22 < x Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in x around inf 95.7%
Final simplification77.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* y (/ -0.1111111111111111 (* x y)))))
(if (<= x 6.8e-227)
(/ y (* (sqrt x) -3.0))
(if (<= x 1.05e-148)
t_0
(if (<= x 1.4e-106)
(* y (* -0.3333333333333333 (sqrt (/ 1.0 x))))
(if (<= x 1.7e-22)
t_0
(+ 1.0 (* -0.3333333333333333 (/ y (sqrt x))))))))))
double code(double x, double y) {
double t_0 = y * (-0.1111111111111111 / (x * y));
double tmp;
if (x <= 6.8e-227) {
tmp = y / (sqrt(x) * -3.0);
} else if (x <= 1.05e-148) {
tmp = t_0;
} else if (x <= 1.4e-106) {
tmp = y * (-0.3333333333333333 * sqrt((1.0 / x)));
} else if (x <= 1.7e-22) {
tmp = t_0;
} else {
tmp = 1.0 + (-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) :: t_0
real(8) :: tmp
t_0 = y * ((-0.1111111111111111d0) / (x * y))
if (x <= 6.8d-227) then
tmp = y / (sqrt(x) * (-3.0d0))
else if (x <= 1.05d-148) then
tmp = t_0
else if (x <= 1.4d-106) then
tmp = y * ((-0.3333333333333333d0) * sqrt((1.0d0 / x)))
else if (x <= 1.7d-22) then
tmp = t_0
else
tmp = 1.0d0 + ((-0.3333333333333333d0) * (y / sqrt(x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y * (-0.1111111111111111 / (x * y));
double tmp;
if (x <= 6.8e-227) {
tmp = y / (Math.sqrt(x) * -3.0);
} else if (x <= 1.05e-148) {
tmp = t_0;
} else if (x <= 1.4e-106) {
tmp = y * (-0.3333333333333333 * Math.sqrt((1.0 / x)));
} else if (x <= 1.7e-22) {
tmp = t_0;
} else {
tmp = 1.0 + (-0.3333333333333333 * (y / Math.sqrt(x)));
}
return tmp;
}
def code(x, y): t_0 = y * (-0.1111111111111111 / (x * y)) tmp = 0 if x <= 6.8e-227: tmp = y / (math.sqrt(x) * -3.0) elif x <= 1.05e-148: tmp = t_0 elif x <= 1.4e-106: tmp = y * (-0.3333333333333333 * math.sqrt((1.0 / x))) elif x <= 1.7e-22: tmp = t_0 else: tmp = 1.0 + (-0.3333333333333333 * (y / math.sqrt(x))) return tmp
function code(x, y) t_0 = Float64(y * Float64(-0.1111111111111111 / Float64(x * y))) tmp = 0.0 if (x <= 6.8e-227) tmp = Float64(y / Float64(sqrt(x) * -3.0)); elseif (x <= 1.05e-148) tmp = t_0; elseif (x <= 1.4e-106) tmp = Float64(y * Float64(-0.3333333333333333 * sqrt(Float64(1.0 / x)))); elseif (x <= 1.7e-22) tmp = t_0; else tmp = Float64(1.0 + Float64(-0.3333333333333333 * Float64(y / sqrt(x)))); end return tmp end
function tmp_2 = code(x, y) t_0 = y * (-0.1111111111111111 / (x * y)); tmp = 0.0; if (x <= 6.8e-227) tmp = y / (sqrt(x) * -3.0); elseif (x <= 1.05e-148) tmp = t_0; elseif (x <= 1.4e-106) tmp = y * (-0.3333333333333333 * sqrt((1.0 / x))); elseif (x <= 1.7e-22) tmp = t_0; else tmp = 1.0 + (-0.3333333333333333 * (y / sqrt(x))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(-0.1111111111111111 / N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 6.8e-227], N[(y / N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.05e-148], t$95$0, If[LessEqual[x, 1.4e-106], N[(y * N[(-0.3333333333333333 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.7e-22], t$95$0, N[(1.0 + N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{-0.1111111111111111}{x \cdot y}\\
\mathbf{if}\;x \leq 6.8 \cdot 10^{-227}:\\
\;\;\;\;\frac{y}{\sqrt{x} \cdot -3}\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-148}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-106}:\\
\;\;\;\;y \cdot \left(-0.3333333333333333 \cdot \sqrt{\frac{1}{x}}\right)\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-22}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1 + -0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\end{array}
\end{array}
if x < 6.79999999999999958e-227Initial program 99.6%
sub-neg99.6%
*-commutative99.6%
associate-/r*99.5%
metadata-eval99.5%
distribute-frac-neg99.5%
neg-mul-199.5%
times-frac99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around inf 37.0%
Taylor expanded in y around inf 37.3%
*-commutative37.3%
associate-*l*37.3%
*-commutative37.3%
Simplified37.3%
*-commutative37.3%
sqrt-div37.3%
metadata-eval37.3%
un-div-inv37.3%
*-commutative37.3%
Applied egg-rr37.3%
associate-/l*37.3%
Simplified37.3%
clear-num37.3%
un-div-inv37.3%
div-inv37.4%
metadata-eval37.4%
Applied egg-rr37.4%
if 6.79999999999999958e-227 < x < 1.05e-148 or 1.39999999999999994e-106 < x < 1.6999999999999999e-22Initial program 99.6%
sub-neg99.6%
*-commutative99.6%
associate-/r*99.5%
metadata-eval99.5%
distribute-frac-neg99.5%
neg-mul-199.5%
times-frac99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 99.4%
Taylor expanded in y around inf 84.2%
associate-*r/84.4%
metadata-eval84.4%
Simplified84.4%
Taylor expanded in x around 0 99.3%
associate-/l*84.2%
*-commutative84.2%
associate-*r/84.3%
metadata-eval84.3%
Simplified84.3%
Taylor expanded in y around 0 63.8%
if 1.05e-148 < x < 1.39999999999999994e-106Initial program 99.3%
Taylor expanded in x around 0 99.4%
add-sqr-sqrt99.3%
pow299.3%
Applied egg-rr99.3%
Taylor expanded in y around inf 73.7%
*-commutative73.7%
*-commutative73.7%
associate-*l*73.9%
Simplified73.9%
if 1.6999999999999999e-22 < x Initial program 99.9%
sub-neg99.9%
*-commutative99.9%
associate-/r*99.9%
metadata-eval99.9%
distribute-frac-neg99.9%
neg-mul-199.9%
times-frac99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf 95.6%
Final simplification77.6%
(FPCore (x y) :precision binary64 (if (or (<= y -1.3e+87) (not (<= y 4.3e+27))) (/ y (* (sqrt x) -3.0)) 1.0))
double code(double x, double y) {
double tmp;
if ((y <= -1.3e+87) || !(y <= 4.3e+27)) {
tmp = y / (sqrt(x) * -3.0);
} 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 ((y <= (-1.3d+87)) .or. (.not. (y <= 4.3d+27))) then
tmp = y / (sqrt(x) * (-3.0d0))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.3e+87) || !(y <= 4.3e+27)) {
tmp = y / (Math.sqrt(x) * -3.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.3e+87) or not (y <= 4.3e+27): tmp = y / (math.sqrt(x) * -3.0) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.3e+87) || !(y <= 4.3e+27)) tmp = Float64(y / Float64(sqrt(x) * -3.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.3e+87) || ~((y <= 4.3e+27))) tmp = y / (sqrt(x) * -3.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.3e+87], N[Not[LessEqual[y, 4.3e+27]], $MachinePrecision]], N[(y / N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+87} \lor \neg \left(y \leq 4.3 \cdot 10^{+27}\right):\\
\;\;\;\;\frac{y}{\sqrt{x} \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.29999999999999999e87 or 4.30000000000000008e27 < y Initial program 99.7%
sub-neg99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
times-frac99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 92.3%
Taylor expanded in y around inf 87.1%
*-commutative87.1%
associate-*l*87.1%
*-commutative87.1%
Simplified87.1%
*-commutative87.1%
sqrt-div87.0%
metadata-eval87.0%
un-div-inv87.0%
*-commutative87.0%
Applied egg-rr87.0%
associate-/l*87.0%
Simplified87.0%
clear-num87.0%
un-div-inv87.1%
div-inv87.3%
metadata-eval87.3%
Applied egg-rr87.3%
if -1.29999999999999999e87 < y < 4.30000000000000008e27Initial program 99.7%
sub-neg99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
times-frac99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 52.4%
Taylor expanded in y around 0 50.4%
Final simplification64.1%
(FPCore (x y) :precision binary64 (if (or (<= y -1.7e+87) (not (<= y 2.2e+27))) (* -0.3333333333333333 (/ y (sqrt x))) 1.0))
double code(double x, double y) {
double tmp;
if ((y <= -1.7e+87) || !(y <= 2.2e+27)) {
tmp = -0.3333333333333333 * (y / sqrt(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 ((y <= (-1.7d+87)) .or. (.not. (y <= 2.2d+27))) then
tmp = (-0.3333333333333333d0) * (y / sqrt(x))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.7e+87) || !(y <= 2.2e+27)) {
tmp = -0.3333333333333333 * (y / Math.sqrt(x));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.7e+87) or not (y <= 2.2e+27): tmp = -0.3333333333333333 * (y / math.sqrt(x)) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.7e+87) || !(y <= 2.2e+27)) tmp = Float64(-0.3333333333333333 * Float64(y / sqrt(x))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.7e+87) || ~((y <= 2.2e+27))) tmp = -0.3333333333333333 * (y / sqrt(x)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.7e+87], N[Not[LessEqual[y, 2.2e+27]], $MachinePrecision]], N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{+87} \lor \neg \left(y \leq 2.2 \cdot 10^{+27}\right):\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.7000000000000001e87 or 2.1999999999999999e27 < y Initial program 99.7%
Taylor expanded in x around 0 99.7%
add-sqr-sqrt99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 87.1%
*-commutative87.1%
*-commutative87.1%
Simplified87.1%
sqrt-div87.0%
metadata-eval87.0%
un-div-inv87.2%
Applied egg-rr87.2%
if -1.7000000000000001e87 < y < 2.1999999999999999e27Initial program 99.7%
sub-neg99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
times-frac99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 52.4%
Taylor expanded in y around 0 50.4%
Final simplification64.0%
(FPCore (x y) :precision binary64 (if (or (<= y -1.4e+87) (not (<= y 2.45e+27))) (* y (/ -0.3333333333333333 (sqrt x))) 1.0))
double code(double x, double y) {
double tmp;
if ((y <= -1.4e+87) || !(y <= 2.45e+27)) {
tmp = y * (-0.3333333333333333 / sqrt(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 ((y <= (-1.4d+87)) .or. (.not. (y <= 2.45d+27))) then
tmp = y * ((-0.3333333333333333d0) / sqrt(x))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.4e+87) || !(y <= 2.45e+27)) {
tmp = y * (-0.3333333333333333 / Math.sqrt(x));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.4e+87) or not (y <= 2.45e+27): tmp = y * (-0.3333333333333333 / math.sqrt(x)) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.4e+87) || !(y <= 2.45e+27)) tmp = Float64(y * Float64(-0.3333333333333333 / sqrt(x))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.4e+87) || ~((y <= 2.45e+27))) tmp = y * (-0.3333333333333333 / sqrt(x)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.4e+87], N[Not[LessEqual[y, 2.45e+27]], $MachinePrecision]], N[(y * N[(-0.3333333333333333 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+87} \lor \neg \left(y \leq 2.45 \cdot 10^{+27}\right):\\
\;\;\;\;y \cdot \frac{-0.3333333333333333}{\sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.40000000000000008e87 or 2.45000000000000007e27 < y Initial program 99.7%
sub-neg99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
times-frac99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 92.3%
Taylor expanded in y around inf 87.1%
*-commutative87.1%
associate-*l*87.1%
*-commutative87.1%
Simplified87.1%
*-commutative87.1%
sqrt-div87.0%
metadata-eval87.0%
un-div-inv87.0%
*-commutative87.0%
Applied egg-rr87.0%
associate-/l*87.0%
Simplified87.0%
if -1.40000000000000008e87 < y < 2.45000000000000007e27Initial program 99.7%
sub-neg99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
times-frac99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 52.4%
Taylor expanded in y around 0 50.4%
Final simplification64.0%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ y (* 3.0 (sqrt x))))) (if (<= x 0.105) (- (/ -0.1111111111111111 x) t_0) (- 1.0 t_0))))
double code(double x, double y) {
double t_0 = y / (3.0 * sqrt(x));
double tmp;
if (x <= 0.105) {
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 / (3.0d0 * sqrt(x))
if (x <= 0.105d0) 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 / (3.0 * Math.sqrt(x));
double tmp;
if (x <= 0.105) {
tmp = (-0.1111111111111111 / x) - t_0;
} else {
tmp = 1.0 - t_0;
}
return tmp;
}
def code(x, y): t_0 = y / (3.0 * math.sqrt(x)) tmp = 0 if x <= 0.105: tmp = (-0.1111111111111111 / x) - t_0 else: tmp = 1.0 - t_0 return tmp
function code(x, y) t_0 = Float64(y / Float64(3.0 * sqrt(x))) tmp = 0.0 if (x <= 0.105) 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 / (3.0 * sqrt(x)); tmp = 0.0; if (x <= 0.105) 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[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 0.105], 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}{3 \cdot \sqrt{x}}\\
\mathbf{if}\;x \leq 0.105:\\
\;\;\;\;\frac{-0.1111111111111111}{x} - t\_0\\
\mathbf{else}:\\
\;\;\;\;1 - t\_0\\
\end{array}
\end{array}
if x < 0.104999999999999996Initial program 99.6%
Taylor expanded in x around 0 99.5%
Taylor expanded in x around 0 97.9%
if 0.104999999999999996 < x Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in x around inf 99.2%
(FPCore (x y) :precision binary64 (if (<= x 0.112) (+ (* -0.3333333333333333 (/ y (sqrt x))) (/ -0.1111111111111111 x)) (- 1.0 (/ y (* 3.0 (sqrt x))))))
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 / (3.0 * sqrt(x)));
}
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 / (3.0d0 * sqrt(x)))
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 / (3.0 * Math.sqrt(x)));
}
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 / (3.0 * math.sqrt(x))) return tmp
function code(x, y) tmp = 0.0 if (x <= 0.112) tmp = Float64(Float64(-0.3333333333333333 * Float64(y / sqrt(x))) + Float64(-0.1111111111111111 / x)); else tmp = Float64(1.0 - Float64(y / Float64(3.0 * sqrt(x)))); 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 / (3.0 * sqrt(x))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.112], N[(N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(y / N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.112:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{\sqrt{x}} + \frac{-0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{3 \cdot \sqrt{x}}\\
\end{array}
\end{array}
if x < 0.112000000000000002Initial program 99.6%
sub-neg99.6%
*-commutative99.6%
associate-/r*99.5%
metadata-eval99.5%
distribute-frac-neg99.5%
neg-mul-199.5%
times-frac99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 97.8%
if 0.112000000000000002 < x Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in x around inf 99.2%
Final simplification98.5%
(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%
Taylor expanded in x around 0 99.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.7%
sub-neg99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
times-frac99.6%
metadata-eval99.6%
Simplified99.6%
(FPCore (x y) :precision binary64 (if (<= x 216000.0) (* y (/ -0.1111111111111111 (* x y))) 1.0))
double code(double x, double y) {
double tmp;
if (x <= 216000.0) {
tmp = y * (-0.1111111111111111 / (x * y));
} 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 <= 216000.0d0) then
tmp = y * ((-0.1111111111111111d0) / (x * y))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 216000.0) {
tmp = y * (-0.1111111111111111 / (x * y));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 216000.0: tmp = y * (-0.1111111111111111 / (x * y)) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= 216000.0) tmp = Float64(y * Float64(-0.1111111111111111 / Float64(x * y))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 216000.0) tmp = y * (-0.1111111111111111 / (x * y)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 216000.0], N[(y * N[(-0.1111111111111111 / N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 216000:\\
\;\;\;\;y \cdot \frac{-0.1111111111111111}{x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < 216000Initial program 99.6%
sub-neg99.6%
*-commutative99.6%
associate-/r*99.5%
metadata-eval99.5%
distribute-frac-neg99.5%
neg-mul-199.5%
times-frac99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 97.8%
Taylor expanded in y around inf 77.5%
associate-*r/77.6%
metadata-eval77.6%
Simplified77.6%
Taylor expanded in x around 0 97.8%
associate-/l*77.5%
*-commutative77.5%
associate-*r/77.5%
metadata-eval77.5%
Simplified77.5%
Taylor expanded in y around 0 42.9%
if 216000 < x Initial program 99.9%
sub-neg99.9%
*-commutative99.9%
associate-/r*99.9%
metadata-eval99.9%
distribute-frac-neg99.9%
neg-mul-199.9%
times-frac99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf 99.1%
Taylor expanded in y around 0 66.5%
(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%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
times-frac99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 67.2%
Taylor expanded in y around 0 34.0%
(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 2024146
(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)))))