
(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 10 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%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (- 1.0 x) y))))
(if (<= y -3000.0)
t_0
(if (<= y 1.5e-139)
(/ x (- 1.0 y))
(if (<= y 5.7e-115) (- y) (if (<= y 1.0) (+ x (* x y)) t_0))))))
double code(double x, double y) {
double t_0 = 1.0 + ((1.0 - x) / y);
double tmp;
if (y <= -3000.0) {
tmp = t_0;
} else if (y <= 1.5e-139) {
tmp = x / (1.0 - y);
} else if (y <= 5.7e-115) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x + (x * y);
} 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 <= (-3000.0d0)) then
tmp = t_0
else if (y <= 1.5d-139) then
tmp = x / (1.0d0 - y)
else if (y <= 5.7d-115) then
tmp = -y
else if (y <= 1.0d0) then
tmp = x + (x * y)
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 <= -3000.0) {
tmp = t_0;
} else if (y <= 1.5e-139) {
tmp = x / (1.0 - y);
} else if (y <= 5.7e-115) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x + (x * y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((1.0 - x) / y) tmp = 0 if y <= -3000.0: tmp = t_0 elif y <= 1.5e-139: tmp = x / (1.0 - y) elif y <= 5.7e-115: tmp = -y elif y <= 1.0: tmp = x + (x * y) 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 <= -3000.0) tmp = t_0; elseif (y <= 1.5e-139) tmp = Float64(x / Float64(1.0 - y)); elseif (y <= 5.7e-115) tmp = Float64(-y); elseif (y <= 1.0) tmp = Float64(x + Float64(x * y)); 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 <= -3000.0) tmp = t_0; elseif (y <= 1.5e-139) tmp = x / (1.0 - y); elseif (y <= 5.7e-115) tmp = -y; elseif (y <= 1.0) tmp = x + (x * y); 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, -3000.0], t$95$0, If[LessEqual[y, 1.5e-139], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.7e-115], (-y), If[LessEqual[y, 1.0], N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -3000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{-139}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{elif}\;y \leq 5.7 \cdot 10^{-115}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3e3 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 98.7%
+-commutative98.7%
mul-1-neg98.7%
sub-neg98.7%
div-sub98.7%
Simplified98.7%
if -3e3 < y < 1.5e-139Initial program 100.0%
Taylor expanded in x around inf 86.4%
if 1.5e-139 < y < 5.7000000000000001e-115Initial program 100.0%
Taylor expanded in x around 0 100.0%
neg-mul-1100.0%
distribute-neg-frac2100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
neg-mul-1100.0%
Simplified100.0%
if 5.7000000000000001e-115 < y < 1Initial program 100.0%
Taylor expanded in x around inf 57.3%
Taylor expanded in y around 0 57.3%
*-commutative57.3%
Simplified57.3%
Final simplification90.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -0.00024)
t_0
(if (<= y 4.5e-138)
(/ x (- 1.0 y))
(if (<= y 5.5e-115) (- y) (if (<= y 1.0) (+ x (* x y)) t_0))))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -0.00024) {
tmp = t_0;
} else if (y <= 4.5e-138) {
tmp = x / (1.0 - y);
} else if (y <= 5.5e-115) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x + (x * y);
} 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 - (x / y)
if (y <= (-0.00024d0)) then
tmp = t_0
else if (y <= 4.5d-138) then
tmp = x / (1.0d0 - y)
else if (y <= 5.5d-115) then
tmp = -y
else if (y <= 1.0d0) then
tmp = x + (x * y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -0.00024) {
tmp = t_0;
} else if (y <= 4.5e-138) {
tmp = x / (1.0 - y);
} else if (y <= 5.5e-115) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x + (x * y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) tmp = 0 if y <= -0.00024: tmp = t_0 elif y <= 4.5e-138: tmp = x / (1.0 - y) elif y <= 5.5e-115: tmp = -y elif y <= 1.0: tmp = x + (x * y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -0.00024) tmp = t_0; elseif (y <= 4.5e-138) tmp = Float64(x / Float64(1.0 - y)); elseif (y <= 5.5e-115) tmp = Float64(-y); elseif (y <= 1.0) tmp = Float64(x + Float64(x * y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (x / y); tmp = 0.0; if (y <= -0.00024) tmp = t_0; elseif (y <= 4.5e-138) tmp = x / (1.0 - y); elseif (y <= 5.5e-115) tmp = -y; elseif (y <= 1.0) tmp = x + (x * y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.00024], t$95$0, If[LessEqual[y, 4.5e-138], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e-115], (-y), If[LessEqual[y, 1.0], N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -0.00024:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-138}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-115}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.40000000000000006e-4 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 98.0%
+-commutative98.0%
mul-1-neg98.0%
sub-neg98.0%
div-sub98.0%
Simplified98.0%
Taylor expanded in x around inf 97.2%
neg-mul-197.2%
distribute-neg-frac297.2%
Simplified97.2%
Taylor expanded in x around 0 97.2%
mul-1-neg97.2%
sub-neg97.2%
Simplified97.2%
if -2.40000000000000006e-4 < y < 4.50000000000000008e-138Initial program 100.0%
Taylor expanded in x around inf 87.2%
if 4.50000000000000008e-138 < y < 5.50000000000000028e-115Initial program 100.0%
Taylor expanded in x around 0 100.0%
neg-mul-1100.0%
distribute-neg-frac2100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
neg-mul-1100.0%
Simplified100.0%
if 5.50000000000000028e-115 < y < 1Initial program 100.0%
Taylor expanded in x around inf 57.3%
Taylor expanded in y around 0 57.3%
*-commutative57.3%
Simplified57.3%
Final simplification90.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))) (t_1 (+ x (* x y))))
(if (<= y -0.00024)
t_0
(if (<= y 5.5e-138)
t_1
(if (<= y 4.2e-114) (- y) (if (<= y 1.0) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double t_1 = x + (x * y);
double tmp;
if (y <= -0.00024) {
tmp = t_0;
} else if (y <= 5.5e-138) {
tmp = t_1;
} else if (y <= 4.2e-114) {
tmp = -y;
} else if (y <= 1.0) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (x / y)
t_1 = x + (x * y)
if (y <= (-0.00024d0)) then
tmp = t_0
else if (y <= 5.5d-138) then
tmp = t_1
else if (y <= 4.2d-114) then
tmp = -y
else if (y <= 1.0d0) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double t_1 = x + (x * y);
double tmp;
if (y <= -0.00024) {
tmp = t_0;
} else if (y <= 5.5e-138) {
tmp = t_1;
} else if (y <= 4.2e-114) {
tmp = -y;
} else if (y <= 1.0) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) t_1 = x + (x * y) tmp = 0 if y <= -0.00024: tmp = t_0 elif y <= 5.5e-138: tmp = t_1 elif y <= 4.2e-114: tmp = -y elif y <= 1.0: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) t_1 = Float64(x + Float64(x * y)) tmp = 0.0 if (y <= -0.00024) tmp = t_0; elseif (y <= 5.5e-138) tmp = t_1; elseif (y <= 4.2e-114) tmp = Float64(-y); elseif (y <= 1.0) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (x / y); t_1 = x + (x * y); tmp = 0.0; if (y <= -0.00024) tmp = t_0; elseif (y <= 5.5e-138) tmp = t_1; elseif (y <= 4.2e-114) tmp = -y; elseif (y <= 1.0) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.00024], t$95$0, If[LessEqual[y, 5.5e-138], t$95$1, If[LessEqual[y, 4.2e-114], (-y), If[LessEqual[y, 1.0], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
t_1 := x + x \cdot y\\
\mathbf{if}\;y \leq -0.00024:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-138}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-114}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.40000000000000006e-4 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 98.0%
+-commutative98.0%
mul-1-neg98.0%
sub-neg98.0%
div-sub98.0%
Simplified98.0%
Taylor expanded in x around inf 97.2%
neg-mul-197.2%
distribute-neg-frac297.2%
Simplified97.2%
Taylor expanded in x around 0 97.2%
mul-1-neg97.2%
sub-neg97.2%
Simplified97.2%
if -2.40000000000000006e-4 < y < 5.5000000000000003e-138 or 4.19999999999999985e-114 < y < 1Initial program 100.0%
Taylor expanded in x around inf 82.7%
Taylor expanded in y around 0 82.4%
*-commutative82.4%
Simplified82.4%
if 5.5000000000000003e-138 < y < 4.19999999999999985e-114Initial program 100.0%
Taylor expanded in x around 0 100.0%
neg-mul-1100.0%
distribute-neg-frac2100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
neg-mul-1100.0%
Simplified100.0%
Final simplification90.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (* x y))))
(if (<= y -0.00024)
1.0
(if (<= y 5.5e-138)
t_0
(if (<= y 5.8e-115) (- y) (if (<= y 1.0) t_0 1.0))))))
double code(double x, double y) {
double t_0 = x + (x * y);
double tmp;
if (y <= -0.00024) {
tmp = 1.0;
} else if (y <= 5.5e-138) {
tmp = t_0;
} else if (y <= 5.8e-115) {
tmp = -y;
} else if (y <= 1.0) {
tmp = t_0;
} else {
tmp = 1.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 = x + (x * y)
if (y <= (-0.00024d0)) then
tmp = 1.0d0
else if (y <= 5.5d-138) then
tmp = t_0
else if (y <= 5.8d-115) then
tmp = -y
else if (y <= 1.0d0) then
tmp = t_0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x + (x * y);
double tmp;
if (y <= -0.00024) {
tmp = 1.0;
} else if (y <= 5.5e-138) {
tmp = t_0;
} else if (y <= 5.8e-115) {
tmp = -y;
} else if (y <= 1.0) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x + (x * y) tmp = 0 if y <= -0.00024: tmp = 1.0 elif y <= 5.5e-138: tmp = t_0 elif y <= 5.8e-115: tmp = -y elif y <= 1.0: tmp = t_0 else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(x + Float64(x * y)) tmp = 0.0 if (y <= -0.00024) tmp = 1.0; elseif (y <= 5.5e-138) tmp = t_0; elseif (y <= 5.8e-115) tmp = Float64(-y); elseif (y <= 1.0) tmp = t_0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = x + (x * y); tmp = 0.0; if (y <= -0.00024) tmp = 1.0; elseif (y <= 5.5e-138) tmp = t_0; elseif (y <= 5.8e-115) tmp = -y; elseif (y <= 1.0) tmp = t_0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.00024], 1.0, If[LessEqual[y, 5.5e-138], t$95$0, If[LessEqual[y, 5.8e-115], (-y), If[LessEqual[y, 1.0], t$95$0, 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + x \cdot y\\
\mathbf{if}\;y \leq -0.00024:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-138}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-115}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.40000000000000006e-4 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 75.9%
if -2.40000000000000006e-4 < y < 5.5000000000000003e-138 or 5.7999999999999996e-115 < y < 1Initial program 100.0%
Taylor expanded in x around inf 82.7%
Taylor expanded in y around 0 82.4%
*-commutative82.4%
Simplified82.4%
if 5.5000000000000003e-138 < y < 5.7999999999999996e-115Initial program 100.0%
Taylor expanded in x around 0 100.0%
neg-mul-1100.0%
distribute-neg-frac2100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
neg-mul-1100.0%
Simplified100.0%
Final simplification79.5%
(FPCore (x y) :precision binary64 (if (<= y -0.00024) 1.0 (if (<= y 5.5e-138) x (if (<= y 3.3e-113) (- y) (if (<= y 1.0) x 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -0.00024) {
tmp = 1.0;
} else if (y <= 5.5e-138) {
tmp = x;
} else if (y <= 3.3e-113) {
tmp = -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 <= (-0.00024d0)) then
tmp = 1.0d0
else if (y <= 5.5d-138) then
tmp = x
else if (y <= 3.3d-113) then
tmp = -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 <= -0.00024) {
tmp = 1.0;
} else if (y <= 5.5e-138) {
tmp = x;
} else if (y <= 3.3e-113) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -0.00024: tmp = 1.0 elif y <= 5.5e-138: tmp = x elif y <= 3.3e-113: tmp = -y elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -0.00024) tmp = 1.0; elseif (y <= 5.5e-138) tmp = x; elseif (y <= 3.3e-113) tmp = Float64(-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 <= -0.00024) tmp = 1.0; elseif (y <= 5.5e-138) tmp = x; elseif (y <= 3.3e-113) tmp = -y; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -0.00024], 1.0, If[LessEqual[y, 5.5e-138], x, If[LessEqual[y, 3.3e-113], (-y), If[LessEqual[y, 1.0], x, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00024:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-138}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-113}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.40000000000000006e-4 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 75.9%
if -2.40000000000000006e-4 < y < 5.5000000000000003e-138 or 3.3000000000000002e-113 < y < 1Initial program 100.0%
Taylor expanded in y around 0 80.8%
if 5.5000000000000003e-138 < y < 3.3000000000000002e-113Initial program 100.0%
Taylor expanded in x around 0 100.0%
neg-mul-1100.0%
distribute-neg-frac2100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
neg-mul-1100.0%
Simplified100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -0.00024)
t_0
(if (<= y 5.5e-138)
(/ x (- 1.0 y))
(if (<= y 4000000.0) (/ y (+ y -1.0)) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -0.00024) {
tmp = t_0;
} else if (y <= 5.5e-138) {
tmp = x / (1.0 - y);
} else if (y <= 4000000.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 - (x / y)
if (y <= (-0.00024d0)) then
tmp = t_0
else if (y <= 5.5d-138) then
tmp = x / (1.0d0 - y)
else if (y <= 4000000.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 - (x / y);
double tmp;
if (y <= -0.00024) {
tmp = t_0;
} else if (y <= 5.5e-138) {
tmp = x / (1.0 - y);
} else if (y <= 4000000.0) {
tmp = y / (y + -1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) tmp = 0 if y <= -0.00024: tmp = t_0 elif y <= 5.5e-138: tmp = x / (1.0 - y) elif y <= 4000000.0: tmp = y / (y + -1.0) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -0.00024) tmp = t_0; elseif (y <= 5.5e-138) tmp = Float64(x / Float64(1.0 - y)); elseif (y <= 4000000.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 - (x / y); tmp = 0.0; if (y <= -0.00024) tmp = t_0; elseif (y <= 5.5e-138) tmp = x / (1.0 - y); elseif (y <= 4000000.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[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.00024], t$95$0, If[LessEqual[y, 5.5e-138], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4000000.0], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -0.00024:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-138}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{elif}\;y \leq 4000000:\\
\;\;\;\;\frac{y}{y + -1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.40000000000000006e-4 or 4e6 < y Initial program 100.0%
Taylor expanded in y around inf 98.0%
+-commutative98.0%
mul-1-neg98.0%
sub-neg98.0%
div-sub98.0%
Simplified98.0%
Taylor expanded in x around inf 97.5%
neg-mul-197.5%
distribute-neg-frac297.5%
Simplified97.5%
Taylor expanded in x around 0 97.5%
mul-1-neg97.5%
sub-neg97.5%
Simplified97.5%
if -2.40000000000000006e-4 < y < 5.5000000000000003e-138Initial program 100.0%
Taylor expanded in x around inf 87.2%
if 5.5000000000000003e-138 < y < 4e6Initial program 100.0%
Taylor expanded in x around 0 61.1%
neg-mul-161.1%
distribute-neg-frac261.1%
neg-sub061.1%
associate--r-61.1%
metadata-eval61.1%
Simplified61.1%
Final simplification89.9%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (+ 1.0 (/ (- 1.0 x) y)) (+ x (* y (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = 1.0 + ((1.0 - x) / y);
} 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.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = 1.0d0 + ((1.0d0 - x) / y)
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.0) || !(y <= 1.0)) {
tmp = 1.0 + ((1.0 - x) / y);
} else {
tmp = x + (y * (x + -1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = 1.0 + ((1.0 - x) / y) else: tmp = x + (y * (x + -1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(1.0 + Float64(Float64(1.0 - x) / y)); 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.0) || ~((y <= 1.0))) tmp = 1.0 + ((1.0 - x) / y); else tmp = x + (y * (x + -1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;1 + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 98.7%
+-commutative98.7%
mul-1-neg98.7%
sub-neg98.7%
div-sub98.7%
Simplified98.7%
if -1 < y < 1Initial program 100.0%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
unsub-neg99.2%
mul-1-neg99.2%
sub-neg99.2%
Simplified99.2%
Final simplification99.0%
(FPCore (x y) :precision binary64 (if (<= y -0.00024) 1.0 (if (<= y 1.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -0.00024) {
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.00024d0)) 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.00024) {
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.00024: 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.00024) 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.00024) 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.00024], 1.0, If[LessEqual[y, 1.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00024:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.40000000000000006e-4 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 75.9%
if -2.40000000000000006e-4 < y < 1Initial program 100.0%
Taylor expanded in y around 0 77.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 40.5%
herbie shell --seed 2024091
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, C"
:precision binary64
(/ (- x y) (- 1.0 y)))