
(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 10 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 (+ (- 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%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (or (<= y -1.85e+63) (not (<= y 9e+58))) (+ 1.0 (* y (sqrt x))) (- 1.0 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.85e+63) || !(y <= 9e+58)) {
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.85d+63)) .or. (.not. (y <= 9d+58))) 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.85e+63) || !(y <= 9e+58)) {
tmp = 1.0 + (y * Math.sqrt(x));
} else {
tmp = 1.0 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.85e+63) or not (y <= 9e+58): tmp = 1.0 + (y * math.sqrt(x)) else: tmp = 1.0 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.85e+63) || !(y <= 9e+58)) 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.85e+63) || ~((y <= 9e+58))) tmp = 1.0 + (y * sqrt(x)); else tmp = 1.0 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.85e+63], N[Not[LessEqual[y, 9e+58]], $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.85 \cdot 10^{+63} \lor \neg \left(y \leq 9 \cdot 10^{+58}\right):\\
\;\;\;\;1 + y \cdot \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;1 - x\\
\end{array}
\end{array}
if y < -1.84999999999999984e63 or 8.9999999999999996e58 < y Initial program 99.6%
+-commutative99.6%
*-commutative99.6%
add-sqr-sqrt99.3%
associate-*l*99.2%
fma-def99.2%
pow1/299.2%
sqrt-pow199.3%
metadata-eval99.3%
pow1/299.3%
sqrt-pow199.3%
metadata-eval99.3%
Applied egg-rr99.3%
Taylor expanded in x around 0 95.5%
if -1.84999999999999984e63 < y < 8.9999999999999996e58Initial program 100.0%
Taylor expanded in y around 0 99.2%
Final simplification97.7%
(FPCore (x y) :precision binary64 (if (or (<= y -1.3e+82) (not (<= y 2.3e+70))) (* y (sqrt x)) (- 1.0 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.3e+82) || !(y <= 2.3e+70)) {
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 <= (-1.3d+82)) .or. (.not. (y <= 2.3d+70))) 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 <= -1.3e+82) || !(y <= 2.3e+70)) {
tmp = y * Math.sqrt(x);
} else {
tmp = 1.0 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.3e+82) or not (y <= 2.3e+70): tmp = y * math.sqrt(x) else: tmp = 1.0 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.3e+82) || !(y <= 2.3e+70)) 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 <= -1.3e+82) || ~((y <= 2.3e+70))) tmp = y * sqrt(x); else tmp = 1.0 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.3e+82], N[Not[LessEqual[y, 2.3e+70]], $MachinePrecision]], N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(1.0 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+82} \lor \neg \left(y \leq 2.3 \cdot 10^{+70}\right):\\
\;\;\;\;y \cdot \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;1 - x\\
\end{array}
\end{array}
if y < -1.2999999999999999e82 or 2.29999999999999994e70 < y Initial program 99.6%
Taylor expanded in y around inf 91.2%
if -1.2999999999999999e82 < y < 2.29999999999999994e70Initial program 100.0%
Taylor expanded in y around 0 97.2%
Final simplification94.9%
(FPCore (x y) :precision binary64 (if (<= y -3.7e+133) (* x (- (* y y))) (if (<= y 5.7e+107) (- 1.0 x) (* x (* y (/ y (+ 1.0 x)))))))
double code(double x, double y) {
double tmp;
if (y <= -3.7e+133) {
tmp = x * -(y * y);
} else if (y <= 5.7e+107) {
tmp = 1.0 - x;
} else {
tmp = x * (y * (y / (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 <= (-3.7d+133)) then
tmp = x * -(y * y)
else if (y <= 5.7d+107) then
tmp = 1.0d0 - x
else
tmp = x * (y * (y / (1.0d0 + x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.7e+133) {
tmp = x * -(y * y);
} else if (y <= 5.7e+107) {
tmp = 1.0 - x;
} else {
tmp = x * (y * (y / (1.0 + x)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.7e+133: tmp = x * -(y * y) elif y <= 5.7e+107: tmp = 1.0 - x else: tmp = x * (y * (y / (1.0 + x))) return tmp
function code(x, y) tmp = 0.0 if (y <= -3.7e+133) tmp = Float64(x * Float64(-Float64(y * y))); elseif (y <= 5.7e+107) tmp = Float64(1.0 - x); else tmp = Float64(x * Float64(y * Float64(y / Float64(1.0 + x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.7e+133) tmp = x * -(y * y); elseif (y <= 5.7e+107) tmp = 1.0 - x; else tmp = x * (y * (y / (1.0 + x))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.7e+133], N[(x * (-N[(y * y), $MachinePrecision])), $MachinePrecision], If[LessEqual[y, 5.7e+107], N[(1.0 - x), $MachinePrecision], N[(x * N[(y * N[(y / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{+133}:\\
\;\;\;\;x \cdot \left(-y \cdot y\right)\\
\mathbf{elif}\;y \leq 5.7 \cdot 10^{+107}:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{y}{1 + x}\right)\\
\end{array}
\end{array}
if y < -3.70000000000000023e133Initial program 99.4%
flip-+25.0%
div-inv25.0%
pow225.0%
*-commutative25.0%
*-commutative25.0%
swap-sqr12.1%
add-sqr-sqrt12.2%
associate--l-12.2%
Applied egg-rr12.2%
Taylor expanded in y around inf 13.0%
mul-1-neg13.0%
unpow213.0%
distribute-rgt-neg-out13.0%
Simplified13.0%
Taylor expanded in x around 0 21.7%
mul-1-neg21.7%
unpow221.7%
*-commutative21.7%
distribute-rgt-neg-in21.7%
Simplified21.7%
if -3.70000000000000023e133 < y < 5.69999999999999972e107Initial program 99.9%
Taylor expanded in y around 0 89.4%
if 5.69999999999999972e107 < y Initial program 99.8%
flip-+46.7%
div-inv46.6%
pow246.6%
*-commutative46.6%
*-commutative46.6%
swap-sqr18.0%
add-sqr-sqrt17.9%
associate--l-17.9%
Applied egg-rr17.9%
Taylor expanded in y around inf 16.6%
mul-1-neg16.6%
unpow216.6%
distribute-rgt-neg-out16.6%
Simplified16.6%
Taylor expanded in y around 0 17.4%
associate-*r/17.4%
mul-1-neg17.4%
unpow217.4%
*-commutative17.4%
distribute-rgt-neg-in17.4%
associate-/l*17.6%
Simplified17.6%
expm1-log1p-u17.4%
expm1-udef17.4%
Applied egg-rr21.2%
expm1-def21.2%
expm1-log1p21.2%
associate-*l/21.1%
associate-/r/21.1%
associate-*r/20.6%
associate-/r/20.6%
*-commutative20.6%
Simplified20.6%
Final simplification68.9%
(FPCore (x y) :precision binary64 (if (<= y -2.05e+133) (* x (- (* y y))) (if (<= y 5.7e+107) (- 1.0 x) (* y (/ (* x y) (+ 1.0 x))))))
double code(double x, double y) {
double tmp;
if (y <= -2.05e+133) {
tmp = x * -(y * y);
} else if (y <= 5.7e+107) {
tmp = 1.0 - x;
} else {
tmp = y * ((x * y) / (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 <= (-2.05d+133)) then
tmp = x * -(y * y)
else if (y <= 5.7d+107) then
tmp = 1.0d0 - x
else
tmp = y * ((x * y) / (1.0d0 + x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.05e+133) {
tmp = x * -(y * y);
} else if (y <= 5.7e+107) {
tmp = 1.0 - x;
} else {
tmp = y * ((x * y) / (1.0 + x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.05e+133: tmp = x * -(y * y) elif y <= 5.7e+107: tmp = 1.0 - x else: tmp = y * ((x * y) / (1.0 + x)) return tmp
function code(x, y) tmp = 0.0 if (y <= -2.05e+133) tmp = Float64(x * Float64(-Float64(y * y))); elseif (y <= 5.7e+107) tmp = Float64(1.0 - x); else tmp = Float64(y * Float64(Float64(x * y) / Float64(1.0 + x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.05e+133) tmp = x * -(y * y); elseif (y <= 5.7e+107) tmp = 1.0 - x; else tmp = y * ((x * y) / (1.0 + x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.05e+133], N[(x * (-N[(y * y), $MachinePrecision])), $MachinePrecision], If[LessEqual[y, 5.7e+107], N[(1.0 - x), $MachinePrecision], N[(y * N[(N[(x * y), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{+133}:\\
\;\;\;\;x \cdot \left(-y \cdot y\right)\\
\mathbf{elif}\;y \leq 5.7 \cdot 10^{+107}:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x \cdot y}{1 + x}\\
\end{array}
\end{array}
if y < -2.05000000000000002e133Initial program 99.4%
flip-+25.0%
div-inv25.0%
pow225.0%
*-commutative25.0%
*-commutative25.0%
swap-sqr12.1%
add-sqr-sqrt12.2%
associate--l-12.2%
Applied egg-rr12.2%
Taylor expanded in y around inf 13.0%
mul-1-neg13.0%
unpow213.0%
distribute-rgt-neg-out13.0%
Simplified13.0%
Taylor expanded in x around 0 21.7%
mul-1-neg21.7%
unpow221.7%
*-commutative21.7%
distribute-rgt-neg-in21.7%
Simplified21.7%
if -2.05000000000000002e133 < y < 5.69999999999999972e107Initial program 99.9%
Taylor expanded in y around 0 89.4%
if 5.69999999999999972e107 < y Initial program 99.8%
flip-+46.7%
div-inv46.6%
pow246.6%
*-commutative46.6%
*-commutative46.6%
swap-sqr18.0%
add-sqr-sqrt17.9%
associate--l-17.9%
Applied egg-rr17.9%
Taylor expanded in y around inf 16.6%
mul-1-neg16.6%
unpow216.6%
distribute-rgt-neg-out16.6%
Simplified16.6%
Taylor expanded in y around 0 17.4%
associate-*r/17.4%
mul-1-neg17.4%
unpow217.4%
*-commutative17.4%
distribute-rgt-neg-in17.4%
associate-/l*17.6%
Simplified17.6%
expm1-log1p-u17.4%
expm1-udef17.4%
Applied egg-rr21.2%
expm1-def21.2%
expm1-log1p21.2%
*-commutative21.2%
associate-*l/21.1%
Simplified21.1%
Final simplification69.0%
(FPCore (x y) :precision binary64 (if (<= y -1.1e+132) (* y (- (* y (/ x (+ 1.0 x))))) (if (<= y 5.7e+107) (- 1.0 x) (* y (/ (* x y) (+ 1.0 x))))))
double code(double x, double y) {
double tmp;
if (y <= -1.1e+132) {
tmp = y * -(y * (x / (1.0 + x)));
} else if (y <= 5.7e+107) {
tmp = 1.0 - x;
} else {
tmp = y * ((x * y) / (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.1d+132)) then
tmp = y * -(y * (x / (1.0d0 + x)))
else if (y <= 5.7d+107) then
tmp = 1.0d0 - x
else
tmp = y * ((x * y) / (1.0d0 + x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.1e+132) {
tmp = y * -(y * (x / (1.0 + x)));
} else if (y <= 5.7e+107) {
tmp = 1.0 - x;
} else {
tmp = y * ((x * y) / (1.0 + x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.1e+132: tmp = y * -(y * (x / (1.0 + x))) elif y <= 5.7e+107: tmp = 1.0 - x else: tmp = y * ((x * y) / (1.0 + x)) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.1e+132) tmp = Float64(y * Float64(-Float64(y * Float64(x / Float64(1.0 + x))))); elseif (y <= 5.7e+107) tmp = Float64(1.0 - x); else tmp = Float64(y * Float64(Float64(x * y) / Float64(1.0 + x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.1e+132) tmp = y * -(y * (x / (1.0 + x))); elseif (y <= 5.7e+107) tmp = 1.0 - x; else tmp = y * ((x * y) / (1.0 + x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.1e+132], N[(y * (-N[(y * N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[y, 5.7e+107], N[(1.0 - x), $MachinePrecision], N[(y * N[(N[(x * y), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+132}:\\
\;\;\;\;y \cdot \left(-y \cdot \frac{x}{1 + x}\right)\\
\mathbf{elif}\;y \leq 5.7 \cdot 10^{+107}:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x \cdot y}{1 + x}\\
\end{array}
\end{array}
if y < -1.09999999999999994e132Initial program 99.4%
flip-+25.0%
div-inv25.0%
pow225.0%
*-commutative25.0%
*-commutative25.0%
swap-sqr12.1%
add-sqr-sqrt12.2%
associate--l-12.2%
Applied egg-rr12.2%
Taylor expanded in y around inf 13.0%
mul-1-neg13.0%
unpow213.0%
distribute-rgt-neg-out13.0%
Simplified13.0%
Taylor expanded in y around 0 2.7%
associate-*r/2.7%
mul-1-neg2.7%
unpow22.7%
*-commutative2.7%
distribute-rgt-neg-in2.7%
associate-/l*2.7%
Simplified2.7%
associate-/r/2.7%
distribute-lft-neg-in2.7%
associate-*r*3.0%
*-un-lft-identity3.0%
*-un-lft-identity3.0%
sub-neg3.0%
add-sqr-sqrt0.0%
sqrt-unprod8.0%
sqr-neg8.0%
sqrt-unprod22.0%
add-sqr-sqrt22.0%
+-commutative22.0%
Applied egg-rr22.0%
if -1.09999999999999994e132 < y < 5.69999999999999972e107Initial program 99.9%
Taylor expanded in y around 0 89.4%
if 5.69999999999999972e107 < y Initial program 99.8%
flip-+46.7%
div-inv46.6%
pow246.6%
*-commutative46.6%
*-commutative46.6%
swap-sqr18.0%
add-sqr-sqrt17.9%
associate--l-17.9%
Applied egg-rr17.9%
Taylor expanded in y around inf 16.6%
mul-1-neg16.6%
unpow216.6%
distribute-rgt-neg-out16.6%
Simplified16.6%
Taylor expanded in y around 0 17.4%
associate-*r/17.4%
mul-1-neg17.4%
unpow217.4%
*-commutative17.4%
distribute-rgt-neg-in17.4%
associate-/l*17.6%
Simplified17.6%
expm1-log1p-u17.4%
expm1-udef17.4%
Applied egg-rr21.2%
expm1-def21.2%
expm1-log1p21.2%
*-commutative21.2%
associate-*l/21.1%
Simplified21.1%
Final simplification69.0%
(FPCore (x y) :precision binary64 (if (<= y -8.6e+130) (* x (- (* y y))) (if (<= y 2e+166) (- 1.0 x) (* y y))))
double code(double x, double y) {
double tmp;
if (y <= -8.6e+130) {
tmp = x * -(y * y);
} else if (y <= 2e+166) {
tmp = 1.0 - x;
} else {
tmp = y * y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-8.6d+130)) then
tmp = x * -(y * y)
else if (y <= 2d+166) then
tmp = 1.0d0 - x
else
tmp = y * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -8.6e+130) {
tmp = x * -(y * y);
} else if (y <= 2e+166) {
tmp = 1.0 - x;
} else {
tmp = y * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -8.6e+130: tmp = x * -(y * y) elif y <= 2e+166: tmp = 1.0 - x else: tmp = y * y return tmp
function code(x, y) tmp = 0.0 if (y <= -8.6e+130) tmp = Float64(x * Float64(-Float64(y * y))); elseif (y <= 2e+166) tmp = Float64(1.0 - x); else tmp = Float64(y * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -8.6e+130) tmp = x * -(y * y); elseif (y <= 2e+166) tmp = 1.0 - x; else tmp = y * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -8.6e+130], N[(x * (-N[(y * y), $MachinePrecision])), $MachinePrecision], If[LessEqual[y, 2e+166], N[(1.0 - x), $MachinePrecision], N[(y * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.6 \cdot 10^{+130}:\\
\;\;\;\;x \cdot \left(-y \cdot y\right)\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+166}:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot y\\
\end{array}
\end{array}
if y < -8.59999999999999968e130Initial program 99.4%
flip-+25.0%
div-inv25.0%
pow225.0%
*-commutative25.0%
*-commutative25.0%
swap-sqr12.1%
add-sqr-sqrt12.2%
associate--l-12.2%
Applied egg-rr12.2%
Taylor expanded in y around inf 13.0%
mul-1-neg13.0%
unpow213.0%
distribute-rgt-neg-out13.0%
Simplified13.0%
Taylor expanded in x around 0 21.7%
mul-1-neg21.7%
unpow221.7%
*-commutative21.7%
distribute-rgt-neg-in21.7%
Simplified21.7%
if -8.59999999999999968e130 < y < 1.99999999999999988e166Initial program 99.9%
Taylor expanded in y around 0 83.3%
if 1.99999999999999988e166 < y Initial program 99.8%
flip-+33.0%
div-inv33.0%
pow233.0%
*-commutative33.0%
*-commutative33.0%
swap-sqr3.7%
add-sqr-sqrt3.7%
associate--l-3.7%
Applied egg-rr3.7%
Taylor expanded in y around inf 4.9%
mul-1-neg4.9%
unpow24.9%
distribute-rgt-neg-out4.9%
Simplified4.9%
Taylor expanded in x around inf 28.0%
unpow228.0%
Simplified28.0%
Final simplification68.8%
(FPCore (x y) :precision binary64 (if (<= y 1.75e+166) (- 1.0 x) (* y y)))
double code(double x, double y) {
double tmp;
if (y <= 1.75e+166) {
tmp = 1.0 - x;
} else {
tmp = y * 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.75d+166) then
tmp = 1.0d0 - x
else
tmp = y * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.75e+166) {
tmp = 1.0 - x;
} else {
tmp = y * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.75e+166: tmp = 1.0 - x else: tmp = y * y return tmp
function code(x, y) tmp = 0.0 if (y <= 1.75e+166) tmp = Float64(1.0 - x); else tmp = Float64(y * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.75e+166) tmp = 1.0 - x; else tmp = y * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.75e+166], N[(1.0 - x), $MachinePrecision], N[(y * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.75 \cdot 10^{+166}:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot y\\
\end{array}
\end{array}
if y < 1.7499999999999999e166Initial program 99.9%
Taylor expanded in y around 0 70.4%
if 1.7499999999999999e166 < y Initial program 99.8%
flip-+33.0%
div-inv33.0%
pow233.0%
*-commutative33.0%
*-commutative33.0%
swap-sqr3.7%
add-sqr-sqrt3.7%
associate--l-3.7%
Applied egg-rr3.7%
Taylor expanded in y around inf 4.9%
mul-1-neg4.9%
unpow24.9%
distribute-rgt-neg-out4.9%
Simplified4.9%
Taylor expanded in x around inf 28.0%
unpow228.0%
Simplified28.0%
Final simplification66.1%
(FPCore (x y) :precision binary64 (if (<= x 1.0) 1.0 (- x)))
double code(double x, double y) {
double tmp;
if (x <= 1.0) {
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 <= 1.0d0) 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 <= 1.0) {
tmp = 1.0;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 1.0: tmp = 1.0 else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if (x <= 1.0) tmp = 1.0; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 1.0) tmp = 1.0; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 1.0], 1.0, (-x)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if x < 1Initial program 99.8%
Taylor expanded in x around 0 62.0%
if 1 < x Initial program 99.9%
Taylor expanded in x around inf 60.6%
mul-1-neg60.6%
Simplified60.6%
Final simplification61.3%
(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 33.7%
Final simplification33.7%
herbie shell --seed 2023192
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, E"
:precision binary64
(+ (- 1.0 x) (* y (sqrt x))))