
(FPCore (x y) :precision binary64 (/ (- x y) (- 1.0 y)))
double code(double x, double y) {
return (x - y) / (1.0 - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (1.0d0 - y)
end function
public static double code(double x, double y) {
return (x - y) / (1.0 - y);
}
def code(x, y): return (x - y) / (1.0 - y)
function code(x, y) return Float64(Float64(x - y) / Float64(1.0 - y)) end
function tmp = code(x, y) tmp = (x - y) / (1.0 - y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{1 - y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (- x y) (- 1.0 y)))
double code(double x, double y) {
return (x - y) / (1.0 - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (1.0d0 - y)
end function
public static double code(double x, double y) {
return (x - y) / (1.0 - y);
}
def code(x, y): return (x - y) / (1.0 - y)
function code(x, y) return Float64(Float64(x - y) / Float64(1.0 - y)) end
function tmp = code(x, y) tmp = (x - y) / (1.0 - y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{1 - y}
\end{array}
(FPCore (x y) :precision binary64 (+ (/ x (- 1.0 y)) (/ y (+ y -1.0))))
double code(double x, double y) {
return (x / (1.0 - y)) + (y / (y + -1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (1.0d0 - y)) + (y / (y + (-1.0d0)))
end function
public static double code(double x, double y) {
return (x / (1.0 - y)) + (y / (y + -1.0));
}
def code(x, y): return (x / (1.0 - y)) + (y / (y + -1.0))
function code(x, y) return Float64(Float64(x / Float64(1.0 - y)) + Float64(y / Float64(y + -1.0))) end
function tmp = code(x, y) tmp = (x / (1.0 - y)) + (y / (y + -1.0)); end
code[x_, y_] := N[(N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision] + N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{1 - y} + \frac{y}{y + -1}
\end{array}
Initial program 100.0%
div-sub100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (or (<= y -1.05e-8) (not (<= y 2.8e-5))) (- (/ x (- 1.0 y)) -1.0) (+ x (* y (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.05e-8) || !(y <= 2.8e-5)) {
tmp = (x / (1.0 - y)) - -1.0;
} else {
tmp = x + (y * (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 <= (-1.05d-8)) .or. (.not. (y <= 2.8d-5))) then
tmp = (x / (1.0d0 - y)) - (-1.0d0)
else
tmp = x + (y * (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.05e-8) || !(y <= 2.8e-5)) {
tmp = (x / (1.0 - y)) - -1.0;
} else {
tmp = x + (y * (x + -1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.05e-8) or not (y <= 2.8e-5): tmp = (x / (1.0 - y)) - -1.0 else: tmp = x + (y * (x + -1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.05e-8) || !(y <= 2.8e-5)) tmp = Float64(Float64(x / Float64(1.0 - y)) - -1.0); else tmp = Float64(x + Float64(y * Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.05e-8) || ~((y <= 2.8e-5))) tmp = (x / (1.0 - y)) - -1.0; else tmp = x + (y * (x + -1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.05e-8], N[Not[LessEqual[y, 2.8e-5]], $MachinePrecision]], N[(N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision], N[(x + N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{-8} \lor \neg \left(y \leq 2.8 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{x}{1 - y} - -1\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if y < -1.04999999999999997e-8 or 2.79999999999999996e-5 < y Initial program 100.0%
div-sub100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 97.9%
if -1.04999999999999997e-8 < y < 2.79999999999999996e-5Initial program 100.0%
Taylor expanded in y around 0 99.1%
mul-1-neg99.1%
unsub-neg99.1%
mul-1-neg99.1%
sub-neg99.1%
Simplified99.1%
Final simplification98.5%
(FPCore (x y) :precision binary64 (if (<= y -1.0) (+ 1.0 (/ (- 1.0 x) y)) (if (<= y 1.0) (+ x (* y (+ x -1.0))) (- 1.0 (/ x y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0 + ((1.0 - x) / y);
} else if (y <= 1.0) {
tmp = x + (y * (x + -1.0));
} else {
tmp = 1.0 - (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.0d0)) then
tmp = 1.0d0 + ((1.0d0 - x) / y)
else if (y <= 1.0d0) then
tmp = x + (y * (x + (-1.0d0)))
else
tmp = 1.0d0 - (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0 + ((1.0 - x) / y);
} else if (y <= 1.0) {
tmp = x + (y * (x + -1.0));
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 + ((1.0 - x) / y) elif y <= 1.0: tmp = x + (y * (x + -1.0)) else: tmp = 1.0 - (x / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(1.0 + Float64(Float64(1.0 - x) / y)); elseif (y <= 1.0) tmp = Float64(x + Float64(y * Float64(x + -1.0))); else tmp = Float64(1.0 - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = 1.0 + ((1.0 - x) / y); elseif (y <= 1.0) tmp = x + (y * (x + -1.0)); else tmp = 1.0 - (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(x + N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1 + \frac{1 - x}{y}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x + y \cdot \left(x + -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y}\\
\end{array}
\end{array}
if y < -1Initial program 100.0%
Taylor expanded in y around inf 97.8%
+-commutative97.8%
mul-1-neg97.8%
sub-neg97.8%
div-sub97.8%
Simplified97.8%
if -1 < y < 1Initial program 100.0%
Taylor expanded in y around 0 97.3%
mul-1-neg97.3%
unsub-neg97.3%
mul-1-neg97.3%
sub-neg97.3%
Simplified97.3%
if 1 < y Initial program 99.9%
div-sub100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in y around inf 99.6%
neg-mul-199.6%
unsub-neg99.6%
Simplified99.6%
Final simplification97.9%
(FPCore (x y) :precision binary64 (if (or (<= y -0.112) (not (<= y 53000.0))) (- 1.0 (/ x y)) (/ x (- 1.0 y))))
double code(double x, double y) {
double tmp;
if ((y <= -0.112) || !(y <= 53000.0)) {
tmp = 1.0 - (x / y);
} else {
tmp = x / (1.0 - y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-0.112d0)) .or. (.not. (y <= 53000.0d0))) then
tmp = 1.0d0 - (x / y)
else
tmp = x / (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -0.112) || !(y <= 53000.0)) {
tmp = 1.0 - (x / y);
} else {
tmp = x / (1.0 - y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -0.112) or not (y <= 53000.0): tmp = 1.0 - (x / y) else: tmp = x / (1.0 - y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -0.112) || !(y <= 53000.0)) tmp = Float64(1.0 - Float64(x / y)); else tmp = Float64(x / Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -0.112) || ~((y <= 53000.0))) tmp = 1.0 - (x / y); else tmp = x / (1.0 - y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -0.112], N[Not[LessEqual[y, 53000.0]], $MachinePrecision]], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.112 \lor \neg \left(y \leq 53000\right):\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 - y}\\
\end{array}
\end{array}
if y < -0.112000000000000002 or 53000 < y Initial program 99.9%
div-sub100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 97.8%
Taylor expanded in y around inf 96.8%
neg-mul-196.8%
unsub-neg96.8%
Simplified96.8%
if -0.112000000000000002 < y < 53000Initial program 100.0%
Taylor expanded in x around inf 74.6%
Final simplification85.3%
(FPCore (x y) :precision binary64 (if (or (<= y -0.084) (not (<= y 1.0))) (- 1.0 (/ x y)) (+ x (* x y))))
double code(double x, double y) {
double tmp;
if ((y <= -0.084) || !(y <= 1.0)) {
tmp = 1.0 - (x / y);
} else {
tmp = x + (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 <= (-0.084d0)) .or. (.not. (y <= 1.0d0))) then
tmp = 1.0d0 - (x / y)
else
tmp = x + (x * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -0.084) || !(y <= 1.0)) {
tmp = 1.0 - (x / y);
} else {
tmp = x + (x * y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -0.084) or not (y <= 1.0): tmp = 1.0 - (x / y) else: tmp = x + (x * y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -0.084) || !(y <= 1.0)) tmp = Float64(1.0 - Float64(x / y)); else tmp = Float64(x + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -0.084) || ~((y <= 1.0))) tmp = 1.0 - (x / y); else tmp = x + (x * y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -0.084], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.084 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot y\\
\end{array}
\end{array}
if y < -0.0840000000000000052 or 1 < y Initial program 99.9%
div-sub100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 97.8%
Taylor expanded in y around inf 96.8%
neg-mul-196.8%
unsub-neg96.8%
Simplified96.8%
if -0.0840000000000000052 < y < 1Initial program 100.0%
Taylor expanded in x around inf 74.6%
Taylor expanded in y around 0 74.0%
*-commutative74.0%
Simplified74.0%
Final simplification84.9%
(FPCore (x y) :precision binary64 (if (<= y -310.0) (+ 1.0 (/ (- 1.0 x) y)) (if (<= y 460000.0) (/ x (- 1.0 y)) (- 1.0 (/ x y)))))
double code(double x, double y) {
double tmp;
if (y <= -310.0) {
tmp = 1.0 + ((1.0 - x) / y);
} else if (y <= 460000.0) {
tmp = x / (1.0 - y);
} else {
tmp = 1.0 - (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 <= (-310.0d0)) then
tmp = 1.0d0 + ((1.0d0 - x) / y)
else if (y <= 460000.0d0) then
tmp = x / (1.0d0 - y)
else
tmp = 1.0d0 - (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -310.0) {
tmp = 1.0 + ((1.0 - x) / y);
} else if (y <= 460000.0) {
tmp = x / (1.0 - y);
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -310.0: tmp = 1.0 + ((1.0 - x) / y) elif y <= 460000.0: tmp = x / (1.0 - y) else: tmp = 1.0 - (x / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -310.0) tmp = Float64(1.0 + Float64(Float64(1.0 - x) / y)); elseif (y <= 460000.0) tmp = Float64(x / Float64(1.0 - y)); else tmp = Float64(1.0 - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -310.0) tmp = 1.0 + ((1.0 - x) / y); elseif (y <= 460000.0) tmp = x / (1.0 - y); else tmp = 1.0 - (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -310.0], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 460000.0], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -310:\\
\;\;\;\;1 + \frac{1 - x}{y}\\
\mathbf{elif}\;y \leq 460000:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y}\\
\end{array}
\end{array}
if y < -310Initial program 100.0%
Taylor expanded in y around inf 97.8%
+-commutative97.8%
mul-1-neg97.8%
sub-neg97.8%
div-sub97.8%
Simplified97.8%
if -310 < y < 4.6e5Initial program 100.0%
Taylor expanded in x around inf 73.6%
if 4.6e5 < y Initial program 99.9%
div-sub100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in y around inf 99.6%
neg-mul-199.6%
unsub-neg99.6%
Simplified99.6%
(FPCore (x y) :precision binary64 (if (<= y -1.0) (+ 1.0 (/ 1.0 y)) (if (<= y 1.0) (+ x (* x y)) 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0 + (1.0 / y);
} else if (y <= 1.0) {
tmp = x + (x * y);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = 1.0d0 + (1.0d0 / y)
else if (y <= 1.0d0) then
tmp = x + (x * y)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0 + (1.0 / y);
} else if (y <= 1.0) {
tmp = x + (x * y);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 + (1.0 / y) elif y <= 1.0: tmp = x + (x * y) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(1.0 + Float64(1.0 / y)); elseif (y <= 1.0) tmp = Float64(x + Float64(x * y)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = 1.0 + (1.0 / y); elseif (y <= 1.0) tmp = x + (x * y); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], N[(1.0 + N[(1.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1 + \frac{1}{y}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1Initial program 100.0%
Taylor expanded in y around inf 97.8%
+-commutative97.8%
mul-1-neg97.8%
sub-neg97.8%
div-sub97.8%
Simplified97.8%
Taylor expanded in x around 0 69.0%
if -1 < y < 1Initial program 100.0%
Taylor expanded in x around inf 73.6%
Taylor expanded in y around 0 72.9%
*-commutative72.9%
Simplified72.9%
if 1 < y Initial program 99.9%
Taylor expanded in y around inf 75.1%
Final simplification72.4%
(FPCore (x y) :precision binary64 (if (<= y -1.1) (+ 1.0 (/ 1.0 y)) (if (<= y 1.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.1) {
tmp = 1.0 + (1.0 / y);
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.1d0)) then
tmp = 1.0d0 + (1.0d0 / y)
else if (y <= 1.0d0) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.1) {
tmp = 1.0 + (1.0 / y);
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.1: tmp = 1.0 + (1.0 / y) elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.1) tmp = Float64(1.0 + Float64(1.0 / y)); elseif (y <= 1.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.1) tmp = 1.0 + (1.0 / y); elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.1], N[(1.0 + N[(1.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1:\\
\;\;\;\;1 + \frac{1}{y}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.1000000000000001Initial program 100.0%
Taylor expanded in y around inf 97.8%
+-commutative97.8%
mul-1-neg97.8%
sub-neg97.8%
div-sub97.8%
Simplified97.8%
Taylor expanded in x around 0 69.0%
if -1.1000000000000001 < y < 1Initial program 100.0%
Taylor expanded in y around 0 72.2%
if 1 < y Initial program 99.9%
Taylor expanded in y around inf 75.1%
(FPCore (x y) :precision binary64 (if (<= y -0.0063) 1.0 (if (<= y 1.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -0.0063) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-0.0063d0)) then
tmp = 1.0d0
else if (y <= 1.0d0) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -0.0063) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -0.0063: tmp = 1.0 elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -0.0063) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -0.0063) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -0.0063], 1.0, If[LessEqual[y, 1.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0063:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -0.0063 or 1 < y Initial program 99.9%
Taylor expanded in y around inf 70.7%
if -0.0063 < y < 1Initial program 100.0%
Taylor expanded in y around 0 73.2%
(FPCore (x y) :precision binary64 (/ (- x y) (- 1.0 y)))
double code(double x, double y) {
return (x - y) / (1.0 - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (1.0d0 - y)
end function
public static double code(double x, double y) {
return (x - y) / (1.0 - y);
}
def code(x, y): return (x - y) / (1.0 - y)
function code(x, y) return Float64(Float64(x - y) / Float64(1.0 - y)) end
function tmp = code(x, y) tmp = (x - y) / (1.0 - y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{1 - y}
\end{array}
Initial program 100.0%
(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 100.0%
Taylor expanded in y around inf 36.0%
herbie shell --seed 2024156
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, C"
:precision binary64
(/ (- x y) (- 1.0 y)))