
(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
(let* ((t_0 (/ (- x) y)))
(if (<= y -4.4e+158)
1.0
(if (<= y -3e+106)
t_0
(if (<= y -0.21)
1.0
(if (<= y 1.52e-30)
x
(if (<= y 6.8e-7)
(- y)
(if (<= y 1.0) x (if (<= y 2.9e+69) t_0 1.0)))))))))
double code(double x, double y) {
double t_0 = -x / y;
double tmp;
if (y <= -4.4e+158) {
tmp = 1.0;
} else if (y <= -3e+106) {
tmp = t_0;
} else if (y <= -0.21) {
tmp = 1.0;
} else if (y <= 1.52e-30) {
tmp = x;
} else if (y <= 6.8e-7) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x;
} else if (y <= 2.9e+69) {
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 / y
if (y <= (-4.4d+158)) then
tmp = 1.0d0
else if (y <= (-3d+106)) then
tmp = t_0
else if (y <= (-0.21d0)) then
tmp = 1.0d0
else if (y <= 1.52d-30) then
tmp = x
else if (y <= 6.8d-7) then
tmp = -y
else if (y <= 1.0d0) then
tmp = x
else if (y <= 2.9d+69) 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 / y;
double tmp;
if (y <= -4.4e+158) {
tmp = 1.0;
} else if (y <= -3e+106) {
tmp = t_0;
} else if (y <= -0.21) {
tmp = 1.0;
} else if (y <= 1.52e-30) {
tmp = x;
} else if (y <= 6.8e-7) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x;
} else if (y <= 2.9e+69) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = -x / y tmp = 0 if y <= -4.4e+158: tmp = 1.0 elif y <= -3e+106: tmp = t_0 elif y <= -0.21: tmp = 1.0 elif y <= 1.52e-30: tmp = x elif y <= 6.8e-7: tmp = -y elif y <= 1.0: tmp = x elif y <= 2.9e+69: tmp = t_0 else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(Float64(-x) / y) tmp = 0.0 if (y <= -4.4e+158) tmp = 1.0; elseif (y <= -3e+106) tmp = t_0; elseif (y <= -0.21) tmp = 1.0; elseif (y <= 1.52e-30) tmp = x; elseif (y <= 6.8e-7) tmp = Float64(-y); elseif (y <= 1.0) tmp = x; elseif (y <= 2.9e+69) tmp = t_0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = -x / y; tmp = 0.0; if (y <= -4.4e+158) tmp = 1.0; elseif (y <= -3e+106) tmp = t_0; elseif (y <= -0.21) tmp = 1.0; elseif (y <= 1.52e-30) tmp = x; elseif (y <= 6.8e-7) tmp = -y; elseif (y <= 1.0) tmp = x; elseif (y <= 2.9e+69) tmp = t_0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[((-x) / y), $MachinePrecision]}, If[LessEqual[y, -4.4e+158], 1.0, If[LessEqual[y, -3e+106], t$95$0, If[LessEqual[y, -0.21], 1.0, If[LessEqual[y, 1.52e-30], x, If[LessEqual[y, 6.8e-7], (-y), If[LessEqual[y, 1.0], x, If[LessEqual[y, 2.9e+69], t$95$0, 1.0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{y}\\
\mathbf{if}\;y \leq -4.4 \cdot 10^{+158}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -3 \cdot 10^{+106}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -0.21:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.52 \cdot 10^{-30}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{-7}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+69}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.4000000000000002e158 or -3.0000000000000001e106 < y < -0.209999999999999992 or 2.8999999999999998e69 < y Initial program 100.0%
Taylor expanded in y around inf 76.4%
if -4.4000000000000002e158 < y < -3.0000000000000001e106 or 1 < y < 2.8999999999999998e69Initial program 100.0%
Taylor expanded in x around inf 69.3%
Taylor expanded in y around inf 64.6%
associate-*r/64.6%
neg-mul-164.6%
Simplified64.6%
if -0.209999999999999992 < y < 1.52e-30 or 6.79999999999999948e-7 < y < 1Initial program 100.0%
Taylor expanded in y around 0 67.0%
if 1.52e-30 < y < 6.79999999999999948e-7Initial program 100.0%
Taylor expanded in x around 0 100.0%
metadata-eval100.0%
times-frac100.0%
*-lft-identity100.0%
neg-mul-1100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 89.2%
neg-mul-189.2%
Simplified89.2%
Final simplification71.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 1.0 y))))
(if (<= y -4.5e+158)
1.0
(if (<= y -1.3e+107)
(/ (- x) y)
(if (<= y -7.5e+57)
1.0
(if (<= y 3.7e-30)
t_0
(if (<= y 3.9e-7) (- y) (if (<= y 2.8e+69) t_0 1.0))))))))
double code(double x, double y) {
double t_0 = x / (1.0 - y);
double tmp;
if (y <= -4.5e+158) {
tmp = 1.0;
} else if (y <= -1.3e+107) {
tmp = -x / y;
} else if (y <= -7.5e+57) {
tmp = 1.0;
} else if (y <= 3.7e-30) {
tmp = t_0;
} else if (y <= 3.9e-7) {
tmp = -y;
} else if (y <= 2.8e+69) {
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 / (1.0d0 - y)
if (y <= (-4.5d+158)) then
tmp = 1.0d0
else if (y <= (-1.3d+107)) then
tmp = -x / y
else if (y <= (-7.5d+57)) then
tmp = 1.0d0
else if (y <= 3.7d-30) then
tmp = t_0
else if (y <= 3.9d-7) then
tmp = -y
else if (y <= 2.8d+69) 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 / (1.0 - y);
double tmp;
if (y <= -4.5e+158) {
tmp = 1.0;
} else if (y <= -1.3e+107) {
tmp = -x / y;
} else if (y <= -7.5e+57) {
tmp = 1.0;
} else if (y <= 3.7e-30) {
tmp = t_0;
} else if (y <= 3.9e-7) {
tmp = -y;
} else if (y <= 2.8e+69) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (1.0 - y) tmp = 0 if y <= -4.5e+158: tmp = 1.0 elif y <= -1.3e+107: tmp = -x / y elif y <= -7.5e+57: tmp = 1.0 elif y <= 3.7e-30: tmp = t_0 elif y <= 3.9e-7: tmp = -y elif y <= 2.8e+69: tmp = t_0 else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(x / Float64(1.0 - y)) tmp = 0.0 if (y <= -4.5e+158) tmp = 1.0; elseif (y <= -1.3e+107) tmp = Float64(Float64(-x) / y); elseif (y <= -7.5e+57) tmp = 1.0; elseif (y <= 3.7e-30) tmp = t_0; elseif (y <= 3.9e-7) tmp = Float64(-y); elseif (y <= 2.8e+69) tmp = t_0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (1.0 - y); tmp = 0.0; if (y <= -4.5e+158) tmp = 1.0; elseif (y <= -1.3e+107) tmp = -x / y; elseif (y <= -7.5e+57) tmp = 1.0; elseif (y <= 3.7e-30) tmp = t_0; elseif (y <= 3.9e-7) tmp = -y; elseif (y <= 2.8e+69) tmp = t_0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.5e+158], 1.0, If[LessEqual[y, -1.3e+107], N[((-x) / y), $MachinePrecision], If[LessEqual[y, -7.5e+57], 1.0, If[LessEqual[y, 3.7e-30], t$95$0, If[LessEqual[y, 3.9e-7], (-y), If[LessEqual[y, 2.8e+69], t$95$0, 1.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{1 - y}\\
\mathbf{if}\;y \leq -4.5 \cdot 10^{+158}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.3 \cdot 10^{+107}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;y \leq -7.5 \cdot 10^{+57}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{-30}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{-7}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+69}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.50000000000000046e158 or -1.3000000000000001e107 < y < -7.5000000000000006e57 or 2.79999999999999982e69 < y Initial program 100.0%
Taylor expanded in y around inf 82.5%
if -4.50000000000000046e158 < y < -1.3000000000000001e107Initial program 100.0%
Taylor expanded in x around inf 76.3%
Taylor expanded in y around inf 76.3%
associate-*r/76.3%
neg-mul-176.3%
Simplified76.3%
if -7.5000000000000006e57 < y < 3.7000000000000003e-30 or 3.90000000000000025e-7 < y < 2.79999999999999982e69Initial program 100.0%
Taylor expanded in x around inf 67.0%
if 3.7000000000000003e-30 < y < 3.90000000000000025e-7Initial program 100.0%
Taylor expanded in x around 0 100.0%
metadata-eval100.0%
times-frac100.0%
*-lft-identity100.0%
neg-mul-1100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 89.2%
neg-mul-189.2%
Simplified89.2%
Final simplification73.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (- 1.0 x) y))) (t_1 (/ x (- 1.0 y))))
(if (<= y -36000000000.0)
t_0
(if (<= y 1.3e-30)
t_1
(if (<= y 3.9e-7) (/ y (+ y -1.0)) (if (<= y 2.3e+14) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 1.0 + ((1.0 - x) / y);
double t_1 = x / (1.0 - y);
double tmp;
if (y <= -36000000000.0) {
tmp = t_0;
} else if (y <= 1.3e-30) {
tmp = t_1;
} else if (y <= 3.9e-7) {
tmp = y / (y + -1.0);
} else if (y <= 2.3e+14) {
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 + ((1.0d0 - x) / y)
t_1 = x / (1.0d0 - y)
if (y <= (-36000000000.0d0)) then
tmp = t_0
else if (y <= 1.3d-30) then
tmp = t_1
else if (y <= 3.9d-7) then
tmp = y / (y + (-1.0d0))
else if (y <= 2.3d+14) 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 + ((1.0 - x) / y);
double t_1 = x / (1.0 - y);
double tmp;
if (y <= -36000000000.0) {
tmp = t_0;
} else if (y <= 1.3e-30) {
tmp = t_1;
} else if (y <= 3.9e-7) {
tmp = y / (y + -1.0);
} else if (y <= 2.3e+14) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((1.0 - x) / y) t_1 = x / (1.0 - y) tmp = 0 if y <= -36000000000.0: tmp = t_0 elif y <= 1.3e-30: tmp = t_1 elif y <= 3.9e-7: tmp = y / (y + -1.0) elif y <= 2.3e+14: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(Float64(1.0 - x) / y)) t_1 = Float64(x / Float64(1.0 - y)) tmp = 0.0 if (y <= -36000000000.0) tmp = t_0; elseif (y <= 1.3e-30) tmp = t_1; elseif (y <= 3.9e-7) tmp = Float64(y / Float64(y + -1.0)); elseif (y <= 2.3e+14) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + ((1.0 - x) / y); t_1 = x / (1.0 - y); tmp = 0.0; if (y <= -36000000000.0) tmp = t_0; elseif (y <= 1.3e-30) tmp = t_1; elseif (y <= 3.9e-7) tmp = y / (y + -1.0); elseif (y <= 2.3e+14) tmp = t_1; 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]}, Block[{t$95$1 = N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -36000000000.0], t$95$0, If[LessEqual[y, 1.3e-30], t$95$1, If[LessEqual[y, 3.9e-7], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e+14], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{1 - x}{y}\\
t_1 := \frac{x}{1 - y}\\
\mathbf{if}\;y \leq -36000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{-7}:\\
\;\;\;\;\frac{y}{y + -1}\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.6e10 or 2.3e14 < 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 -3.6e10 < y < 1.29999999999999993e-30 or 3.90000000000000025e-7 < y < 2.3e14Initial program 100.0%
Taylor expanded in x around inf 68.7%
if 1.29999999999999993e-30 < y < 3.90000000000000025e-7Initial program 100.0%
Taylor expanded in x around 0 100.0%
metadata-eval100.0%
times-frac100.0%
*-lft-identity100.0%
neg-mul-1100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification84.6%
(FPCore (x y) :precision binary64 (if (<= y -3.5) 1.0 (if (<= y 5.5e-30) x (if (<= y 8e-7) (- y) (if (<= y 1.0) x 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -3.5) {
tmp = 1.0;
} else if (y <= 5.5e-30) {
tmp = x;
} else if (y <= 8e-7) {
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 <= (-3.5d0)) then
tmp = 1.0d0
else if (y <= 5.5d-30) then
tmp = x
else if (y <= 8d-7) 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 <= -3.5) {
tmp = 1.0;
} else if (y <= 5.5e-30) {
tmp = x;
} else if (y <= 8e-7) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.5: tmp = 1.0 elif y <= 5.5e-30: tmp = x elif y <= 8e-7: tmp = -y elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.5) tmp = 1.0; elseif (y <= 5.5e-30) tmp = x; elseif (y <= 8e-7) 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 <= -3.5) tmp = 1.0; elseif (y <= 5.5e-30) tmp = x; elseif (y <= 8e-7) tmp = -y; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.5], 1.0, If[LessEqual[y, 5.5e-30], x, If[LessEqual[y, 8e-7], (-y), If[LessEqual[y, 1.0], x, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-30}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-7}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.5 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 66.9%
if -3.5 < y < 5.49999999999999976e-30 or 7.9999999999999996e-7 < y < 1Initial program 100.0%
Taylor expanded in y around 0 67.0%
if 5.49999999999999976e-30 < y < 7.9999999999999996e-7Initial program 100.0%
Taylor expanded in x around 0 100.0%
metadata-eval100.0%
times-frac100.0%
*-lft-identity100.0%
neg-mul-1100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 89.2%
neg-mul-189.2%
Simplified89.2%
Final simplification67.4%
(FPCore (x y) :precision binary64 (if (or (<= x -7e-37) (not (<= x 6e+35))) (/ x (- 1.0 y)) (/ y (+ y -1.0))))
double code(double x, double y) {
double tmp;
if ((x <= -7e-37) || !(x <= 6e+35)) {
tmp = x / (1.0 - y);
} else {
tmp = y / (y + -1.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-7d-37)) .or. (.not. (x <= 6d+35))) then
tmp = x / (1.0d0 - y)
else
tmp = y / (y + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -7e-37) || !(x <= 6e+35)) {
tmp = x / (1.0 - y);
} else {
tmp = y / (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -7e-37) or not (x <= 6e+35): tmp = x / (1.0 - y) else: tmp = y / (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if ((x <= -7e-37) || !(x <= 6e+35)) tmp = Float64(x / Float64(1.0 - y)); else tmp = Float64(y / Float64(y + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -7e-37) || ~((x <= 6e+35))) tmp = x / (1.0 - y); else tmp = y / (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -7e-37], N[Not[LessEqual[x, 6e+35]], $MachinePrecision]], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-37} \lor \neg \left(x \leq 6 \cdot 10^{+35}\right):\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + -1}\\
\end{array}
\end{array}
if x < -7.0000000000000003e-37 or 5.99999999999999981e35 < x Initial program 100.0%
Taylor expanded in x around inf 75.0%
if -7.0000000000000003e-37 < x < 5.99999999999999981e35Initial program 100.0%
Taylor expanded in x around 0 80.8%
metadata-eval80.8%
times-frac80.8%
*-lft-identity80.8%
neg-mul-180.8%
neg-sub080.8%
associate--r-80.8%
metadata-eval80.8%
Simplified80.8%
Final simplification77.8%
(FPCore (x y) :precision binary64 (if (<= y -3.5) 1.0 (if (<= y 1.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -3.5) {
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 <= (-3.5d0)) 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 <= -3.5) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.5: tmp = 1.0 elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.5) 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 <= -3.5) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.5], 1.0, If[LessEqual[y, 1.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.5 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 66.9%
if -3.5 < y < 1Initial program 100.0%
Taylor expanded in y around 0 64.4%
Final simplification65.7%
(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.3%
Final simplification36.3%
herbie shell --seed 2024034
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, C"
:precision binary64
(/ (- x y) (- 1.0 y)))