
(FPCore (x y) :precision binary64 (+ (- 1.0 x) (* y (sqrt x))))
double code(double x, double y) {
return (1.0 - x) + (y * sqrt(x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 - x) + (y * sqrt(x))
end function
public static double code(double x, double y) {
return (1.0 - x) + (y * Math.sqrt(x));
}
def code(x, y): return (1.0 - x) + (y * math.sqrt(x))
function code(x, y) return Float64(Float64(1.0 - x) + Float64(y * sqrt(x))) end
function tmp = code(x, y) tmp = (1.0 - x) + (y * sqrt(x)); end
code[x_, y_] := N[(N[(1.0 - x), $MachinePrecision] + N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - x\right) + y \cdot \sqrt{x}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ (- 1.0 x) (* y (sqrt x))))
double code(double x, double y) {
return (1.0 - x) + (y * sqrt(x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 - x) + (y * sqrt(x))
end function
public static double code(double x, double y) {
return (1.0 - x) + (y * Math.sqrt(x));
}
def code(x, y): return (1.0 - x) + (y * math.sqrt(x))
function code(x, y) return Float64(Float64(1.0 - x) + Float64(y * sqrt(x))) end
function tmp = code(x, y) tmp = (1.0 - x) + (y * sqrt(x)); end
code[x_, y_] := N[(N[(1.0 - x), $MachinePrecision] + N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - x\right) + y \cdot \sqrt{x}
\end{array}
(FPCore (x y) :precision binary64 (fma y (sqrt x) (- 1.0 x)))
double code(double x, double y) {
return fma(y, sqrt(x), (1.0 - x));
}
function code(x, y) return fma(y, sqrt(x), Float64(1.0 - x)) end
code[x_, y_] := N[(y * N[Sqrt[x], $MachinePrecision] + N[(1.0 - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \sqrt{x}, 1 - x\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
(FPCore (x y) :precision binary64 (if (or (<= y -1.5e+46) (not (<= y 2.6e+30))) (+ 1.0 (* y (sqrt x))) (- 1.0 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.5e+46) || !(y <= 2.6e+30)) {
tmp = 1.0 + (y * sqrt(x));
} else {
tmp = 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 <= (-1.5d+46)) .or. (.not. (y <= 2.6d+30))) then
tmp = 1.0d0 + (y * sqrt(x))
else
tmp = 1.0d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.5e+46) || !(y <= 2.6e+30)) {
tmp = 1.0 + (y * Math.sqrt(x));
} else {
tmp = 1.0 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.5e+46) or not (y <= 2.6e+30): tmp = 1.0 + (y * math.sqrt(x)) else: tmp = 1.0 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.5e+46) || !(y <= 2.6e+30)) tmp = Float64(1.0 + Float64(y * sqrt(x))); else tmp = Float64(1.0 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.5e+46) || ~((y <= 2.6e+30))) tmp = 1.0 + (y * sqrt(x)); else tmp = 1.0 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.5e+46], N[Not[LessEqual[y, 2.6e+30]], $MachinePrecision]], N[(1.0 + N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+46} \lor \neg \left(y \leq 2.6 \cdot 10^{+30}\right):\\
\;\;\;\;1 + y \cdot \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;1 - x\\
\end{array}
\end{array}
if y < -1.50000000000000012e46 or 2.59999999999999988e30 < y Initial program 99.8%
Taylor expanded in x around 0 92.5%
if -1.50000000000000012e46 < y < 2.59999999999999988e30Initial program 100.0%
add-sqr-sqrt100.0%
pow2100.0%
pow1/2100.0%
sqrt-pow1100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 99.4%
Final simplification96.2%
(FPCore (x y) :precision binary64 (if (or (<= y -7.5e+51) (not (<= y 9.9e+76))) (* y (sqrt x)) (- 1.0 x)))
double code(double x, double y) {
double tmp;
if ((y <= -7.5e+51) || !(y <= 9.9e+76)) {
tmp = y * sqrt(x);
} else {
tmp = 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 <= (-7.5d+51)) .or. (.not. (y <= 9.9d+76))) then
tmp = y * sqrt(x)
else
tmp = 1.0d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -7.5e+51) || !(y <= 9.9e+76)) {
tmp = y * Math.sqrt(x);
} else {
tmp = 1.0 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -7.5e+51) or not (y <= 9.9e+76): tmp = y * math.sqrt(x) else: tmp = 1.0 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -7.5e+51) || !(y <= 9.9e+76)) tmp = Float64(y * sqrt(x)); else tmp = Float64(1.0 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -7.5e+51) || ~((y <= 9.9e+76))) tmp = y * sqrt(x); else tmp = 1.0 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -7.5e+51], N[Not[LessEqual[y, 9.9e+76]], $MachinePrecision]], N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(1.0 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+51} \lor \neg \left(y \leq 9.9 \cdot 10^{+76}\right):\\
\;\;\;\;y \cdot \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;1 - x\\
\end{array}
\end{array}
if y < -7.4999999999999999e51 or 9.90000000000000018e76 < y Initial program 99.8%
Taylor expanded in x around inf 80.4%
Taylor expanded in y around inf 95.8%
mul-1-neg95.8%
unsub-neg95.8%
Simplified95.8%
Taylor expanded in x around 0 89.5%
if -7.4999999999999999e51 < y < 9.90000000000000018e76Initial program 100.0%
add-sqr-sqrt100.0%
pow2100.0%
pow1/2100.0%
sqrt-pow1100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 97.2%
Final simplification94.0%
(FPCore (x y) :precision binary64 (let* ((t_0 (* y (sqrt x)))) (if (<= x 1.35e-7) (+ 1.0 t_0) (- t_0 x))))
double code(double x, double y) {
double t_0 = y * sqrt(x);
double tmp;
if (x <= 1.35e-7) {
tmp = 1.0 + t_0;
} else {
tmp = t_0 - 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 * sqrt(x)
if (x <= 1.35d-7) then
tmp = 1.0d0 + t_0
else
tmp = t_0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y * Math.sqrt(x);
double tmp;
if (x <= 1.35e-7) {
tmp = 1.0 + t_0;
} else {
tmp = t_0 - x;
}
return tmp;
}
def code(x, y): t_0 = y * math.sqrt(x) tmp = 0 if x <= 1.35e-7: tmp = 1.0 + t_0 else: tmp = t_0 - x return tmp
function code(x, y) t_0 = Float64(y * sqrt(x)) tmp = 0.0 if (x <= 1.35e-7) tmp = Float64(1.0 + t_0); else tmp = Float64(t_0 - x); end return tmp end
function tmp_2 = code(x, y) t_0 = y * sqrt(x); tmp = 0.0; if (x <= 1.35e-7) tmp = 1.0 + t_0; else tmp = t_0 - x; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.35e-7], N[(1.0 + t$95$0), $MachinePrecision], N[(t$95$0 - x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \sqrt{x}\\
\mathbf{if}\;x \leq 1.35 \cdot 10^{-7}:\\
\;\;\;\;1 + t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 - x\\
\end{array}
\end{array}
if x < 1.35000000000000004e-7Initial program 99.9%
Taylor expanded in x around 0 99.5%
if 1.35000000000000004e-7 < x Initial program 99.9%
add-sqr-sqrt99.8%
pow299.8%
pow1/299.8%
sqrt-pow199.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 98.2%
sub-neg98.2%
metadata-eval98.2%
distribute-rgt-in98.2%
*-commutative98.2%
neg-mul-198.2%
unsub-neg98.2%
Simplified98.4%
Final simplification98.9%
(FPCore (x y) :precision binary64 (+ (- 1.0 x) (* y (sqrt x))))
double code(double x, double y) {
return (1.0 - x) + (y * sqrt(x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 - x) + (y * sqrt(x))
end function
public static double code(double x, double y) {
return (1.0 - x) + (y * Math.sqrt(x));
}
def code(x, y): return (1.0 - x) + (y * math.sqrt(x))
function code(x, y) return Float64(Float64(1.0 - x) + Float64(y * sqrt(x))) end
function tmp = code(x, y) tmp = (1.0 - x) + (y * sqrt(x)); end
code[x_, y_] := N[(N[(1.0 - x), $MachinePrecision] + N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - x\right) + y \cdot \sqrt{x}
\end{array}
Initial program 99.9%
(FPCore (x y) :precision binary64 (if (<= y -1.35e+154) (/ (- 1.0 (* x x)) (+ x 1.0)) (if (<= y 1.6e+117) (- 1.0 x) (* y (/ (- x (* (/ x y) (/ x y))) (/ x y))))))
double code(double x, double y) {
double tmp;
if (y <= -1.35e+154) {
tmp = (1.0 - (x * x)) / (x + 1.0);
} else if (y <= 1.6e+117) {
tmp = 1.0 - x;
} else {
tmp = y * ((x - ((x / y) * (x / y))) / (x / y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.35d+154)) then
tmp = (1.0d0 - (x * x)) / (x + 1.0d0)
else if (y <= 1.6d+117) then
tmp = 1.0d0 - x
else
tmp = y * ((x - ((x / y) * (x / y))) / (x / y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.35e+154) {
tmp = (1.0 - (x * x)) / (x + 1.0);
} else if (y <= 1.6e+117) {
tmp = 1.0 - x;
} else {
tmp = y * ((x - ((x / y) * (x / y))) / (x / y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.35e+154: tmp = (1.0 - (x * x)) / (x + 1.0) elif y <= 1.6e+117: tmp = 1.0 - x else: tmp = y * ((x - ((x / y) * (x / y))) / (x / y)) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.35e+154) tmp = Float64(Float64(1.0 - Float64(x * x)) / Float64(x + 1.0)); elseif (y <= 1.6e+117) tmp = Float64(1.0 - x); else tmp = Float64(y * Float64(Float64(x - Float64(Float64(x / y) * Float64(x / y))) / Float64(x / y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.35e+154) tmp = (1.0 - (x * x)) / (x + 1.0); elseif (y <= 1.6e+117) tmp = 1.0 - x; else tmp = y * ((x - ((x / y) * (x / y))) / (x / y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.35e+154], N[(N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+117], N[(1.0 - x), $MachinePrecision], N[(y * N[(N[(x - N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1 - x \cdot x}{x + 1}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+117}:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x - \frac{x}{y} \cdot \frac{x}{y}}{\frac{x}{y}}\\
\end{array}
\end{array}
if y < -1.35000000000000003e154Initial program 99.8%
add-sqr-sqrt99.4%
pow299.4%
pow1/299.4%
sqrt-pow199.5%
metadata-eval99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 3.0%
sub-neg3.0%
flip-+17.7%
metadata-eval17.7%
Applied egg-rr17.7%
if -1.35000000000000003e154 < y < 1.60000000000000002e117Initial program 100.0%
add-sqr-sqrt99.9%
pow299.9%
pow1/299.9%
sqrt-pow199.9%
metadata-eval99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 85.7%
if 1.60000000000000002e117 < y Initial program 99.8%
Taylor expanded in x around inf 76.0%
Taylor expanded in y around inf 99.8%
mul-1-neg99.8%
unsub-neg99.8%
Simplified99.8%
sub-neg99.8%
flip-+99.7%
add-sqr-sqrt99.3%
distribute-neg-frac299.3%
distribute-neg-frac299.3%
distribute-neg-frac299.3%
Applied egg-rr99.3%
Taylor expanded in y around 0 26.2%
Final simplification66.9%
(FPCore (x y) :precision binary64 (if (<= y -9e+151) (/ (- 1.0 (* x x)) (+ x 1.0)) (if (<= y 5.3e+128) (- 1.0 x) (/ (+ (* x x) -1.0) (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -9e+151) {
tmp = (1.0 - (x * x)) / (x + 1.0);
} else if (y <= 5.3e+128) {
tmp = 1.0 - x;
} else {
tmp = ((x * x) + -1.0) / (x + -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 <= (-9d+151)) then
tmp = (1.0d0 - (x * x)) / (x + 1.0d0)
else if (y <= 5.3d+128) then
tmp = 1.0d0 - x
else
tmp = ((x * x) + (-1.0d0)) / (x + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -9e+151) {
tmp = (1.0 - (x * x)) / (x + 1.0);
} else if (y <= 5.3e+128) {
tmp = 1.0 - x;
} else {
tmp = ((x * x) + -1.0) / (x + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -9e+151: tmp = (1.0 - (x * x)) / (x + 1.0) elif y <= 5.3e+128: tmp = 1.0 - x else: tmp = ((x * x) + -1.0) / (x + -1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= -9e+151) tmp = Float64(Float64(1.0 - Float64(x * x)) / Float64(x + 1.0)); elseif (y <= 5.3e+128) tmp = Float64(1.0 - x); else tmp = Float64(Float64(Float64(x * x) + -1.0) / Float64(x + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -9e+151) tmp = (1.0 - (x * x)) / (x + 1.0); elseif (y <= 5.3e+128) tmp = 1.0 - x; else tmp = ((x * x) + -1.0) / (x + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -9e+151], N[(N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.3e+128], N[(1.0 - x), $MachinePrecision], N[(N[(N[(x * x), $MachinePrecision] + -1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+151}:\\
\;\;\;\;\frac{1 - x \cdot x}{x + 1}\\
\mathbf{elif}\;y \leq 5.3 \cdot 10^{+128}:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot x + -1}{x + -1}\\
\end{array}
\end{array}
if y < -8.9999999999999997e151Initial program 99.8%
add-sqr-sqrt99.4%
pow299.4%
pow1/299.4%
sqrt-pow199.5%
metadata-eval99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 2.9%
sub-neg2.9%
flip-+17.2%
metadata-eval17.2%
Applied egg-rr17.2%
if -8.9999999999999997e151 < y < 5.3000000000000002e128Initial program 100.0%
add-sqr-sqrt99.9%
pow299.9%
pow1/299.9%
sqrt-pow199.9%
metadata-eval99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 84.6%
if 5.3000000000000002e128 < y Initial program 99.8%
add-sqr-sqrt99.4%
pow299.4%
pow1/299.4%
sqrt-pow199.4%
metadata-eval99.4%
Applied egg-rr99.4%
Taylor expanded in y around 0 2.8%
sub-neg2.8%
flip-+2.8%
metadata-eval2.8%
Applied egg-rr2.8%
pow12.8%
metadata-eval2.8%
sqrt-pow13.6%
pow23.6%
sqr-neg3.6%
sqrt-prod19.9%
add-sqr-sqrt19.9%
flip--3.6%
metadata-eval3.6%
sqr-neg3.6%
remove-double-neg3.6%
sub-neg3.6%
frac-2neg3.6%
distribute-frac-neg3.6%
distribute-neg-frac23.6%
metadata-eval3.6%
sqr-neg3.6%
sub-neg3.6%
remove-double-neg3.6%
flip--19.9%
sub-neg19.9%
pow119.9%
metadata-eval19.9%
Applied egg-rr19.9%
Final simplification66.1%
(FPCore (x y) :precision binary64 (if (<= y -7.8e+178) (/ (- 1.0 (* x x)) x) (if (<= y 4e+133) (- 1.0 x) (/ (+ (* x x) -1.0) (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -7.8e+178) {
tmp = (1.0 - (x * x)) / x;
} else if (y <= 4e+133) {
tmp = 1.0 - x;
} else {
tmp = ((x * x) + -1.0) / (x + -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 <= (-7.8d+178)) then
tmp = (1.0d0 - (x * x)) / x
else if (y <= 4d+133) then
tmp = 1.0d0 - x
else
tmp = ((x * x) + (-1.0d0)) / (x + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -7.8e+178) {
tmp = (1.0 - (x * x)) / x;
} else if (y <= 4e+133) {
tmp = 1.0 - x;
} else {
tmp = ((x * x) + -1.0) / (x + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.8e+178: tmp = (1.0 - (x * x)) / x elif y <= 4e+133: tmp = 1.0 - x else: tmp = ((x * x) + -1.0) / (x + -1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= -7.8e+178) tmp = Float64(Float64(1.0 - Float64(x * x)) / x); elseif (y <= 4e+133) tmp = Float64(1.0 - x); else tmp = Float64(Float64(Float64(x * x) + -1.0) / Float64(x + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.8e+178) tmp = (1.0 - (x * x)) / x; elseif (y <= 4e+133) tmp = 1.0 - x; else tmp = ((x * x) + -1.0) / (x + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.8e+178], N[(N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 4e+133], N[(1.0 - x), $MachinePrecision], N[(N[(N[(x * x), $MachinePrecision] + -1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{+178}:\\
\;\;\;\;\frac{1 - x \cdot x}{x}\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+133}:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot x + -1}{x + -1}\\
\end{array}
\end{array}
if y < -7.7999999999999995e178Initial program 99.8%
add-sqr-sqrt99.4%
pow299.4%
pow1/299.4%
sqrt-pow199.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in y around 0 3.3%
sub-neg3.3%
flip-+22.1%
metadata-eval22.1%
Applied egg-rr22.1%
Taylor expanded in x around inf 21.9%
if -7.7999999999999995e178 < y < 4.0000000000000001e133Initial program 100.0%
add-sqr-sqrt99.9%
pow299.9%
pow1/299.9%
sqrt-pow199.9%
metadata-eval99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 80.8%
if 4.0000000000000001e133 < y Initial program 99.8%
add-sqr-sqrt99.5%
pow299.5%
pow1/299.5%
sqrt-pow199.5%
metadata-eval99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 2.7%
sub-neg2.7%
flip-+2.7%
metadata-eval2.7%
Applied egg-rr2.7%
pow12.7%
metadata-eval2.7%
sqrt-pow13.5%
pow23.5%
sqr-neg3.5%
sqrt-prod20.3%
add-sqr-sqrt20.3%
flip--3.5%
metadata-eval3.5%
sqr-neg3.5%
remove-double-neg3.5%
sub-neg3.5%
frac-2neg3.5%
distribute-frac-neg3.5%
distribute-neg-frac23.5%
metadata-eval3.5%
sqr-neg3.5%
sub-neg3.5%
remove-double-neg3.5%
flip--20.3%
sub-neg20.3%
pow120.3%
metadata-eval20.3%
Applied egg-rr20.3%
Final simplification66.0%
(FPCore (x y) :precision binary64 (if (<= y -7.8e+178) (/ (- 1.0 (* x x)) x) (- 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -7.8e+178) {
tmp = (1.0 - (x * x)) / x;
} else {
tmp = 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 <= (-7.8d+178)) then
tmp = (1.0d0 - (x * x)) / x
else
tmp = 1.0d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -7.8e+178) {
tmp = (1.0 - (x * x)) / x;
} else {
tmp = 1.0 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.8e+178: tmp = (1.0 - (x * x)) / x else: tmp = 1.0 - x return tmp
function code(x, y) tmp = 0.0 if (y <= -7.8e+178) tmp = Float64(Float64(1.0 - Float64(x * x)) / x); else tmp = Float64(1.0 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.8e+178) tmp = (1.0 - (x * x)) / x; else tmp = 1.0 - x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.8e+178], N[(N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(1.0 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{+178}:\\
\;\;\;\;\frac{1 - x \cdot x}{x}\\
\mathbf{else}:\\
\;\;\;\;1 - x\\
\end{array}
\end{array}
if y < -7.7999999999999995e178Initial program 99.8%
add-sqr-sqrt99.4%
pow299.4%
pow1/299.4%
sqrt-pow199.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in y around 0 3.3%
sub-neg3.3%
flip-+22.1%
metadata-eval22.1%
Applied egg-rr22.1%
Taylor expanded in x around inf 21.9%
if -7.7999999999999995e178 < y Initial program 99.9%
add-sqr-sqrt99.8%
pow299.8%
pow1/299.8%
sqrt-pow199.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 67.9%
Final simplification63.4%
(FPCore (x y) :precision binary64 (if (<= x 0.0175) 1.0 (- x)))
double code(double x, double y) {
double tmp;
if (x <= 0.0175) {
tmp = 1.0;
} else {
tmp = -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.0175d0) then
tmp = 1.0d0
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 0.0175) {
tmp = 1.0;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.0175: tmp = 1.0 else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if (x <= 0.0175) tmp = 1.0; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 0.0175) tmp = 1.0; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.0175], 1.0, (-x)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0175:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if x < 0.017500000000000002Initial program 99.9%
Taylor expanded in x around 0 99.5%
Taylor expanded in y around 0 59.3%
if 0.017500000000000002 < x Initial program 99.9%
Taylor expanded in x around inf 98.2%
Taylor expanded in y around 0 61.9%
neg-mul-161.9%
Simplified61.9%
(FPCore (x y) :precision binary64 (- 1.0 x))
double code(double x, double y) {
return 1.0 - x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 - x
end function
public static double code(double x, double y) {
return 1.0 - x;
}
def code(x, y): return 1.0 - x
function code(x, y) return Float64(1.0 - x) end
function tmp = code(x, y) tmp = 1.0 - x; end
code[x_, y_] := N[(1.0 - x), $MachinePrecision]
\begin{array}{l}
\\
1 - x
\end{array}
Initial program 99.9%
add-sqr-sqrt99.8%
pow299.8%
pow1/299.8%
sqrt-pow199.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 61.6%
(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.9%
Taylor expanded in x around 0 68.1%
Taylor expanded in y around 0 29.9%
herbie shell --seed 2024129
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, E"
:precision binary64
(+ (- 1.0 x) (* y (sqrt x))))