
(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 9 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%
associate--l-99.7%
+-commutative99.7%
+-commutative99.7%
associate-/r*99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y)
:precision binary64
(if (<= y -8e+25)
(+ 1.0 (* -0.3333333333333333 (/ y (sqrt x))))
(if (<= y 9.8e+60)
(+ 1.0 (/ -0.1111111111111111 x))
(+ 1.0 (* y (* -0.3333333333333333 (pow x -0.5)))))))
double code(double x, double y) {
double tmp;
if (y <= -8e+25) {
tmp = 1.0 + (-0.3333333333333333 * (y / sqrt(x)));
} else if (y <= 9.8e+60) {
tmp = 1.0 + (-0.1111111111111111 / x);
} else {
tmp = 1.0 + (y * (-0.3333333333333333 * pow(x, -0.5)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-8d+25)) then
tmp = 1.0d0 + ((-0.3333333333333333d0) * (y / sqrt(x)))
else if (y <= 9.8d+60) then
tmp = 1.0d0 + ((-0.1111111111111111d0) / x)
else
tmp = 1.0d0 + (y * ((-0.3333333333333333d0) * (x ** (-0.5d0))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -8e+25) {
tmp = 1.0 + (-0.3333333333333333 * (y / Math.sqrt(x)));
} else if (y <= 9.8e+60) {
tmp = 1.0 + (-0.1111111111111111 / x);
} else {
tmp = 1.0 + (y * (-0.3333333333333333 * Math.pow(x, -0.5)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -8e+25: tmp = 1.0 + (-0.3333333333333333 * (y / math.sqrt(x))) elif y <= 9.8e+60: tmp = 1.0 + (-0.1111111111111111 / x) else: tmp = 1.0 + (y * (-0.3333333333333333 * math.pow(x, -0.5))) return tmp
function code(x, y) tmp = 0.0 if (y <= -8e+25) tmp = Float64(1.0 + Float64(-0.3333333333333333 * Float64(y / sqrt(x)))); elseif (y <= 9.8e+60) tmp = Float64(1.0 + Float64(-0.1111111111111111 / x)); else tmp = Float64(1.0 + Float64(y * Float64(-0.3333333333333333 * (x ^ -0.5)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -8e+25) tmp = 1.0 + (-0.3333333333333333 * (y / sqrt(x))); elseif (y <= 9.8e+60) tmp = 1.0 + (-0.1111111111111111 / x); else tmp = 1.0 + (y * (-0.3333333333333333 * (x ^ -0.5))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -8e+25], N[(1.0 + N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.8e+60], N[(1.0 + N[(-0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(-0.3333333333333333 * N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{+25}:\\
\;\;\;\;1 + -0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{+60}:\\
\;\;\;\;1 + \frac{-0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \left(-0.3333333333333333 \cdot {x}^{-0.5}\right)\\
\end{array}
\end{array}
if y < -8.00000000000000072e25Initial program 99.5%
associate--l-99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
distribute-neg-frac99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*r/99.4%
fma-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 y around inf 93.1%
associate-*r*93.1%
*-commutative93.1%
*-commutative93.1%
*-commutative93.1%
Simplified93.1%
sqrt-div93.1%
metadata-eval93.1%
frac-2neg93.1%
metadata-eval93.1%
Applied egg-rr93.1%
neg-mul-193.1%
associate-/r*93.1%
metadata-eval93.1%
Simplified93.1%
expm1-log1p-u87.4%
expm1-udef87.4%
associate-*l/87.4%
*-un-lft-identity87.4%
*-commutative87.4%
Applied egg-rr87.4%
expm1-def87.4%
expm1-log1p93.2%
associate-/l*93.0%
associate-/r/93.2%
metadata-eval93.2%
times-frac93.1%
*-commutative93.1%
*-commutative93.1%
times-frac93.2%
metadata-eval93.2%
Simplified93.2%
if -8.00000000000000072e25 < y < 9.8000000000000005e60Initial program 99.9%
*-commutative99.9%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 98.5%
cancel-sign-sub-inv98.5%
metadata-eval98.5%
associate-*r/98.5%
metadata-eval98.5%
+-commutative98.5%
Simplified98.5%
if 9.8000000000000005e60 < y Initial program 99.4%
associate--l-99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
distribute-neg-frac99.4%
neg-mul-199.4%
*-commutative99.4%
associate-*r/99.5%
fma-def99.5%
associate-/r*99.5%
metadata-eval99.5%
*-commutative99.5%
associate-/r*99.5%
distribute-neg-frac99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in y around inf 96.0%
associate-*r*96.1%
*-commutative96.1%
*-commutative96.1%
*-commutative96.1%
Simplified96.1%
expm1-log1p-u2.1%
expm1-udef2.1%
*-commutative2.1%
*-commutative2.1%
inv-pow2.1%
sqrt-pow12.1%
metadata-eval2.1%
Applied egg-rr2.1%
expm1-def2.1%
expm1-log1p96.1%
associate-*l*96.2%
Simplified96.2%
Final simplification96.7%
(FPCore (x y) :precision binary64 (if (or (<= y -7.8e+25) (not (<= y 5.1e+60))) (+ 1.0 (* -0.3333333333333333 (/ y (sqrt x)))) (+ 1.0 (/ -0.1111111111111111 x))))
double code(double x, double y) {
double tmp;
if ((y <= -7.8e+25) || !(y <= 5.1e+60)) {
tmp = 1.0 + (-0.3333333333333333 * (y / sqrt(x)));
} else {
tmp = 1.0 + (-0.1111111111111111 / x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-7.8d+25)) .or. (.not. (y <= 5.1d+60))) then
tmp = 1.0d0 + ((-0.3333333333333333d0) * (y / sqrt(x)))
else
tmp = 1.0d0 + ((-0.1111111111111111d0) / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -7.8e+25) || !(y <= 5.1e+60)) {
tmp = 1.0 + (-0.3333333333333333 * (y / Math.sqrt(x)));
} else {
tmp = 1.0 + (-0.1111111111111111 / x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -7.8e+25) or not (y <= 5.1e+60): tmp = 1.0 + (-0.3333333333333333 * (y / math.sqrt(x))) else: tmp = 1.0 + (-0.1111111111111111 / x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -7.8e+25) || !(y <= 5.1e+60)) tmp = Float64(1.0 + Float64(-0.3333333333333333 * Float64(y / sqrt(x)))); else tmp = Float64(1.0 + Float64(-0.1111111111111111 / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -7.8e+25) || ~((y <= 5.1e+60))) tmp = 1.0 + (-0.3333333333333333 * (y / sqrt(x))); else tmp = 1.0 + (-0.1111111111111111 / x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -7.8e+25], N[Not[LessEqual[y, 5.1e+60]], $MachinePrecision]], N[(1.0 + N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{+25} \lor \neg \left(y \leq 5.1 \cdot 10^{+60}\right):\\
\;\;\;\;1 + -0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-0.1111111111111111}{x}\\
\end{array}
\end{array}
if y < -7.8000000000000004e25 or 5.09999999999999996e60 < y Initial program 99.5%
associate--l-99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
distribute-neg-frac99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*r/99.4%
fma-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 y around inf 94.3%
associate-*r*94.4%
*-commutative94.4%
*-commutative94.4%
*-commutative94.4%
Simplified94.4%
sqrt-div94.3%
metadata-eval94.3%
frac-2neg94.3%
metadata-eval94.3%
Applied egg-rr94.3%
neg-mul-194.3%
associate-/r*94.3%
metadata-eval94.3%
Simplified94.3%
expm1-log1p-u51.2%
expm1-udef51.2%
associate-*l/51.2%
*-un-lft-identity51.2%
*-commutative51.2%
Applied egg-rr51.2%
expm1-def51.2%
expm1-log1p94.4%
associate-/l*94.3%
associate-/r/94.4%
metadata-eval94.4%
times-frac94.3%
*-commutative94.3%
*-commutative94.3%
times-frac94.4%
metadata-eval94.4%
Simplified94.4%
if -7.8000000000000004e25 < y < 5.09999999999999996e60Initial program 99.9%
*-commutative99.9%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 98.5%
cancel-sign-sub-inv98.5%
metadata-eval98.5%
associate-*r/98.5%
metadata-eval98.5%
+-commutative98.5%
Simplified98.5%
Final simplification96.7%
(FPCore (x y)
:precision binary64
(if (<= y -5.8e+31)
(+ 1.0 (* -0.3333333333333333 (/ y (sqrt x))))
(if (<= y 2.05e+60)
(+ 1.0 (/ -0.1111111111111111 x))
(+ 1.0 (* y (/ -0.3333333333333333 (sqrt x)))))))
double code(double x, double y) {
double tmp;
if (y <= -5.8e+31) {
tmp = 1.0 + (-0.3333333333333333 * (y / sqrt(x)));
} else if (y <= 2.05e+60) {
tmp = 1.0 + (-0.1111111111111111 / x);
} else {
tmp = 1.0 + (y * (-0.3333333333333333 / sqrt(x)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-5.8d+31)) then
tmp = 1.0d0 + ((-0.3333333333333333d0) * (y / sqrt(x)))
else if (y <= 2.05d+60) then
tmp = 1.0d0 + ((-0.1111111111111111d0) / x)
else
tmp = 1.0d0 + (y * ((-0.3333333333333333d0) / sqrt(x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.8e+31) {
tmp = 1.0 + (-0.3333333333333333 * (y / Math.sqrt(x)));
} else if (y <= 2.05e+60) {
tmp = 1.0 + (-0.1111111111111111 / x);
} else {
tmp = 1.0 + (y * (-0.3333333333333333 / Math.sqrt(x)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.8e+31: tmp = 1.0 + (-0.3333333333333333 * (y / math.sqrt(x))) elif y <= 2.05e+60: tmp = 1.0 + (-0.1111111111111111 / x) else: tmp = 1.0 + (y * (-0.3333333333333333 / math.sqrt(x))) return tmp
function code(x, y) tmp = 0.0 if (y <= -5.8e+31) tmp = Float64(1.0 + Float64(-0.3333333333333333 * Float64(y / sqrt(x)))); elseif (y <= 2.05e+60) tmp = Float64(1.0 + Float64(-0.1111111111111111 / x)); else tmp = Float64(1.0 + Float64(y * Float64(-0.3333333333333333 / sqrt(x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.8e+31) tmp = 1.0 + (-0.3333333333333333 * (y / sqrt(x))); elseif (y <= 2.05e+60) tmp = 1.0 + (-0.1111111111111111 / x); else tmp = 1.0 + (y * (-0.3333333333333333 / sqrt(x))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.8e+31], N[(1.0 + N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.05e+60], N[(1.0 + N[(-0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(-0.3333333333333333 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+31}:\\
\;\;\;\;1 + -0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{+60}:\\
\;\;\;\;1 + \frac{-0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{-0.3333333333333333}{\sqrt{x}}\\
\end{array}
\end{array}
if y < -5.8000000000000001e31Initial program 99.5%
associate--l-99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
distribute-neg-frac99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*r/99.4%
fma-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 y around inf 93.1%
associate-*r*93.1%
*-commutative93.1%
*-commutative93.1%
*-commutative93.1%
Simplified93.1%
sqrt-div93.1%
metadata-eval93.1%
frac-2neg93.1%
metadata-eval93.1%
Applied egg-rr93.1%
neg-mul-193.1%
associate-/r*93.1%
metadata-eval93.1%
Simplified93.1%
expm1-log1p-u87.4%
expm1-udef87.4%
associate-*l/87.4%
*-un-lft-identity87.4%
*-commutative87.4%
Applied egg-rr87.4%
expm1-def87.4%
expm1-log1p93.2%
associate-/l*93.0%
associate-/r/93.2%
metadata-eval93.2%
times-frac93.1%
*-commutative93.1%
*-commutative93.1%
times-frac93.2%
metadata-eval93.2%
Simplified93.2%
if -5.8000000000000001e31 < y < 2.05e60Initial program 99.9%
*-commutative99.9%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 98.5%
cancel-sign-sub-inv98.5%
metadata-eval98.5%
associate-*r/98.5%
metadata-eval98.5%
+-commutative98.5%
Simplified98.5%
if 2.05e60 < y Initial program 99.4%
associate--l-99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
distribute-neg-frac99.4%
neg-mul-199.4%
*-commutative99.4%
associate-*r/99.5%
fma-def99.5%
associate-/r*99.5%
metadata-eval99.5%
*-commutative99.5%
associate-/r*99.5%
distribute-neg-frac99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in y around inf 96.0%
associate-*r*96.1%
*-commutative96.1%
*-commutative96.1%
*-commutative96.1%
Simplified96.1%
sqrt-div96.0%
metadata-eval96.0%
frac-2neg96.0%
metadata-eval96.0%
Applied egg-rr96.0%
neg-mul-196.0%
associate-/r*96.0%
metadata-eval96.0%
Simplified96.0%
*-commutative96.0%
metadata-eval96.0%
div-inv95.9%
frac-times95.9%
*-un-lft-identity95.9%
Applied egg-rr95.9%
clear-num95.9%
*-commutative95.9%
associate-*l/95.9%
frac-2neg95.9%
metadata-eval95.9%
div-inv95.9%
associate-*l/95.9%
*-commutative95.9%
distribute-neg-frac95.9%
distribute-rgt-neg-in95.9%
metadata-eval95.9%
clear-num95.9%
associate-/r*96.0%
div-inv95.9%
pow1/295.9%
pow-flip96.0%
metadata-eval96.0%
associate-*r/96.2%
div-inv96.2%
metadata-eval96.2%
metadata-eval96.2%
Applied egg-rr96.0%
neg-mul-196.0%
distribute-rgt-neg-in96.0%
distribute-neg-frac96.0%
metadata-eval96.0%
Simplified96.0%
Final simplification96.7%
(FPCore (x y)
:precision binary64
(if (<= y -3.8e+31)
(+ 1.0 (* -0.3333333333333333 (/ y (sqrt x))))
(if (<= y 4.5e+61)
(+ 1.0 (/ -0.1111111111111111 x))
(+ 1.0 (/ (* y -0.3333333333333333) (sqrt x))))))
double code(double x, double y) {
double tmp;
if (y <= -3.8e+31) {
tmp = 1.0 + (-0.3333333333333333 * (y / sqrt(x)));
} else if (y <= 4.5e+61) {
tmp = 1.0 + (-0.1111111111111111 / x);
} else {
tmp = 1.0 + ((y * -0.3333333333333333) / sqrt(x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-3.8d+31)) then
tmp = 1.0d0 + ((-0.3333333333333333d0) * (y / sqrt(x)))
else if (y <= 4.5d+61) then
tmp = 1.0d0 + ((-0.1111111111111111d0) / x)
else
tmp = 1.0d0 + ((y * (-0.3333333333333333d0)) / sqrt(x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.8e+31) {
tmp = 1.0 + (-0.3333333333333333 * (y / Math.sqrt(x)));
} else if (y <= 4.5e+61) {
tmp = 1.0 + (-0.1111111111111111 / x);
} else {
tmp = 1.0 + ((y * -0.3333333333333333) / Math.sqrt(x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.8e+31: tmp = 1.0 + (-0.3333333333333333 * (y / math.sqrt(x))) elif y <= 4.5e+61: tmp = 1.0 + (-0.1111111111111111 / x) else: tmp = 1.0 + ((y * -0.3333333333333333) / math.sqrt(x)) return tmp
function code(x, y) tmp = 0.0 if (y <= -3.8e+31) tmp = Float64(1.0 + Float64(-0.3333333333333333 * Float64(y / sqrt(x)))); elseif (y <= 4.5e+61) tmp = Float64(1.0 + Float64(-0.1111111111111111 / x)); else tmp = Float64(1.0 + Float64(Float64(y * -0.3333333333333333) / sqrt(x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.8e+31) tmp = 1.0 + (-0.3333333333333333 * (y / sqrt(x))); elseif (y <= 4.5e+61) tmp = 1.0 + (-0.1111111111111111 / x); else tmp = 1.0 + ((y * -0.3333333333333333) / sqrt(x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.8e+31], N[(1.0 + N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e+61], N[(1.0 + N[(-0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y * -0.3333333333333333), $MachinePrecision] / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+31}:\\
\;\;\;\;1 + -0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;1 + \frac{-0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot -0.3333333333333333}{\sqrt{x}}\\
\end{array}
\end{array}
if y < -3.8000000000000001e31Initial program 99.5%
associate--l-99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
distribute-neg-frac99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*r/99.4%
fma-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 y around inf 93.1%
associate-*r*93.1%
*-commutative93.1%
*-commutative93.1%
*-commutative93.1%
Simplified93.1%
sqrt-div93.1%
metadata-eval93.1%
frac-2neg93.1%
metadata-eval93.1%
Applied egg-rr93.1%
neg-mul-193.1%
associate-/r*93.1%
metadata-eval93.1%
Simplified93.1%
expm1-log1p-u87.4%
expm1-udef87.4%
associate-*l/87.4%
*-un-lft-identity87.4%
*-commutative87.4%
Applied egg-rr87.4%
expm1-def87.4%
expm1-log1p93.2%
associate-/l*93.0%
associate-/r/93.2%
metadata-eval93.2%
times-frac93.1%
*-commutative93.1%
*-commutative93.1%
times-frac93.2%
metadata-eval93.2%
Simplified93.2%
if -3.8000000000000001e31 < y < 4.5e61Initial program 99.9%
*-commutative99.9%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 98.5%
cancel-sign-sub-inv98.5%
metadata-eval98.5%
associate-*r/98.5%
metadata-eval98.5%
+-commutative98.5%
Simplified98.5%
if 4.5e61 < y Initial program 99.4%
associate--l-99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
distribute-neg-frac99.4%
neg-mul-199.4%
*-commutative99.4%
associate-*r/99.5%
fma-def99.5%
associate-/r*99.5%
metadata-eval99.5%
*-commutative99.5%
associate-/r*99.5%
distribute-neg-frac99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in y around inf 96.0%
associate-*r*96.1%
*-commutative96.1%
*-commutative96.1%
*-commutative96.1%
Simplified96.1%
sqrt-div96.0%
metadata-eval96.0%
frac-2neg96.0%
metadata-eval96.0%
Applied egg-rr96.0%
neg-mul-196.0%
associate-/r*96.0%
metadata-eval96.0%
Simplified96.0%
associate-*l/96.1%
*-un-lft-identity96.1%
*-commutative96.1%
Applied egg-rr96.1%
Final simplification96.7%
(FPCore (x y) :precision binary64 (- 1.0 (+ (/ (/ y 3.0) (sqrt x)) (/ 0.1111111111111111 x))))
double code(double x, double y) {
return 1.0 - (((y / 3.0) / sqrt(x)) + (0.1111111111111111 / x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 - (((y / 3.0d0) / sqrt(x)) + (0.1111111111111111d0 / x))
end function
public static double code(double x, double y) {
return 1.0 - (((y / 3.0) / Math.sqrt(x)) + (0.1111111111111111 / x));
}
def code(x, y): return 1.0 - (((y / 3.0) / math.sqrt(x)) + (0.1111111111111111 / x))
function code(x, y) return Float64(1.0 - Float64(Float64(Float64(y / 3.0) / sqrt(x)) + Float64(0.1111111111111111 / x))) end
function tmp = code(x, y) tmp = 1.0 - (((y / 3.0) / sqrt(x)) + (0.1111111111111111 / x)); end
code[x_, y_] := N[(1.0 - N[(N[(N[(y / 3.0), $MachinePrecision] / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \left(\frac{\frac{y}{3}}{\sqrt{x}} + \frac{0.1111111111111111}{x}\right)
\end{array}
Initial program 99.7%
associate--l-99.7%
+-commutative99.7%
+-commutative99.7%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in x around 0 99.7%
Final simplification99.7%
(FPCore (x y) :precision binary64 (+ 1.0 (* 0.1111111111111111 (/ -1.0 x))))
double code(double x, double y) {
return 1.0 + (0.1111111111111111 * (-1.0 / x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 + (0.1111111111111111d0 * ((-1.0d0) / x))
end function
public static double code(double x, double y) {
return 1.0 + (0.1111111111111111 * (-1.0 / x));
}
def code(x, y): return 1.0 + (0.1111111111111111 * (-1.0 / x))
function code(x, y) return Float64(1.0 + Float64(0.1111111111111111 * Float64(-1.0 / x))) end
function tmp = code(x, y) tmp = 1.0 + (0.1111111111111111 * (-1.0 / x)); end
code[x_, y_] := N[(1.0 + N[(0.1111111111111111 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + 0.1111111111111111 \cdot \frac{-1}{x}
\end{array}
Initial program 99.7%
*-commutative99.7%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 59.4%
Final simplification59.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.7%
*-commutative99.7%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 59.4%
cancel-sign-sub-inv59.4%
metadata-eval59.4%
associate-*r/59.4%
metadata-eval59.4%
+-commutative59.4%
Simplified59.4%
Final simplification59.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.7%
*-commutative99.7%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 30.5%
Final simplification30.5%
(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 2023240
(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)))))