
(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%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ (+ x -1.0) y))))
(if (<= y -4.2e+15)
t_0
(if (<= y -2.8e-105)
(/ x (- 1.0 y))
(if (<= y -6.6e-140)
(- y)
(if (<= y 3.5e-70)
x
(if (<= y 9.2e-23) (- y) (if (<= y 1.0) (+ x (* x y)) t_0))))))))
double code(double x, double y) {
double t_0 = 1.0 - ((x + -1.0) / y);
double tmp;
if (y <= -4.2e+15) {
tmp = t_0;
} else if (y <= -2.8e-105) {
tmp = x / (1.0 - y);
} else if (y <= -6.6e-140) {
tmp = -y;
} else if (y <= 3.5e-70) {
tmp = x;
} else if (y <= 9.2e-23) {
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 + (-1.0d0)) / y)
if (y <= (-4.2d+15)) then
tmp = t_0
else if (y <= (-2.8d-105)) then
tmp = x / (1.0d0 - y)
else if (y <= (-6.6d-140)) then
tmp = -y
else if (y <= 3.5d-70) then
tmp = x
else if (y <= 9.2d-23) 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 + -1.0) / y);
double tmp;
if (y <= -4.2e+15) {
tmp = t_0;
} else if (y <= -2.8e-105) {
tmp = x / (1.0 - y);
} else if (y <= -6.6e-140) {
tmp = -y;
} else if (y <= 3.5e-70) {
tmp = x;
} else if (y <= 9.2e-23) {
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 + -1.0) / y) tmp = 0 if y <= -4.2e+15: tmp = t_0 elif y <= -2.8e-105: tmp = x / (1.0 - y) elif y <= -6.6e-140: tmp = -y elif y <= 3.5e-70: tmp = x elif y <= 9.2e-23: 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(x + -1.0) / y)) tmp = 0.0 if (y <= -4.2e+15) tmp = t_0; elseif (y <= -2.8e-105) tmp = Float64(x / Float64(1.0 - y)); elseif (y <= -6.6e-140) tmp = Float64(-y); elseif (y <= 3.5e-70) tmp = x; elseif (y <= 9.2e-23) 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 + -1.0) / y); tmp = 0.0; if (y <= -4.2e+15) tmp = t_0; elseif (y <= -2.8e-105) tmp = x / (1.0 - y); elseif (y <= -6.6e-140) tmp = -y; elseif (y <= 3.5e-70) tmp = x; elseif (y <= 9.2e-23) 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[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.2e+15], t$95$0, If[LessEqual[y, -2.8e-105], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -6.6e-140], (-y), If[LessEqual[y, 3.5e-70], x, If[LessEqual[y, 9.2e-23], (-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 + -1}{y}\\
\mathbf{if}\;y \leq -4.2 \cdot 10^{+15}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -2.8 \cdot 10^{-105}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{elif}\;y \leq -6.6 \cdot 10^{-140}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{-70}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{-23}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4.2e15 or 1 < 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.2e15 < y < -2.8e-105Initial program 99.8%
Taylor expanded in x around inf 67.4%
if -2.8e-105 < y < -6.59999999999999975e-140 or 3.49999999999999974e-70 < y < 9.2000000000000004e-23Initial program 100.0%
add-sqr-sqrt66.2%
pow266.2%
Applied egg-rr66.2%
Taylor expanded in x around 0 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt81.5%
neg-mul-181.5%
distribute-neg-frac81.5%
distribute-neg-frac281.5%
neg-sub081.5%
associate--r-81.5%
metadata-eval81.5%
+-commutative81.5%
Simplified81.5%
Taylor expanded in y around 0 81.5%
neg-mul-181.5%
Simplified81.5%
if -6.59999999999999975e-140 < y < 3.49999999999999974e-70Initial program 100.0%
Taylor expanded in y around 0 90.7%
if 9.2000000000000004e-23 < y < 1Initial program 100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in y around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification91.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (* x y))))
(if (<= y -0.005)
1.0
(if (<= y -1.7e-103)
t_0
(if (<= y -8e-140)
(- y)
(if (<= y 1.05e-71)
x
(if (<= y 1.06e-19) (- 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.005) {
tmp = 1.0;
} else if (y <= -1.7e-103) {
tmp = t_0;
} else if (y <= -8e-140) {
tmp = -y;
} else if (y <= 1.05e-71) {
tmp = x;
} else if (y <= 1.06e-19) {
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.005d0)) then
tmp = 1.0d0
else if (y <= (-1.7d-103)) then
tmp = t_0
else if (y <= (-8d-140)) then
tmp = -y
else if (y <= 1.05d-71) then
tmp = x
else if (y <= 1.06d-19) 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.005) {
tmp = 1.0;
} else if (y <= -1.7e-103) {
tmp = t_0;
} else if (y <= -8e-140) {
tmp = -y;
} else if (y <= 1.05e-71) {
tmp = x;
} else if (y <= 1.06e-19) {
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.005: tmp = 1.0 elif y <= -1.7e-103: tmp = t_0 elif y <= -8e-140: tmp = -y elif y <= 1.05e-71: tmp = x elif y <= 1.06e-19: 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.005) tmp = 1.0; elseif (y <= -1.7e-103) tmp = t_0; elseif (y <= -8e-140) tmp = Float64(-y); elseif (y <= 1.05e-71) tmp = x; elseif (y <= 1.06e-19) 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.005) tmp = 1.0; elseif (y <= -1.7e-103) tmp = t_0; elseif (y <= -8e-140) tmp = -y; elseif (y <= 1.05e-71) tmp = x; elseif (y <= 1.06e-19) 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.005], 1.0, If[LessEqual[y, -1.7e-103], t$95$0, If[LessEqual[y, -8e-140], (-y), If[LessEqual[y, 1.05e-71], x, If[LessEqual[y, 1.06e-19], (-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.005:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.7 \cdot 10^{-103}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -8 \cdot 10^{-140}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-71}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.06 \cdot 10^{-19}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -0.0050000000000000001 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 79.8%
if -0.0050000000000000001 < y < -1.70000000000000001e-103 or 1.06e-19 < y < 1Initial program 99.8%
Taylor expanded in x around inf 67.4%
Taylor expanded in y around 0 65.7%
*-commutative65.7%
Simplified65.7%
if -1.70000000000000001e-103 < y < -7.9999999999999999e-140 or 1.0500000000000001e-71 < y < 1.06e-19Initial program 100.0%
add-sqr-sqrt66.2%
pow266.2%
Applied egg-rr66.2%
Taylor expanded in x around 0 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt81.5%
neg-mul-181.5%
distribute-neg-frac81.5%
distribute-neg-frac281.5%
neg-sub081.5%
associate--r-81.5%
metadata-eval81.5%
+-commutative81.5%
Simplified81.5%
Taylor expanded in y around 0 81.5%
neg-mul-181.5%
Simplified81.5%
if -7.9999999999999999e-140 < y < 1.0500000000000001e-71Initial program 100.0%
Taylor expanded in y around 0 90.7%
Final simplification82.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 1.0 y))))
(if (<= y -3.1e+43)
1.0
(if (<= y -7.2e-106)
t_0
(if (<= y -8e-140)
(- y)
(if (<= y 1.15e-67)
x
(if (<= y 1.8e-17) (- y) (if (<= y 3.5e+17) t_0 1.0))))))))
double code(double x, double y) {
double t_0 = x / (1.0 - y);
double tmp;
if (y <= -3.1e+43) {
tmp = 1.0;
} else if (y <= -7.2e-106) {
tmp = t_0;
} else if (y <= -8e-140) {
tmp = -y;
} else if (y <= 1.15e-67) {
tmp = x;
} else if (y <= 1.8e-17) {
tmp = -y;
} else if (y <= 3.5e+17) {
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 <= (-3.1d+43)) then
tmp = 1.0d0
else if (y <= (-7.2d-106)) then
tmp = t_0
else if (y <= (-8d-140)) then
tmp = -y
else if (y <= 1.15d-67) then
tmp = x
else if (y <= 1.8d-17) then
tmp = -y
else if (y <= 3.5d+17) 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 <= -3.1e+43) {
tmp = 1.0;
} else if (y <= -7.2e-106) {
tmp = t_0;
} else if (y <= -8e-140) {
tmp = -y;
} else if (y <= 1.15e-67) {
tmp = x;
} else if (y <= 1.8e-17) {
tmp = -y;
} else if (y <= 3.5e+17) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (1.0 - y) tmp = 0 if y <= -3.1e+43: tmp = 1.0 elif y <= -7.2e-106: tmp = t_0 elif y <= -8e-140: tmp = -y elif y <= 1.15e-67: tmp = x elif y <= 1.8e-17: tmp = -y elif y <= 3.5e+17: 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 <= -3.1e+43) tmp = 1.0; elseif (y <= -7.2e-106) tmp = t_0; elseif (y <= -8e-140) tmp = Float64(-y); elseif (y <= 1.15e-67) tmp = x; elseif (y <= 1.8e-17) tmp = Float64(-y); elseif (y <= 3.5e+17) 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 <= -3.1e+43) tmp = 1.0; elseif (y <= -7.2e-106) tmp = t_0; elseif (y <= -8e-140) tmp = -y; elseif (y <= 1.15e-67) tmp = x; elseif (y <= 1.8e-17) tmp = -y; elseif (y <= 3.5e+17) 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, -3.1e+43], 1.0, If[LessEqual[y, -7.2e-106], t$95$0, If[LessEqual[y, -8e-140], (-y), If[LessEqual[y, 1.15e-67], x, If[LessEqual[y, 1.8e-17], (-y), If[LessEqual[y, 3.5e+17], t$95$0, 1.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{1 - y}\\
\mathbf{if}\;y \leq -3.1 \cdot 10^{+43}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -7.2 \cdot 10^{-106}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -8 \cdot 10^{-140}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-67}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-17}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.1000000000000002e43 or 3.5e17 < y Initial program 100.0%
Taylor expanded in y around inf 84.3%
if -3.1000000000000002e43 < y < -7.20000000000000025e-106 or 1.79999999999999997e-17 < y < 3.5e17Initial program 99.8%
Taylor expanded in x around inf 69.4%
if -7.20000000000000025e-106 < y < -7.9999999999999999e-140 or 1.15e-67 < y < 1.79999999999999997e-17Initial program 100.0%
add-sqr-sqrt66.2%
pow266.2%
Applied egg-rr66.2%
Taylor expanded in x around 0 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt81.5%
neg-mul-181.5%
distribute-neg-frac81.5%
distribute-neg-frac281.5%
neg-sub081.5%
associate--r-81.5%
metadata-eval81.5%
+-commutative81.5%
Simplified81.5%
Taylor expanded in y around 0 81.5%
neg-mul-181.5%
Simplified81.5%
if -7.9999999999999999e-140 < y < 1.15e-67Initial program 100.0%
Taylor expanded in y around 0 90.7%
Final simplification84.4%
(FPCore (x y)
:precision binary64
(if (<= y -4.2e+15)
1.0
(if (<= y -5.8e-105)
x
(if (<= y -8e-140)
(- y)
(if (<= y 1.22e-67)
x
(if (<= y 9e-17) (- y) (if (<= y 4.1e+17) (/ x (- y)) 1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -4.2e+15) {
tmp = 1.0;
} else if (y <= -5.8e-105) {
tmp = x;
} else if (y <= -8e-140) {
tmp = -y;
} else if (y <= 1.22e-67) {
tmp = x;
} else if (y <= 9e-17) {
tmp = -y;
} else if (y <= 4.1e+17) {
tmp = 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 <= (-4.2d+15)) then
tmp = 1.0d0
else if (y <= (-5.8d-105)) then
tmp = x
else if (y <= (-8d-140)) then
tmp = -y
else if (y <= 1.22d-67) then
tmp = x
else if (y <= 9d-17) then
tmp = -y
else if (y <= 4.1d+17) then
tmp = x / -y
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4.2e+15) {
tmp = 1.0;
} else if (y <= -5.8e-105) {
tmp = x;
} else if (y <= -8e-140) {
tmp = -y;
} else if (y <= 1.22e-67) {
tmp = x;
} else if (y <= 9e-17) {
tmp = -y;
} else if (y <= 4.1e+17) {
tmp = x / -y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.2e+15: tmp = 1.0 elif y <= -5.8e-105: tmp = x elif y <= -8e-140: tmp = -y elif y <= 1.22e-67: tmp = x elif y <= 9e-17: tmp = -y elif y <= 4.1e+17: tmp = x / -y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -4.2e+15) tmp = 1.0; elseif (y <= -5.8e-105) tmp = x; elseif (y <= -8e-140) tmp = Float64(-y); elseif (y <= 1.22e-67) tmp = x; elseif (y <= 9e-17) tmp = Float64(-y); elseif (y <= 4.1e+17) tmp = Float64(x / Float64(-y)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.2e+15) tmp = 1.0; elseif (y <= -5.8e-105) tmp = x; elseif (y <= -8e-140) tmp = -y; elseif (y <= 1.22e-67) tmp = x; elseif (y <= 9e-17) tmp = -y; elseif (y <= 4.1e+17) tmp = x / -y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.2e+15], 1.0, If[LessEqual[y, -5.8e-105], x, If[LessEqual[y, -8e-140], (-y), If[LessEqual[y, 1.22e-67], x, If[LessEqual[y, 9e-17], (-y), If[LessEqual[y, 4.1e+17], N[(x / (-y)), $MachinePrecision], 1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{+15}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-105}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -8 \cdot 10^{-140}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1.22 \cdot 10^{-67}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-17}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+17}:\\
\;\;\;\;\frac{x}{-y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.2e15 or 4.1e17 < y Initial program 100.0%
Taylor expanded in y around inf 83.1%
if -4.2e15 < y < -5.80000000000000007e-105 or -7.9999999999999999e-140 < y < 1.22e-67Initial program 99.9%
Taylor expanded in y around 0 81.5%
if -5.80000000000000007e-105 < y < -7.9999999999999999e-140 or 1.22e-67 < y < 8.99999999999999957e-17Initial program 100.0%
add-sqr-sqrt66.2%
pow266.2%
Applied egg-rr66.2%
Taylor expanded in x around 0 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt81.5%
neg-mul-181.5%
distribute-neg-frac81.5%
distribute-neg-frac281.5%
neg-sub081.5%
associate--r-81.5%
metadata-eval81.5%
+-commutative81.5%
Simplified81.5%
Taylor expanded in y around 0 81.5%
neg-mul-181.5%
Simplified81.5%
if 8.99999999999999957e-17 < y < 4.1e17Initial program 100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in y around inf 50.2%
associate-*r/50.2%
neg-mul-150.2%
Simplified50.2%
Final simplification82.0%
(FPCore (x y)
:precision binary64
(if (<= y -4.2e+15)
1.0
(if (<= y -7.2e-106)
x
(if (<= y -8e-140)
(- y)
(if (<= y 1.3e-67) x (if (<= y 1e-18) (- y) (if (<= y 1.0) x 1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -4.2e+15) {
tmp = 1.0;
} else if (y <= -7.2e-106) {
tmp = x;
} else if (y <= -8e-140) {
tmp = -y;
} else if (y <= 1.3e-67) {
tmp = x;
} else if (y <= 1e-18) {
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 <= (-4.2d+15)) then
tmp = 1.0d0
else if (y <= (-7.2d-106)) then
tmp = x
else if (y <= (-8d-140)) then
tmp = -y
else if (y <= 1.3d-67) then
tmp = x
else if (y <= 1d-18) 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 <= -4.2e+15) {
tmp = 1.0;
} else if (y <= -7.2e-106) {
tmp = x;
} else if (y <= -8e-140) {
tmp = -y;
} else if (y <= 1.3e-67) {
tmp = x;
} else if (y <= 1e-18) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.2e+15: tmp = 1.0 elif y <= -7.2e-106: tmp = x elif y <= -8e-140: tmp = -y elif y <= 1.3e-67: tmp = x elif y <= 1e-18: tmp = -y elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -4.2e+15) tmp = 1.0; elseif (y <= -7.2e-106) tmp = x; elseif (y <= -8e-140) tmp = Float64(-y); elseif (y <= 1.3e-67) tmp = x; elseif (y <= 1e-18) 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 <= -4.2e+15) tmp = 1.0; elseif (y <= -7.2e-106) tmp = x; elseif (y <= -8e-140) tmp = -y; elseif (y <= 1.3e-67) tmp = x; elseif (y <= 1e-18) tmp = -y; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.2e+15], 1.0, If[LessEqual[y, -7.2e-106], x, If[LessEqual[y, -8e-140], (-y), If[LessEqual[y, 1.3e-67], x, If[LessEqual[y, 1e-18], (-y), If[LessEqual[y, 1.0], x, 1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{+15}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -7.2 \cdot 10^{-106}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -8 \cdot 10^{-140}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-67}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 10^{-18}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.2e15 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 82.4%
if -4.2e15 < y < -7.20000000000000025e-106 or -7.9999999999999999e-140 < y < 1.2999999999999999e-67 or 1.0000000000000001e-18 < y < 1Initial program 99.9%
Taylor expanded in y around 0 81.7%
if -7.20000000000000025e-106 < y < -7.9999999999999999e-140 or 1.2999999999999999e-67 < y < 1.0000000000000001e-18Initial program 100.0%
add-sqr-sqrt66.2%
pow266.2%
Applied egg-rr66.2%
Taylor expanded in x around 0 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt81.5%
neg-mul-181.5%
distribute-neg-frac81.5%
distribute-neg-frac281.5%
neg-sub081.5%
associate--r-81.5%
metadata-eval81.5%
+-commutative81.5%
Simplified81.5%
Taylor expanded in y around 0 81.5%
neg-mul-181.5%
Simplified81.5%
Final simplification82.0%
(FPCore (x y)
:precision binary64
(if (<= y -1.58e+44)
1.0
(if (<= y -2.5e-99)
(/ x (- 1.0 y))
(if (<= y -8e-140) (- y) (if (<= y 3.4e-68) x (/ y (+ y -1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -1.58e+44) {
tmp = 1.0;
} else if (y <= -2.5e-99) {
tmp = x / (1.0 - y);
} else if (y <= -8e-140) {
tmp = -y;
} else if (y <= 3.4e-68) {
tmp = x;
} 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 (y <= (-1.58d+44)) then
tmp = 1.0d0
else if (y <= (-2.5d-99)) then
tmp = x / (1.0d0 - y)
else if (y <= (-8d-140)) then
tmp = -y
else if (y <= 3.4d-68) then
tmp = x
else
tmp = y / (y + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.58e+44) {
tmp = 1.0;
} else if (y <= -2.5e-99) {
tmp = x / (1.0 - y);
} else if (y <= -8e-140) {
tmp = -y;
} else if (y <= 3.4e-68) {
tmp = x;
} else {
tmp = y / (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.58e+44: tmp = 1.0 elif y <= -2.5e-99: tmp = x / (1.0 - y) elif y <= -8e-140: tmp = -y elif y <= 3.4e-68: tmp = x else: tmp = y / (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.58e+44) tmp = 1.0; elseif (y <= -2.5e-99) tmp = Float64(x / Float64(1.0 - y)); elseif (y <= -8e-140) tmp = Float64(-y); elseif (y <= 3.4e-68) tmp = x; else tmp = Float64(y / Float64(y + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.58e+44) tmp = 1.0; elseif (y <= -2.5e-99) tmp = x / (1.0 - y); elseif (y <= -8e-140) tmp = -y; elseif (y <= 3.4e-68) tmp = x; else tmp = y / (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.58e+44], 1.0, If[LessEqual[y, -2.5e-99], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -8e-140], (-y), If[LessEqual[y, 3.4e-68], x, N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.58 \cdot 10^{+44}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.5 \cdot 10^{-99}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{elif}\;y \leq -8 \cdot 10^{-140}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{-68}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + -1}\\
\end{array}
\end{array}
if y < -1.57999999999999993e44Initial program 100.0%
Taylor expanded in y around inf 90.8%
if -1.57999999999999993e44 < y < -2.49999999999999985e-99Initial program 99.8%
Taylor expanded in x around inf 67.5%
if -2.49999999999999985e-99 < y < -7.9999999999999999e-140Initial program 100.0%
add-sqr-sqrt99.4%
pow299.4%
Applied egg-rr99.4%
Taylor expanded in x around 0 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt86.3%
neg-mul-186.3%
distribute-neg-frac86.3%
distribute-neg-frac286.3%
neg-sub086.3%
associate--r-86.3%
metadata-eval86.3%
+-commutative86.3%
Simplified86.3%
Taylor expanded in y around 0 86.3%
neg-mul-186.3%
Simplified86.3%
if -7.9999999999999999e-140 < y < 3.40000000000000018e-68Initial program 100.0%
Taylor expanded in y around 0 90.7%
if 3.40000000000000018e-68 < y Initial program 100.0%
Taylor expanded in x around 0 76.1%
neg-mul-176.1%
distribute-neg-frac276.1%
neg-sub076.1%
associate--r-76.1%
metadata-eval76.1%
Simplified76.1%
Final simplification83.6%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (- 1.0 (/ (+ x -1.0) y)) (+ x (* y (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = 1.0 - ((x + -1.0) / 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 - ((x + (-1.0d0)) / 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 - ((x + -1.0) / 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 - ((x + -1.0) / 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(x + -1.0) / 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 - ((x + -1.0) / 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[(x + -1.0), $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{x + -1}{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 99.0%
+-commutative99.0%
mul-1-neg99.0%
unsub-neg99.0%
div-sub99.0%
Simplified99.0%
if -1 < y < 1Initial program 100.0%
Taylor expanded in y around 0 98.6%
mul-1-neg98.6%
*-commutative98.6%
distribute-lft-neg-in98.6%
cancel-sign-sub98.6%
+-commutative98.6%
metadata-eval98.6%
distribute-lft-in98.6%
metadata-eval98.6%
sub-neg98.6%
mul-1-neg98.6%
remove-double-neg98.6%
sub-neg98.6%
metadata-eval98.6%
+-commutative98.6%
distribute-neg-in98.6%
metadata-eval98.6%
mul-1-neg98.6%
*-commutative98.6%
mul-1-neg98.6%
unsub-neg98.6%
Simplified98.6%
Final simplification98.8%
(FPCore (x y) :precision binary64 (if (<= y -4.2e+15) 1.0 (if (<= y 1.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -4.2e+15) {
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 <= (-4.2d+15)) 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 <= -4.2e+15) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.2e+15: tmp = 1.0 elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -4.2e+15) 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 <= -4.2e+15) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.2e+15], 1.0, If[LessEqual[y, 1.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{+15}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.2e15 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 82.4%
if -4.2e15 < y < 1Initial program 100.0%
Taylor expanded in y around 0 73.1%
Final simplification77.4%
(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.2%
Final simplification40.2%
herbie shell --seed 2024044
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, C"
:precision binary64
(/ (- x y) (- 1.0 y)))