
(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 8 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 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%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -5.9e+97)
1.0
(if (<= y -1.4e+59)
(/ (- x) y)
(if (<= y -5200000.0)
1.0
(if (<= y 3.9e-51) x (if (<= y 1.0) (* y (- -1.0 y)) 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -5.9e+97) {
tmp = 1.0;
} else if (y <= -1.4e+59) {
tmp = -x / y;
} else if (y <= -5200000.0) {
tmp = 1.0;
} else if (y <= 3.9e-51) {
tmp = x;
} else if (y <= 1.0) {
tmp = y * (-1.0 - 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 <= (-5.9d+97)) then
tmp = 1.0d0
else if (y <= (-1.4d+59)) then
tmp = -x / y
else if (y <= (-5200000.0d0)) then
tmp = 1.0d0
else if (y <= 3.9d-51) then
tmp = x
else if (y <= 1.0d0) then
tmp = y * ((-1.0d0) - y)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.9e+97) {
tmp = 1.0;
} else if (y <= -1.4e+59) {
tmp = -x / y;
} else if (y <= -5200000.0) {
tmp = 1.0;
} else if (y <= 3.9e-51) {
tmp = x;
} else if (y <= 1.0) {
tmp = y * (-1.0 - y);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.9e+97: tmp = 1.0 elif y <= -1.4e+59: tmp = -x / y elif y <= -5200000.0: tmp = 1.0 elif y <= 3.9e-51: tmp = x elif y <= 1.0: tmp = y * (-1.0 - y) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -5.9e+97) tmp = 1.0; elseif (y <= -1.4e+59) tmp = Float64(Float64(-x) / y); elseif (y <= -5200000.0) tmp = 1.0; elseif (y <= 3.9e-51) tmp = x; elseif (y <= 1.0) tmp = Float64(y * Float64(-1.0 - y)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.9e+97) tmp = 1.0; elseif (y <= -1.4e+59) tmp = -x / y; elseif (y <= -5200000.0) tmp = 1.0; elseif (y <= 3.9e-51) tmp = x; elseif (y <= 1.0) tmp = y * (-1.0 - y); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.9e+97], 1.0, If[LessEqual[y, -1.4e+59], N[((-x) / y), $MachinePrecision], If[LessEqual[y, -5200000.0], 1.0, If[LessEqual[y, 3.9e-51], x, If[LessEqual[y, 1.0], N[(y * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{+97}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{+59}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;y \leq -5200000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{-51}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y \cdot \left(-1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.90000000000000009e97 or -1.3999999999999999e59 < y < -5.2e6 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 82.1%
if -5.90000000000000009e97 < y < -1.3999999999999999e59Initial program 100.0%
Taylor expanded in x around inf 86.5%
Taylor expanded in y around inf 86.5%
neg-mul-186.5%
distribute-neg-frac86.5%
Simplified86.5%
if -5.2e6 < y < 3.8999999999999997e-51Initial program 100.0%
Taylor expanded in y around 0 82.4%
if 3.8999999999999997e-51 < y < 1Initial program 99.9%
Taylor expanded in x around 0 69.9%
metadata-eval69.9%
times-frac69.9%
*-lft-identity69.9%
neg-mul-169.9%
neg-sub069.9%
associate--r-69.9%
metadata-eval69.9%
Simplified69.9%
Taylor expanded in y around 0 67.5%
mul-1-neg67.5%
unpow267.5%
distribute-lft-neg-in67.5%
distribute-rgt-in67.5%
sub-neg67.5%
Simplified67.5%
Final simplification81.7%
(FPCore (x y)
:precision binary64
(if (<= y -5.9e+97)
1.0
(if (<= y -1.65e+59)
(/ (- x) y)
(if (<= y -6800000000.0)
1.0
(if (<= y 1.65e-50)
(/ x (- 1.0 y))
(if (<= y 1.0) (* y (- -1.0 y)) 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -5.9e+97) {
tmp = 1.0;
} else if (y <= -1.65e+59) {
tmp = -x / y;
} else if (y <= -6800000000.0) {
tmp = 1.0;
} else if (y <= 1.65e-50) {
tmp = x / (1.0 - y);
} else if (y <= 1.0) {
tmp = y * (-1.0 - 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 <= (-5.9d+97)) then
tmp = 1.0d0
else if (y <= (-1.65d+59)) then
tmp = -x / y
else if (y <= (-6800000000.0d0)) then
tmp = 1.0d0
else if (y <= 1.65d-50) then
tmp = x / (1.0d0 - y)
else if (y <= 1.0d0) then
tmp = y * ((-1.0d0) - y)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.9e+97) {
tmp = 1.0;
} else if (y <= -1.65e+59) {
tmp = -x / y;
} else if (y <= -6800000000.0) {
tmp = 1.0;
} else if (y <= 1.65e-50) {
tmp = x / (1.0 - y);
} else if (y <= 1.0) {
tmp = y * (-1.0 - y);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.9e+97: tmp = 1.0 elif y <= -1.65e+59: tmp = -x / y elif y <= -6800000000.0: tmp = 1.0 elif y <= 1.65e-50: tmp = x / (1.0 - y) elif y <= 1.0: tmp = y * (-1.0 - y) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -5.9e+97) tmp = 1.0; elseif (y <= -1.65e+59) tmp = Float64(Float64(-x) / y); elseif (y <= -6800000000.0) tmp = 1.0; elseif (y <= 1.65e-50) tmp = Float64(x / Float64(1.0 - y)); elseif (y <= 1.0) tmp = Float64(y * Float64(-1.0 - y)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.9e+97) tmp = 1.0; elseif (y <= -1.65e+59) tmp = -x / y; elseif (y <= -6800000000.0) tmp = 1.0; elseif (y <= 1.65e-50) tmp = x / (1.0 - y); elseif (y <= 1.0) tmp = y * (-1.0 - y); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.9e+97], 1.0, If[LessEqual[y, -1.65e+59], N[((-x) / y), $MachinePrecision], If[LessEqual[y, -6800000000.0], 1.0, If[LessEqual[y, 1.65e-50], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(y * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{+97}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.65 \cdot 10^{+59}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;y \leq -6800000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{-50}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y \cdot \left(-1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.90000000000000009e97 or -1.65e59 < y < -6.8e9 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 82.1%
if -5.90000000000000009e97 < y < -1.65e59Initial program 100.0%
Taylor expanded in x around inf 86.5%
Taylor expanded in y around inf 86.5%
neg-mul-186.5%
distribute-neg-frac86.5%
Simplified86.5%
if -6.8e9 < y < 1.6499999999999999e-50Initial program 100.0%
Taylor expanded in x around inf 83.5%
if 1.6499999999999999e-50 < y < 1Initial program 99.9%
Taylor expanded in x around 0 69.9%
metadata-eval69.9%
times-frac69.9%
*-lft-identity69.9%
neg-mul-169.9%
neg-sub069.9%
associate--r-69.9%
metadata-eval69.9%
Simplified69.9%
Taylor expanded in y around 0 67.5%
mul-1-neg67.5%
unpow267.5%
distribute-lft-neg-in67.5%
distribute-rgt-in67.5%
sub-neg67.5%
Simplified67.5%
Final simplification82.3%
(FPCore (x y)
:precision binary64
(if (<= y -5.8e+97)
1.0
(if (<= y -1.65e+59)
(/ (- x) y)
(if (or (<= y -42000000.0) (not (<= y 2.35e-50)))
(/ y (+ y -1.0))
(/ x (- 1.0 y))))))
double code(double x, double y) {
double tmp;
if (y <= -5.8e+97) {
tmp = 1.0;
} else if (y <= -1.65e+59) {
tmp = -x / y;
} else if ((y <= -42000000.0) || !(y <= 2.35e-50)) {
tmp = y / (y + -1.0);
} 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 <= (-5.8d+97)) then
tmp = 1.0d0
else if (y <= (-1.65d+59)) then
tmp = -x / y
else if ((y <= (-42000000.0d0)) .or. (.not. (y <= 2.35d-50))) then
tmp = y / (y + (-1.0d0))
else
tmp = x / (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.8e+97) {
tmp = 1.0;
} else if (y <= -1.65e+59) {
tmp = -x / y;
} else if ((y <= -42000000.0) || !(y <= 2.35e-50)) {
tmp = y / (y + -1.0);
} else {
tmp = x / (1.0 - y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.8e+97: tmp = 1.0 elif y <= -1.65e+59: tmp = -x / y elif (y <= -42000000.0) or not (y <= 2.35e-50): tmp = y / (y + -1.0) else: tmp = x / (1.0 - y) return tmp
function code(x, y) tmp = 0.0 if (y <= -5.8e+97) tmp = 1.0; elseif (y <= -1.65e+59) tmp = Float64(Float64(-x) / y); elseif ((y <= -42000000.0) || !(y <= 2.35e-50)) tmp = Float64(y / Float64(y + -1.0)); else tmp = Float64(x / Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.8e+97) tmp = 1.0; elseif (y <= -1.65e+59) tmp = -x / y; elseif ((y <= -42000000.0) || ~((y <= 2.35e-50))) tmp = y / (y + -1.0); else tmp = x / (1.0 - y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.8e+97], 1.0, If[LessEqual[y, -1.65e+59], N[((-x) / y), $MachinePrecision], If[Or[LessEqual[y, -42000000.0], N[Not[LessEqual[y, 2.35e-50]], $MachinePrecision]], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+97}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.65 \cdot 10^{+59}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;y \leq -42000000 \lor \neg \left(y \leq 2.35 \cdot 10^{-50}\right):\\
\;\;\;\;\frac{y}{y + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 - y}\\
\end{array}
\end{array}
if y < -5.79999999999999974e97Initial program 99.9%
Taylor expanded in y around inf 78.7%
if -5.79999999999999974e97 < y < -1.65e59Initial program 100.0%
Taylor expanded in x around inf 86.5%
Taylor expanded in y around inf 86.5%
neg-mul-186.5%
distribute-neg-frac86.5%
Simplified86.5%
if -1.65e59 < y < -4.2e7 or 2.3500000000000001e-50 < y Initial program 100.0%
Taylor expanded in x around 0 83.6%
metadata-eval83.6%
times-frac83.6%
*-lft-identity83.6%
neg-mul-183.6%
neg-sub083.6%
associate--r-83.6%
metadata-eval83.6%
Simplified83.6%
if -4.2e7 < y < 2.3500000000000001e-50Initial program 100.0%
Taylor expanded in x around inf 83.5%
Final simplification82.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (- 1.0 x) y))))
(if (<= y -46000000.0)
t_0
(if (<= y 9.2e-52)
(/ x (- 1.0 y))
(if (<= y 4050000.0) (/ y (+ y -1.0)) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 + ((1.0 - x) / y);
double tmp;
if (y <= -46000000.0) {
tmp = t_0;
} else if (y <= 9.2e-52) {
tmp = x / (1.0 - y);
} else if (y <= 4050000.0) {
tmp = y / (y + -1.0);
} 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 + ((1.0d0 - x) / y)
if (y <= (-46000000.0d0)) then
tmp = t_0
else if (y <= 9.2d-52) then
tmp = x / (1.0d0 - y)
else if (y <= 4050000.0d0) then
tmp = y / (y + (-1.0d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + ((1.0 - x) / y);
double tmp;
if (y <= -46000000.0) {
tmp = t_0;
} else if (y <= 9.2e-52) {
tmp = x / (1.0 - y);
} else if (y <= 4050000.0) {
tmp = y / (y + -1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((1.0 - x) / y) tmp = 0 if y <= -46000000.0: tmp = t_0 elif y <= 9.2e-52: tmp = x / (1.0 - y) elif y <= 4050000.0: tmp = y / (y + -1.0) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(Float64(1.0 - x) / y)) tmp = 0.0 if (y <= -46000000.0) tmp = t_0; elseif (y <= 9.2e-52) tmp = Float64(x / Float64(1.0 - y)); elseif (y <= 4050000.0) tmp = Float64(y / Float64(y + -1.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + ((1.0 - x) / y); tmp = 0.0; if (y <= -46000000.0) tmp = t_0; elseif (y <= 9.2e-52) tmp = x / (1.0 - y); elseif (y <= 4050000.0) tmp = y / (y + -1.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -46000000.0], t$95$0, If[LessEqual[y, 9.2e-52], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4050000.0], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -46000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{-52}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{elif}\;y \leq 4050000:\\
\;\;\;\;\frac{y}{y + -1}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -4.6e7 or 4.05e6 < y Initial program 100.0%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
div-sub100.0%
Simplified100.0%
if -4.6e7 < y < 9.19999999999999977e-52Initial program 100.0%
Taylor expanded in x around inf 83.5%
if 9.19999999999999977e-52 < y < 4.05e6Initial program 99.9%
Taylor expanded in x around 0 72.4%
metadata-eval72.4%
times-frac72.4%
*-lft-identity72.4%
neg-mul-172.4%
neg-sub072.4%
associate--r-72.4%
metadata-eval72.4%
Simplified72.4%
Final simplification90.5%
(FPCore (x y)
:precision binary64
(if (<= y -6.2e+97)
1.0
(if (<= y -5e+57)
(/ (- x) y)
(if (<= y -5200000.0) 1.0 (if (<= y 1.0) x 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -6.2e+97) {
tmp = 1.0;
} else if (y <= -5e+57) {
tmp = -x / y;
} else if (y <= -5200000.0) {
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 <= (-6.2d+97)) then
tmp = 1.0d0
else if (y <= (-5d+57)) then
tmp = -x / y
else if (y <= (-5200000.0d0)) 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 <= -6.2e+97) {
tmp = 1.0;
} else if (y <= -5e+57) {
tmp = -x / y;
} else if (y <= -5200000.0) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -6.2e+97: tmp = 1.0 elif y <= -5e+57: tmp = -x / y elif y <= -5200000.0: tmp = 1.0 elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -6.2e+97) tmp = 1.0; elseif (y <= -5e+57) tmp = Float64(Float64(-x) / y); elseif (y <= -5200000.0) 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 <= -6.2e+97) tmp = 1.0; elseif (y <= -5e+57) tmp = -x / y; elseif (y <= -5200000.0) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -6.2e+97], 1.0, If[LessEqual[y, -5e+57], N[((-x) / y), $MachinePrecision], If[LessEqual[y, -5200000.0], 1.0, If[LessEqual[y, 1.0], x, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{+97}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -5 \cdot 10^{+57}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;y \leq -5200000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -6.19999999999999962e97 or -4.99999999999999972e57 < y < -5.2e6 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 82.1%
if -6.19999999999999962e97 < y < -4.99999999999999972e57Initial program 100.0%
Taylor expanded in x around inf 86.5%
Taylor expanded in y around inf 86.5%
neg-mul-186.5%
distribute-neg-frac86.5%
Simplified86.5%
if -5.2e6 < y < 1Initial program 100.0%
Taylor expanded in y around 0 78.2%
Final simplification80.1%
(FPCore (x y) :precision binary64 (if (<= y -5200000.0) 1.0 (if (<= y 1.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -5200000.0) {
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 <= (-5200000.0d0)) 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 <= -5200000.0) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5200000.0: tmp = 1.0 elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -5200000.0) 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 <= -5200000.0) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5200000.0], 1.0, If[LessEqual[y, 1.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5200000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.2e6 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 78.2%
if -5.2e6 < y < 1Initial program 100.0%
Taylor expanded in y around 0 78.2%
Final simplification78.2%
(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 37.6%
Final simplification37.6%
herbie shell --seed 2023271
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, C"
:precision binary64
(/ (- x y) (- 1.0 y)))