
(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 11 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%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (* y (sqrt x))))) (if (<= y -5e+38) t_0 (if (<= y 6.2e+84) (- 1.0 x) t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (y * sqrt(x));
double tmp;
if (y <= -5e+38) {
tmp = t_0;
} else if (y <= 6.2e+84) {
tmp = 1.0 - x;
} else {
tmp = 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 = 1.0d0 + (y * sqrt(x))
if (y <= (-5d+38)) then
tmp = t_0
else if (y <= 6.2d+84) then
tmp = 1.0d0 - x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (y * Math.sqrt(x));
double tmp;
if (y <= -5e+38) {
tmp = t_0;
} else if (y <= 6.2e+84) {
tmp = 1.0 - x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (y * math.sqrt(x)) tmp = 0 if y <= -5e+38: tmp = t_0 elif y <= 6.2e+84: tmp = 1.0 - x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(y * sqrt(x))) tmp = 0.0 if (y <= -5e+38) tmp = t_0; elseif (y <= 6.2e+84) tmp = Float64(1.0 - x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (y * sqrt(x)); tmp = 0.0; if (y <= -5e+38) tmp = t_0; elseif (y <= 6.2e+84) tmp = 1.0 - x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5e+38], t$95$0, If[LessEqual[y, 6.2e+84], N[(1.0 - x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + y \cdot \sqrt{x}\\
\mathbf{if}\;y \leq -5 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+84}:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4.9999999999999997e38 or 6.20000000000000006e84 < y Initial program 99.7%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6497.3%
Simplified97.3%
if -4.9999999999999997e38 < y < 6.20000000000000006e84Initial program 100.0%
Taylor expanded in y around 0
--lowering--.f6497.1%
Simplified97.1%
Final simplification97.2%
(FPCore (x y) :precision binary64 (if (<= y -3.3e+39) (* y (sqrt x)) (if (<= y 4.1e+85) (- 1.0 x) (* y (/ x (sqrt x))))))
double code(double x, double y) {
double tmp;
if (y <= -3.3e+39) {
tmp = y * sqrt(x);
} else if (y <= 4.1e+85) {
tmp = 1.0 - x;
} else {
tmp = y * (x / 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.3d+39)) then
tmp = y * sqrt(x)
else if (y <= 4.1d+85) then
tmp = 1.0d0 - x
else
tmp = y * (x / sqrt(x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.3e+39) {
tmp = y * Math.sqrt(x);
} else if (y <= 4.1e+85) {
tmp = 1.0 - x;
} else {
tmp = y * (x / Math.sqrt(x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.3e+39: tmp = y * math.sqrt(x) elif y <= 4.1e+85: tmp = 1.0 - x else: tmp = y * (x / math.sqrt(x)) return tmp
function code(x, y) tmp = 0.0 if (y <= -3.3e+39) tmp = Float64(y * sqrt(x)); elseif (y <= 4.1e+85) tmp = Float64(1.0 - x); else tmp = Float64(y * Float64(x / sqrt(x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.3e+39) tmp = y * sqrt(x); elseif (y <= 4.1e+85) tmp = 1.0 - x; else tmp = y * (x / sqrt(x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.3e+39], N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.1e+85], N[(1.0 - x), $MachinePrecision], N[(y * N[(x / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{+39}:\\
\;\;\;\;y \cdot \sqrt{x}\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+85}:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{\sqrt{x}}\\
\end{array}
\end{array}
if y < -3.30000000000000021e39Initial program 99.7%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6489.5%
Simplified89.5%
if -3.30000000000000021e39 < y < 4.09999999999999978e85Initial program 100.0%
Taylor expanded in y around 0
--lowering--.f6497.1%
Simplified97.1%
if 4.09999999999999978e85 < y Initial program 99.6%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6495.6%
Simplified95.6%
pow1/2N/A
sqr-powN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
metadata-eval77.8%
Applied egg-rr77.8%
pow2N/A
pow-powN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-plusN/A
pow-powN/A
inv-powN/A
pow1/2N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-lft-identityN/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-plusN/A
pow-powN/A
inv-powN/A
pow1/2N/A
/-lowering-/.f64N/A
pow1/2N/A
inv-powN/A
pow-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
pow1/2N/A
sqrt-lowering-sqrt.f6495.7%
Applied egg-rr95.7%
Final simplification95.1%
(FPCore (x y) :precision binary64 (let* ((t_0 (* y (sqrt x)))) (if (<= y -3.3e+39) t_0 (if (<= y 9.8e+84) (- 1.0 x) t_0))))
double code(double x, double y) {
double t_0 = y * sqrt(x);
double tmp;
if (y <= -3.3e+39) {
tmp = t_0;
} else if (y <= 9.8e+84) {
tmp = 1.0 - x;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y * sqrt(x)
if (y <= (-3.3d+39)) then
tmp = t_0
else if (y <= 9.8d+84) then
tmp = 1.0d0 - x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y * Math.sqrt(x);
double tmp;
if (y <= -3.3e+39) {
tmp = t_0;
} else if (y <= 9.8e+84) {
tmp = 1.0 - x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = y * math.sqrt(x) tmp = 0 if y <= -3.3e+39: tmp = t_0 elif y <= 9.8e+84: tmp = 1.0 - x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(y * sqrt(x)) tmp = 0.0 if (y <= -3.3e+39) tmp = t_0; elseif (y <= 9.8e+84) tmp = Float64(1.0 - x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = y * sqrt(x); tmp = 0.0; if (y <= -3.3e+39) tmp = t_0; elseif (y <= 9.8e+84) tmp = 1.0 - x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.3e+39], t$95$0, If[LessEqual[y, 9.8e+84], N[(1.0 - x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \sqrt{x}\\
\mathbf{if}\;y \leq -3.3 \cdot 10^{+39}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{+84}:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.30000000000000021e39 or 9.8e84 < y Initial program 99.7%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6492.1%
Simplified92.1%
if -3.30000000000000021e39 < y < 9.8e84Initial program 100.0%
Taylor expanded in y around 0
--lowering--.f6497.1%
Simplified97.1%
Final simplification95.1%
(FPCore (x y) :precision binary64 (if (<= y -4.9e+155) (/ (- 1.0 (* x (* x x))) (+ 1.0 (/ x (- 1.0 x)))) (if (<= y 2.25e+86) (- 1.0 x) (+ 1.0 (* x (+ x -1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -4.9e+155) {
tmp = (1.0 - (x * (x * x))) / (1.0 + (x / (1.0 - x)));
} else if (y <= 2.25e+86) {
tmp = 1.0 - x;
} else {
tmp = 1.0 + (x * (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 <= (-4.9d+155)) then
tmp = (1.0d0 - (x * (x * x))) / (1.0d0 + (x / (1.0d0 - x)))
else if (y <= 2.25d+86) then
tmp = 1.0d0 - x
else
tmp = 1.0d0 + (x * (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4.9e+155) {
tmp = (1.0 - (x * (x * x))) / (1.0 + (x / (1.0 - x)));
} else if (y <= 2.25e+86) {
tmp = 1.0 - x;
} else {
tmp = 1.0 + (x * (x + -1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.9e+155: tmp = (1.0 - (x * (x * x))) / (1.0 + (x / (1.0 - x))) elif y <= 2.25e+86: tmp = 1.0 - x else: tmp = 1.0 + (x * (x + -1.0)) return tmp
function code(x, y) tmp = 0.0 if (y <= -4.9e+155) tmp = Float64(Float64(1.0 - Float64(x * Float64(x * x))) / Float64(1.0 + Float64(x / Float64(1.0 - x)))); elseif (y <= 2.25e+86) tmp = Float64(1.0 - x); else tmp = Float64(1.0 + Float64(x * Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.9e+155) tmp = (1.0 - (x * (x * x))) / (1.0 + (x / (1.0 - x))); elseif (y <= 2.25e+86) tmp = 1.0 - x; else tmp = 1.0 + (x * (x + -1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.9e+155], N[(N[(1.0 - N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(x / N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.25e+86], N[(1.0 - x), $MachinePrecision], N[(1.0 + N[(x * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.9 \cdot 10^{+155}:\\
\;\;\;\;\frac{1 - x \cdot \left(x \cdot x\right)}{1 + \frac{x}{1 - x}}\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{+86}:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if y < -4.8999999999999997e155Initial program 99.8%
Taylor expanded in y around 0
--lowering--.f643.1%
Simplified3.1%
flip3--N/A
/-lowering-/.f64N/A
metadata-evalN/A
--lowering--.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f641.5%
Applied egg-rr1.5%
/-rgt-identityN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f641.5%
Applied egg-rr1.5%
Taylor expanded in x around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f6425.8%
Simplified25.8%
if -4.8999999999999997e155 < y < 2.24999999999999996e86Initial program 99.9%
Taylor expanded in y around 0
--lowering--.f6488.3%
Simplified88.3%
if 2.24999999999999996e86 < y Initial program 99.6%
Taylor expanded in y around 0
--lowering--.f645.9%
Simplified5.9%
flip3--N/A
/-lowering-/.f64N/A
metadata-evalN/A
--lowering--.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f645.8%
Applied egg-rr5.8%
Taylor expanded in x around 0
Simplified5.8%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6417.3%
Simplified17.3%
(FPCore (x y) :precision binary64 (if (<= y -5.2e+129) (+ -1.0 (* x (- 1.0 x))) (if (<= y 2.25e+86) (- 1.0 x) (+ 1.0 (* x (+ x -1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -5.2e+129) {
tmp = -1.0 + (x * (1.0 - x));
} else if (y <= 2.25e+86) {
tmp = 1.0 - x;
} else {
tmp = 1.0 + (x * (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 <= (-5.2d+129)) then
tmp = (-1.0d0) + (x * (1.0d0 - x))
else if (y <= 2.25d+86) then
tmp = 1.0d0 - x
else
tmp = 1.0d0 + (x * (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.2e+129) {
tmp = -1.0 + (x * (1.0 - x));
} else if (y <= 2.25e+86) {
tmp = 1.0 - x;
} else {
tmp = 1.0 + (x * (x + -1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.2e+129: tmp = -1.0 + (x * (1.0 - x)) elif y <= 2.25e+86: tmp = 1.0 - x else: tmp = 1.0 + (x * (x + -1.0)) return tmp
function code(x, y) tmp = 0.0 if (y <= -5.2e+129) tmp = Float64(-1.0 + Float64(x * Float64(1.0 - x))); elseif (y <= 2.25e+86) tmp = Float64(1.0 - x); else tmp = Float64(1.0 + Float64(x * Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.2e+129) tmp = -1.0 + (x * (1.0 - x)); elseif (y <= 2.25e+86) tmp = 1.0 - x; else tmp = 1.0 + (x * (x + -1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.2e+129], N[(-1.0 + N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.25e+86], N[(1.0 - x), $MachinePrecision], N[(1.0 + N[(x * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+129}:\\
\;\;\;\;-1 + x \cdot \left(1 - x\right)\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{+86}:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if y < -5.20000000000000024e129Initial program 99.8%
Taylor expanded in y around 0
--lowering--.f643.1%
Simplified3.1%
flip3--N/A
/-lowering-/.f64N/A
metadata-evalN/A
--lowering--.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f641.5%
Applied egg-rr1.5%
Taylor expanded in x around 0
Simplified21.9%
Taylor expanded in x around inf
associate--r+N/A
sub-negN/A
distribute-rgt-inN/A
distribute-lft-neg-outN/A
unpow2N/A
associate-/r*N/A
*-rgt-identityN/A
rgt-mult-inverseN/A
associate-*l*N/A
unpow2N/A
associate-*r/N/A
*-rgt-identityN/A
associate-/r/N/A
associate-/r*N/A
unpow2N/A
cube-multN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
Simplified24.1%
if -5.20000000000000024e129 < y < 2.24999999999999996e86Initial program 99.9%
Taylor expanded in y around 0
--lowering--.f6489.8%
Simplified89.8%
if 2.24999999999999996e86 < y Initial program 99.6%
Taylor expanded in y around 0
--lowering--.f645.9%
Simplified5.9%
flip3--N/A
/-lowering-/.f64N/A
metadata-evalN/A
--lowering--.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f645.8%
Applied egg-rr5.8%
Taylor expanded in x around 0
Simplified5.8%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6417.3%
Simplified17.3%
(FPCore (x y) :precision binary64 (if (<= y -1.5e+131) (+ -1.0 (* x (- 1.0 x))) (- 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.5e+131) {
tmp = -1.0 + (x * (1.0 - 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+131)) then
tmp = (-1.0d0) + (x * (1.0d0 - 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+131) {
tmp = -1.0 + (x * (1.0 - x));
} else {
tmp = 1.0 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.5e+131: tmp = -1.0 + (x * (1.0 - x)) else: tmp = 1.0 - x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.5e+131) tmp = Float64(-1.0 + Float64(x * Float64(1.0 - x))); else tmp = Float64(1.0 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.5e+131) tmp = -1.0 + (x * (1.0 - x)); else tmp = 1.0 - x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.5e+131], N[(-1.0 + N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+131}:\\
\;\;\;\;-1 + x \cdot \left(1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;1 - x\\
\end{array}
\end{array}
if y < -1.5000000000000001e131Initial program 99.8%
Taylor expanded in y around 0
--lowering--.f643.1%
Simplified3.1%
flip3--N/A
/-lowering-/.f64N/A
metadata-evalN/A
--lowering--.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f641.5%
Applied egg-rr1.5%
Taylor expanded in x around 0
Simplified21.9%
Taylor expanded in x around inf
associate--r+N/A
sub-negN/A
distribute-rgt-inN/A
distribute-lft-neg-outN/A
unpow2N/A
associate-/r*N/A
*-rgt-identityN/A
rgt-mult-inverseN/A
associate-*l*N/A
unpow2N/A
associate-*r/N/A
*-rgt-identityN/A
associate-/r/N/A
associate-/r*N/A
unpow2N/A
cube-multN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
Simplified24.1%
if -1.5000000000000001e131 < y Initial program 99.9%
Taylor expanded in y around 0
--lowering--.f6472.6%
Simplified72.6%
(FPCore (x y) :precision binary64 (if (<= y -4.7e+135) (- 0.0 (* x x)) (- 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -4.7e+135) {
tmp = 0.0 - (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 <= (-4.7d+135)) then
tmp = 0.0d0 - (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 <= -4.7e+135) {
tmp = 0.0 - (x * x);
} else {
tmp = 1.0 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.7e+135: tmp = 0.0 - (x * x) else: tmp = 1.0 - x return tmp
function code(x, y) tmp = 0.0 if (y <= -4.7e+135) tmp = Float64(0.0 - Float64(x * x)); else tmp = Float64(1.0 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.7e+135) tmp = 0.0 - (x * x); else tmp = 1.0 - x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.7e+135], N[(0.0 - N[(x * x), $MachinePrecision]), $MachinePrecision], N[(1.0 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.7 \cdot 10^{+135}:\\
\;\;\;\;0 - x \cdot x\\
\mathbf{else}:\\
\;\;\;\;1 - x\\
\end{array}
\end{array}
if y < -4.6999999999999998e135Initial program 99.8%
Taylor expanded in y around 0
--lowering--.f643.0%
Simplified3.0%
flip3--N/A
/-lowering-/.f64N/A
metadata-evalN/A
--lowering--.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f641.5%
Applied egg-rr1.5%
Taylor expanded in x around 0
Simplified22.8%
Taylor expanded in x around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
unpow2N/A
*-lowering-*.f6423.6%
Simplified23.6%
if -4.6999999999999998e135 < y Initial program 99.9%
Taylor expanded in y around 0
--lowering--.f6472.0%
Simplified72.0%
(FPCore (x y) :precision binary64 (if (<= x 1.0) 1.0 (- 0.0 x)))
double code(double x, double y) {
double tmp;
if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = 0.0 - 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 = 0.0d0 - 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 = 0.0 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 1.0: tmp = 1.0 else: tmp = 0.0 - x return tmp
function code(x, y) tmp = 0.0 if (x <= 1.0) tmp = 1.0; else tmp = Float64(0.0 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 1.0) tmp = 1.0; else tmp = 0.0 - x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 1.0], 1.0, N[(0.0 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0 - x\\
\end{array}
\end{array}
if x < 1Initial program 99.9%
Taylor expanded in y around 0
--lowering--.f6459.5%
Simplified59.5%
Taylor expanded in x around 0
Simplified58.4%
if 1 < x Initial program 99.9%
Taylor expanded in y around 0
--lowering--.f6463.5%
Simplified63.5%
Taylor expanded in x around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6462.7%
Simplified62.7%
sub0-negN/A
neg-lowering-neg.f6462.7%
Applied egg-rr62.7%
Final simplification60.6%
(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%
Taylor expanded in y around 0
--lowering--.f6461.5%
Simplified61.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.9%
Taylor expanded in y around 0
--lowering--.f6461.5%
Simplified61.5%
Taylor expanded in x around 0
Simplified29.7%
herbie shell --seed 2024161
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, E"
:precision binary64
(+ (- 1.0 x) (* y (sqrt x))))