
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
def code(x, y): return (x - y) / (2.0 - (x + y))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (x + y)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
def code(x, y): return (x - y) / (2.0 - (x + y))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (x + y)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
def code(x, y): return (x - y) / (2.0 - (x + y))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (x + y)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 2.0 x))))
(if (<= y -3.1e+57)
1.0
(if (<= y 1.6e-150)
t_0
(if (<= y 1.9e-81)
(* (- x y) 0.5)
(if (<= y 2.35e+58)
t_0
(if (<= y 1.9e+147)
1.0
(if (<= y 1.2e+177) (+ -1.0 (/ y x)) 1.0))))))))
double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -3.1e+57) {
tmp = 1.0;
} else if (y <= 1.6e-150) {
tmp = t_0;
} else if (y <= 1.9e-81) {
tmp = (x - y) * 0.5;
} else if (y <= 2.35e+58) {
tmp = t_0;
} else if (y <= 1.9e+147) {
tmp = 1.0;
} else if (y <= 1.2e+177) {
tmp = -1.0 + (y / 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) :: t_0
real(8) :: tmp
t_0 = x / (2.0d0 - x)
if (y <= (-3.1d+57)) then
tmp = 1.0d0
else if (y <= 1.6d-150) then
tmp = t_0
else if (y <= 1.9d-81) then
tmp = (x - y) * 0.5d0
else if (y <= 2.35d+58) then
tmp = t_0
else if (y <= 1.9d+147) then
tmp = 1.0d0
else if (y <= 1.2d+177) then
tmp = (-1.0d0) + (y / x)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -3.1e+57) {
tmp = 1.0;
} else if (y <= 1.6e-150) {
tmp = t_0;
} else if (y <= 1.9e-81) {
tmp = (x - y) * 0.5;
} else if (y <= 2.35e+58) {
tmp = t_0;
} else if (y <= 1.9e+147) {
tmp = 1.0;
} else if (y <= 1.2e+177) {
tmp = -1.0 + (y / x);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (2.0 - x) tmp = 0 if y <= -3.1e+57: tmp = 1.0 elif y <= 1.6e-150: tmp = t_0 elif y <= 1.9e-81: tmp = (x - y) * 0.5 elif y <= 2.35e+58: tmp = t_0 elif y <= 1.9e+147: tmp = 1.0 elif y <= 1.2e+177: tmp = -1.0 + (y / x) else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -3.1e+57) tmp = 1.0; elseif (y <= 1.6e-150) tmp = t_0; elseif (y <= 1.9e-81) tmp = Float64(Float64(x - y) * 0.5); elseif (y <= 2.35e+58) tmp = t_0; elseif (y <= 1.9e+147) tmp = 1.0; elseif (y <= 1.2e+177) tmp = Float64(-1.0 + Float64(y / x)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (2.0 - x); tmp = 0.0; if (y <= -3.1e+57) tmp = 1.0; elseif (y <= 1.6e-150) tmp = t_0; elseif (y <= 1.9e-81) tmp = (x - y) * 0.5; elseif (y <= 2.35e+58) tmp = t_0; elseif (y <= 1.9e+147) tmp = 1.0; elseif (y <= 1.2e+177) tmp = -1.0 + (y / x); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.1e+57], 1.0, If[LessEqual[y, 1.6e-150], t$95$0, If[LessEqual[y, 1.9e-81], N[(N[(x - y), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[y, 2.35e+58], t$95$0, If[LessEqual[y, 1.9e+147], 1.0, If[LessEqual[y, 1.2e+177], N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision], 1.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -3.1 \cdot 10^{+57}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-150}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{-81}:\\
\;\;\;\;\left(x - y\right) \cdot 0.5\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{+58}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+147}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+177}:\\
\;\;\;\;-1 + \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.10000000000000013e57 or 2.34999999999999986e58 < y < 1.89999999999999985e147 or 1.2e177 < y Initial program 100.0%
Taylor expanded in y around inf 82.2%
if -3.10000000000000013e57 < y < 1.5999999999999999e-150 or 1.8999999999999999e-81 < y < 2.34999999999999986e58Initial program 99.9%
Taylor expanded in y around 0 80.6%
if 1.5999999999999999e-150 < y < 1.8999999999999999e-81Initial program 100.0%
clear-num99.5%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 74.3%
Taylor expanded in y around 0 74.3%
if 1.89999999999999985e147 < y < 1.2e177Initial program 100.0%
clear-num100.0%
associate-/r/100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 83.8%
Taylor expanded in x around 0 83.8%
Final simplification81.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 2.0 x))))
(if (<= y -1.15e-16)
(/ y (+ y -2.0))
(if (<= y 4.9e-150)
t_0
(if (<= y 2.05e-81)
(* (- x y) 0.5)
(if (<= y 1.3e+58) t_0 (+ 1.0 (/ (- 2.0 x) y))))))))
double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -1.15e-16) {
tmp = y / (y + -2.0);
} else if (y <= 4.9e-150) {
tmp = t_0;
} else if (y <= 2.05e-81) {
tmp = (x - y) * 0.5;
} else if (y <= 1.3e+58) {
tmp = t_0;
} else {
tmp = 1.0 + ((2.0 - x) / y);
}
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 / (2.0d0 - x)
if (y <= (-1.15d-16)) then
tmp = y / (y + (-2.0d0))
else if (y <= 4.9d-150) then
tmp = t_0
else if (y <= 2.05d-81) then
tmp = (x - y) * 0.5d0
else if (y <= 1.3d+58) then
tmp = t_0
else
tmp = 1.0d0 + ((2.0d0 - x) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -1.15e-16) {
tmp = y / (y + -2.0);
} else if (y <= 4.9e-150) {
tmp = t_0;
} else if (y <= 2.05e-81) {
tmp = (x - y) * 0.5;
} else if (y <= 1.3e+58) {
tmp = t_0;
} else {
tmp = 1.0 + ((2.0 - x) / y);
}
return tmp;
}
def code(x, y): t_0 = x / (2.0 - x) tmp = 0 if y <= -1.15e-16: tmp = y / (y + -2.0) elif y <= 4.9e-150: tmp = t_0 elif y <= 2.05e-81: tmp = (x - y) * 0.5 elif y <= 1.3e+58: tmp = t_0 else: tmp = 1.0 + ((2.0 - x) / y) return tmp
function code(x, y) t_0 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -1.15e-16) tmp = Float64(y / Float64(y + -2.0)); elseif (y <= 4.9e-150) tmp = t_0; elseif (y <= 2.05e-81) tmp = Float64(Float64(x - y) * 0.5); elseif (y <= 1.3e+58) tmp = t_0; else tmp = Float64(1.0 + Float64(Float64(2.0 - x) / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (2.0 - x); tmp = 0.0; if (y <= -1.15e-16) tmp = y / (y + -2.0); elseif (y <= 4.9e-150) tmp = t_0; elseif (y <= 2.05e-81) tmp = (x - y) * 0.5; elseif (y <= 1.3e+58) tmp = t_0; else tmp = 1.0 + ((2.0 - x) / y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.15e-16], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.9e-150], t$95$0, If[LessEqual[y, 2.05e-81], N[(N[(x - y), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[y, 1.3e+58], t$95$0, N[(1.0 + N[(N[(2.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -1.15 \cdot 10^{-16}:\\
\;\;\;\;\frac{y}{y + -2}\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{-150}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{-81}:\\
\;\;\;\;\left(x - y\right) \cdot 0.5\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+58}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{2 - x}{y}\\
\end{array}
\end{array}
if y < -1.15e-16Initial program 99.9%
Taylor expanded in x around 0 78.7%
mul-1-neg78.7%
distribute-neg-frac78.7%
Simplified78.7%
expm1-log1p-u78.7%
expm1-udef76.6%
add-sqr-sqrt76.5%
sqrt-unprod31.7%
sqr-neg31.7%
sqrt-unprod0.0%
add-sqr-sqrt19.2%
frac-2neg19.2%
add-sqr-sqrt12.6%
sqrt-unprod12.8%
sqr-neg12.8%
sqrt-unprod0.0%
add-sqr-sqrt76.6%
sub-neg76.6%
distribute-neg-in76.6%
metadata-eval76.6%
remove-double-neg76.6%
Applied egg-rr76.6%
expm1-def78.7%
expm1-log1p78.7%
+-commutative78.7%
Simplified78.7%
if -1.15e-16 < y < 4.8999999999999995e-150 or 2.04999999999999992e-81 < y < 1.29999999999999994e58Initial program 100.0%
Taylor expanded in y around 0 85.4%
if 4.8999999999999995e-150 < y < 2.04999999999999992e-81Initial program 100.0%
clear-num99.5%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 74.3%
Taylor expanded in y around 0 74.3%
if 1.29999999999999994e58 < y Initial program 100.0%
clear-num100.0%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 76.1%
Taylor expanded in y around inf 76.3%
+-commutative76.3%
mul-1-neg76.3%
sub-neg76.3%
associate-*r/76.3%
metadata-eval76.3%
div-sub76.3%
Simplified76.3%
Final simplification80.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 2.0 x))))
(if (<= y -3.1e-16)
(/ 1.0 (/ (+ y -2.0) y))
(if (<= y 4.9e-150)
t_0
(if (<= y 2.1e-81)
(* (- x y) 0.5)
(if (<= y 5.8e+58) t_0 (+ 1.0 (/ (- 2.0 x) y))))))))
double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -3.1e-16) {
tmp = 1.0 / ((y + -2.0) / y);
} else if (y <= 4.9e-150) {
tmp = t_0;
} else if (y <= 2.1e-81) {
tmp = (x - y) * 0.5;
} else if (y <= 5.8e+58) {
tmp = t_0;
} else {
tmp = 1.0 + ((2.0 - x) / y);
}
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 / (2.0d0 - x)
if (y <= (-3.1d-16)) then
tmp = 1.0d0 / ((y + (-2.0d0)) / y)
else if (y <= 4.9d-150) then
tmp = t_0
else if (y <= 2.1d-81) then
tmp = (x - y) * 0.5d0
else if (y <= 5.8d+58) then
tmp = t_0
else
tmp = 1.0d0 + ((2.0d0 - x) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -3.1e-16) {
tmp = 1.0 / ((y + -2.0) / y);
} else if (y <= 4.9e-150) {
tmp = t_0;
} else if (y <= 2.1e-81) {
tmp = (x - y) * 0.5;
} else if (y <= 5.8e+58) {
tmp = t_0;
} else {
tmp = 1.0 + ((2.0 - x) / y);
}
return tmp;
}
def code(x, y): t_0 = x / (2.0 - x) tmp = 0 if y <= -3.1e-16: tmp = 1.0 / ((y + -2.0) / y) elif y <= 4.9e-150: tmp = t_0 elif y <= 2.1e-81: tmp = (x - y) * 0.5 elif y <= 5.8e+58: tmp = t_0 else: tmp = 1.0 + ((2.0 - x) / y) return tmp
function code(x, y) t_0 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -3.1e-16) tmp = Float64(1.0 / Float64(Float64(y + -2.0) / y)); elseif (y <= 4.9e-150) tmp = t_0; elseif (y <= 2.1e-81) tmp = Float64(Float64(x - y) * 0.5); elseif (y <= 5.8e+58) tmp = t_0; else tmp = Float64(1.0 + Float64(Float64(2.0 - x) / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (2.0 - x); tmp = 0.0; if (y <= -3.1e-16) tmp = 1.0 / ((y + -2.0) / y); elseif (y <= 4.9e-150) tmp = t_0; elseif (y <= 2.1e-81) tmp = (x - y) * 0.5; elseif (y <= 5.8e+58) tmp = t_0; else tmp = 1.0 + ((2.0 - x) / y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.1e-16], N[(1.0 / N[(N[(y + -2.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.9e-150], t$95$0, If[LessEqual[y, 2.1e-81], N[(N[(x - y), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[y, 5.8e+58], t$95$0, N[(1.0 + N[(N[(2.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -3.1 \cdot 10^{-16}:\\
\;\;\;\;\frac{1}{\frac{y + -2}{y}}\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{-150}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-81}:\\
\;\;\;\;\left(x - y\right) \cdot 0.5\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+58}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{2 - x}{y}\\
\end{array}
\end{array}
if y < -3.1000000000000001e-16Initial program 99.9%
Taylor expanded in x around 0 78.7%
mul-1-neg78.7%
distribute-neg-frac78.7%
Simplified78.7%
clear-num78.7%
inv-pow78.7%
frac-2neg78.7%
sub-neg78.7%
distribute-neg-in78.7%
metadata-eval78.7%
remove-double-neg78.7%
remove-double-neg78.7%
Applied egg-rr78.7%
unpow-178.7%
+-commutative78.7%
Simplified78.7%
if -3.1000000000000001e-16 < y < 4.8999999999999995e-150 or 2.0999999999999999e-81 < y < 5.80000000000000004e58Initial program 100.0%
Taylor expanded in y around 0 85.4%
if 4.8999999999999995e-150 < y < 2.0999999999999999e-81Initial program 100.0%
clear-num99.5%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 74.3%
Taylor expanded in y around 0 74.3%
if 5.80000000000000004e58 < y Initial program 100.0%
clear-num100.0%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 76.1%
Taylor expanded in y around inf 76.3%
+-commutative76.3%
mul-1-neg76.3%
sub-neg76.3%
associate-*r/76.3%
metadata-eval76.3%
div-sub76.3%
Simplified76.3%
Final simplification80.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 2.0 x))))
(if (<= y -2.8e-16)
(/ 1.0 (- (/ (- 2.0) y) -1.0))
(if (<= y 4.9e-150)
t_0
(if (<= y 2e-81)
(* (- x y) 0.5)
(if (<= y 1.65e+58) t_0 (+ 1.0 (/ (- 2.0 x) y))))))))
double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -2.8e-16) {
tmp = 1.0 / ((-2.0 / y) - -1.0);
} else if (y <= 4.9e-150) {
tmp = t_0;
} else if (y <= 2e-81) {
tmp = (x - y) * 0.5;
} else if (y <= 1.65e+58) {
tmp = t_0;
} else {
tmp = 1.0 + ((2.0 - x) / y);
}
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 / (2.0d0 - x)
if (y <= (-2.8d-16)) then
tmp = 1.0d0 / ((-2.0d0 / y) - (-1.0d0))
else if (y <= 4.9d-150) then
tmp = t_0
else if (y <= 2d-81) then
tmp = (x - y) * 0.5d0
else if (y <= 1.65d+58) then
tmp = t_0
else
tmp = 1.0d0 + ((2.0d0 - x) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -2.8e-16) {
tmp = 1.0 / ((-2.0 / y) - -1.0);
} else if (y <= 4.9e-150) {
tmp = t_0;
} else if (y <= 2e-81) {
tmp = (x - y) * 0.5;
} else if (y <= 1.65e+58) {
tmp = t_0;
} else {
tmp = 1.0 + ((2.0 - x) / y);
}
return tmp;
}
def code(x, y): t_0 = x / (2.0 - x) tmp = 0 if y <= -2.8e-16: tmp = 1.0 / ((-2.0 / y) - -1.0) elif y <= 4.9e-150: tmp = t_0 elif y <= 2e-81: tmp = (x - y) * 0.5 elif y <= 1.65e+58: tmp = t_0 else: tmp = 1.0 + ((2.0 - x) / y) return tmp
function code(x, y) t_0 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -2.8e-16) tmp = Float64(1.0 / Float64(Float64(Float64(-2.0) / y) - -1.0)); elseif (y <= 4.9e-150) tmp = t_0; elseif (y <= 2e-81) tmp = Float64(Float64(x - y) * 0.5); elseif (y <= 1.65e+58) tmp = t_0; else tmp = Float64(1.0 + Float64(Float64(2.0 - x) / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (2.0 - x); tmp = 0.0; if (y <= -2.8e-16) tmp = 1.0 / ((-2.0 / y) - -1.0); elseif (y <= 4.9e-150) tmp = t_0; elseif (y <= 2e-81) tmp = (x - y) * 0.5; elseif (y <= 1.65e+58) tmp = t_0; else tmp = 1.0 + ((2.0 - x) / y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.8e-16], N[(1.0 / N[(N[((-2.0) / y), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.9e-150], t$95$0, If[LessEqual[y, 2e-81], N[(N[(x - y), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[y, 1.65e+58], t$95$0, N[(1.0 + N[(N[(2.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -2.8 \cdot 10^{-16}:\\
\;\;\;\;\frac{1}{\frac{-2}{y} - -1}\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{-150}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-81}:\\
\;\;\;\;\left(x - y\right) \cdot 0.5\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{+58}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{2 - x}{y}\\
\end{array}
\end{array}
if y < -2.8000000000000001e-16Initial program 99.9%
clear-num99.9%
inv-pow99.9%
Applied egg-rr99.9%
unpow-199.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 78.7%
mul-1-neg78.7%
div-sub78.8%
metadata-eval78.8%
associate-*r/78.8%
sub-neg78.8%
associate-*r/78.8%
metadata-eval78.8%
*-inverses78.8%
metadata-eval78.8%
Simplified78.8%
if -2.8000000000000001e-16 < y < 4.8999999999999995e-150 or 1.9999999999999999e-81 < y < 1.64999999999999991e58Initial program 100.0%
Taylor expanded in y around 0 85.4%
if 4.8999999999999995e-150 < y < 1.9999999999999999e-81Initial program 100.0%
clear-num99.5%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 74.3%
Taylor expanded in y around 0 74.3%
if 1.64999999999999991e58 < y Initial program 100.0%
clear-num100.0%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 76.1%
Taylor expanded in y around inf 76.3%
+-commutative76.3%
mul-1-neg76.3%
sub-neg76.3%
associate-*r/76.3%
metadata-eval76.3%
div-sub76.3%
Simplified76.3%
Final simplification80.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y -2.0))))
(if (<= x -4.1e-54)
(/ x (- 2.0 x))
(if (<= x 8.6e-197)
t_0
(if (<= x 3.9e-185)
(* (- x y) 0.5)
(if (<= x 4.2e+29) t_0 (/ (- x y) (- x))))))))
double code(double x, double y) {
double t_0 = y / (y + -2.0);
double tmp;
if (x <= -4.1e-54) {
tmp = x / (2.0 - x);
} else if (x <= 8.6e-197) {
tmp = t_0;
} else if (x <= 3.9e-185) {
tmp = (x - y) * 0.5;
} else if (x <= 4.2e+29) {
tmp = t_0;
} else {
tmp = (x - y) / -x;
}
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 = y / (y + (-2.0d0))
if (x <= (-4.1d-54)) then
tmp = x / (2.0d0 - x)
else if (x <= 8.6d-197) then
tmp = t_0
else if (x <= 3.9d-185) then
tmp = (x - y) * 0.5d0
else if (x <= 4.2d+29) then
tmp = t_0
else
tmp = (x - y) / -x
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / (y + -2.0);
double tmp;
if (x <= -4.1e-54) {
tmp = x / (2.0 - x);
} else if (x <= 8.6e-197) {
tmp = t_0;
} else if (x <= 3.9e-185) {
tmp = (x - y) * 0.5;
} else if (x <= 4.2e+29) {
tmp = t_0;
} else {
tmp = (x - y) / -x;
}
return tmp;
}
def code(x, y): t_0 = y / (y + -2.0) tmp = 0 if x <= -4.1e-54: tmp = x / (2.0 - x) elif x <= 8.6e-197: tmp = t_0 elif x <= 3.9e-185: tmp = (x - y) * 0.5 elif x <= 4.2e+29: tmp = t_0 else: tmp = (x - y) / -x return tmp
function code(x, y) t_0 = Float64(y / Float64(y + -2.0)) tmp = 0.0 if (x <= -4.1e-54) tmp = Float64(x / Float64(2.0 - x)); elseif (x <= 8.6e-197) tmp = t_0; elseif (x <= 3.9e-185) tmp = Float64(Float64(x - y) * 0.5); elseif (x <= 4.2e+29) tmp = t_0; else tmp = Float64(Float64(x - y) / Float64(-x)); end return tmp end
function tmp_2 = code(x, y) t_0 = y / (y + -2.0); tmp = 0.0; if (x <= -4.1e-54) tmp = x / (2.0 - x); elseif (x <= 8.6e-197) tmp = t_0; elseif (x <= 3.9e-185) tmp = (x - y) * 0.5; elseif (x <= 4.2e+29) tmp = t_0; else tmp = (x - y) / -x; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.1e-54], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.6e-197], t$95$0, If[LessEqual[x, 3.9e-185], N[(N[(x - y), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 4.2e+29], t$95$0, N[(N[(x - y), $MachinePrecision] / (-x)), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{y + -2}\\
\mathbf{if}\;x \leq -4.1 \cdot 10^{-54}:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{-197}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{-185}:\\
\;\;\;\;\left(x - y\right) \cdot 0.5\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+29}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{-x}\\
\end{array}
\end{array}
if x < -4.1000000000000001e-54Initial program 100.0%
Taylor expanded in y around 0 76.4%
if -4.1000000000000001e-54 < x < 8.6000000000000001e-197 or 3.8999999999999999e-185 < x < 4.2000000000000003e29Initial program 99.9%
Taylor expanded in x around 0 81.6%
mul-1-neg81.6%
distribute-neg-frac81.6%
Simplified81.6%
expm1-log1p-u81.6%
expm1-udef63.1%
add-sqr-sqrt35.6%
sqrt-unprod17.6%
sqr-neg17.6%
sqrt-unprod1.4%
add-sqr-sqrt2.6%
frac-2neg2.6%
add-sqr-sqrt1.0%
sqrt-unprod13.9%
sqr-neg13.9%
sqrt-unprod27.4%
add-sqr-sqrt63.1%
sub-neg63.1%
distribute-neg-in63.1%
metadata-eval63.1%
remove-double-neg63.1%
Applied egg-rr63.1%
expm1-def81.6%
expm1-log1p81.6%
+-commutative81.6%
Simplified81.6%
if 8.6000000000000001e-197 < x < 3.8999999999999999e-185Initial program 100.0%
clear-num100.0%
associate-/r/100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in y around 0 100.0%
if 4.2000000000000003e29 < x Initial program 99.9%
clear-num99.9%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 78.6%
expm1-log1p-u76.5%
expm1-udef76.5%
*-commutative76.5%
frac-2neg76.5%
metadata-eval76.5%
un-div-inv76.6%
Applied egg-rr76.6%
expm1-def76.6%
expm1-log1p78.8%
Simplified78.8%
Final simplification79.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ -1.0 (/ y x))))
(if (<= x -4.4e+15)
t_0
(if (<= x 2.5e-277)
1.0
(if (<= x 1.6e-118) (* (- x y) 0.5) (if (<= x 8e+25) 1.0 t_0))))))
double code(double x, double y) {
double t_0 = -1.0 + (y / x);
double tmp;
if (x <= -4.4e+15) {
tmp = t_0;
} else if (x <= 2.5e-277) {
tmp = 1.0;
} else if (x <= 1.6e-118) {
tmp = (x - y) * 0.5;
} else if (x <= 8e+25) {
tmp = 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) + (y / x)
if (x <= (-4.4d+15)) then
tmp = t_0
else if (x <= 2.5d-277) then
tmp = 1.0d0
else if (x <= 1.6d-118) then
tmp = (x - y) * 0.5d0
else if (x <= 8d+25) then
tmp = 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 + (y / x);
double tmp;
if (x <= -4.4e+15) {
tmp = t_0;
} else if (x <= 2.5e-277) {
tmp = 1.0;
} else if (x <= 1.6e-118) {
tmp = (x - y) * 0.5;
} else if (x <= 8e+25) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = -1.0 + (y / x) tmp = 0 if x <= -4.4e+15: tmp = t_0 elif x <= 2.5e-277: tmp = 1.0 elif x <= 1.6e-118: tmp = (x - y) * 0.5 elif x <= 8e+25: tmp = 1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(-1.0 + Float64(y / x)) tmp = 0.0 if (x <= -4.4e+15) tmp = t_0; elseif (x <= 2.5e-277) tmp = 1.0; elseif (x <= 1.6e-118) tmp = Float64(Float64(x - y) * 0.5); elseif (x <= 8e+25) tmp = 1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = -1.0 + (y / x); tmp = 0.0; if (x <= -4.4e+15) tmp = t_0; elseif (x <= 2.5e-277) tmp = 1.0; elseif (x <= 1.6e-118) tmp = (x - y) * 0.5; elseif (x <= 8e+25) tmp = 1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.4e+15], t$95$0, If[LessEqual[x, 2.5e-277], 1.0, If[LessEqual[x, 1.6e-118], N[(N[(x - y), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 8e+25], 1.0, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 + \frac{y}{x}\\
\mathbf{if}\;x \leq -4.4 \cdot 10^{+15}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-277}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-118}:\\
\;\;\;\;\left(x - y\right) \cdot 0.5\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+25}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -4.4e15 or 8.00000000000000072e25 < x Initial program 100.0%
clear-num99.9%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 80.1%
Taylor expanded in x around 0 80.2%
if -4.4e15 < x < 2.5e-277 or 1.60000000000000002e-118 < x < 8.00000000000000072e25Initial program 99.9%
Taylor expanded in y around inf 65.0%
if 2.5e-277 < x < 1.60000000000000002e-118Initial program 100.0%
clear-num99.8%
associate-/r/100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in y around 0 67.5%
Final simplification72.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y -2.0))))
(if (<= x -8e-55)
(/ x (- 2.0 x))
(if (<= x 8.6e-197)
t_0
(if (<= x 3.9e-185)
(* (- x y) 0.5)
(if (<= x 6e+29) t_0 (+ -1.0 (/ y x))))))))
double code(double x, double y) {
double t_0 = y / (y + -2.0);
double tmp;
if (x <= -8e-55) {
tmp = x / (2.0 - x);
} else if (x <= 8.6e-197) {
tmp = t_0;
} else if (x <= 3.9e-185) {
tmp = (x - y) * 0.5;
} else if (x <= 6e+29) {
tmp = t_0;
} else {
tmp = -1.0 + (y / x);
}
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 = y / (y + (-2.0d0))
if (x <= (-8d-55)) then
tmp = x / (2.0d0 - x)
else if (x <= 8.6d-197) then
tmp = t_0
else if (x <= 3.9d-185) then
tmp = (x - y) * 0.5d0
else if (x <= 6d+29) then
tmp = t_0
else
tmp = (-1.0d0) + (y / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / (y + -2.0);
double tmp;
if (x <= -8e-55) {
tmp = x / (2.0 - x);
} else if (x <= 8.6e-197) {
tmp = t_0;
} else if (x <= 3.9e-185) {
tmp = (x - y) * 0.5;
} else if (x <= 6e+29) {
tmp = t_0;
} else {
tmp = -1.0 + (y / x);
}
return tmp;
}
def code(x, y): t_0 = y / (y + -2.0) tmp = 0 if x <= -8e-55: tmp = x / (2.0 - x) elif x <= 8.6e-197: tmp = t_0 elif x <= 3.9e-185: tmp = (x - y) * 0.5 elif x <= 6e+29: tmp = t_0 else: tmp = -1.0 + (y / x) return tmp
function code(x, y) t_0 = Float64(y / Float64(y + -2.0)) tmp = 0.0 if (x <= -8e-55) tmp = Float64(x / Float64(2.0 - x)); elseif (x <= 8.6e-197) tmp = t_0; elseif (x <= 3.9e-185) tmp = Float64(Float64(x - y) * 0.5); elseif (x <= 6e+29) tmp = t_0; else tmp = Float64(-1.0 + Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) t_0 = y / (y + -2.0); tmp = 0.0; if (x <= -8e-55) tmp = x / (2.0 - x); elseif (x <= 8.6e-197) tmp = t_0; elseif (x <= 3.9e-185) tmp = (x - y) * 0.5; elseif (x <= 6e+29) tmp = t_0; else tmp = -1.0 + (y / x); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8e-55], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.6e-197], t$95$0, If[LessEqual[x, 3.9e-185], N[(N[(x - y), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 6e+29], t$95$0, N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{y + -2}\\
\mathbf{if}\;x \leq -8 \cdot 10^{-55}:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{-197}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{-185}:\\
\;\;\;\;\left(x - y\right) \cdot 0.5\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+29}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-1 + \frac{y}{x}\\
\end{array}
\end{array}
if x < -7.99999999999999996e-55Initial program 100.0%
Taylor expanded in y around 0 76.4%
if -7.99999999999999996e-55 < x < 8.6000000000000001e-197 or 3.8999999999999999e-185 < x < 5.9999999999999998e29Initial program 99.9%
Taylor expanded in x around 0 81.6%
mul-1-neg81.6%
distribute-neg-frac81.6%
Simplified81.6%
expm1-log1p-u81.6%
expm1-udef63.1%
add-sqr-sqrt35.6%
sqrt-unprod17.6%
sqr-neg17.6%
sqrt-unprod1.4%
add-sqr-sqrt2.6%
frac-2neg2.6%
add-sqr-sqrt1.0%
sqrt-unprod13.9%
sqr-neg13.9%
sqrt-unprod27.4%
add-sqr-sqrt63.1%
sub-neg63.1%
distribute-neg-in63.1%
metadata-eval63.1%
remove-double-neg63.1%
Applied egg-rr63.1%
expm1-def81.6%
expm1-log1p81.6%
+-commutative81.6%
Simplified81.6%
if 8.6000000000000001e-197 < x < 3.8999999999999999e-185Initial program 100.0%
clear-num100.0%
associate-/r/100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in y around 0 100.0%
if 5.9999999999999998e29 < x Initial program 99.9%
clear-num99.9%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 78.6%
Taylor expanded in x around 0 78.8%
Final simplification79.8%
(FPCore (x y)
:precision binary64
(if (<= x -3.1e+15)
-1.0
(if (<= x 8e-273)
1.0
(if (<= x 4.6e-173) (* y -0.5) (if (<= x 1.85e+30) 1.0 -1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -3.1e+15) {
tmp = -1.0;
} else if (x <= 8e-273) {
tmp = 1.0;
} else if (x <= 4.6e-173) {
tmp = y * -0.5;
} else if (x <= 1.85e+30) {
tmp = 1.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) :: tmp
if (x <= (-3.1d+15)) then
tmp = -1.0d0
else if (x <= 8d-273) then
tmp = 1.0d0
else if (x <= 4.6d-173) then
tmp = y * (-0.5d0)
else if (x <= 1.85d+30) then
tmp = 1.0d0
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -3.1e+15) {
tmp = -1.0;
} else if (x <= 8e-273) {
tmp = 1.0;
} else if (x <= 4.6e-173) {
tmp = y * -0.5;
} else if (x <= 1.85e+30) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3.1e+15: tmp = -1.0 elif x <= 8e-273: tmp = 1.0 elif x <= 4.6e-173: tmp = y * -0.5 elif x <= 1.85e+30: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -3.1e+15) tmp = -1.0; elseif (x <= 8e-273) tmp = 1.0; elseif (x <= 4.6e-173) tmp = Float64(y * -0.5); elseif (x <= 1.85e+30) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3.1e+15) tmp = -1.0; elseif (x <= 8e-273) tmp = 1.0; elseif (x <= 4.6e-173) tmp = y * -0.5; elseif (x <= 1.85e+30) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3.1e+15], -1.0, If[LessEqual[x, 8e-273], 1.0, If[LessEqual[x, 4.6e-173], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 1.85e+30], 1.0, -1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{+15}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-273}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-173}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{+30}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -3.1e15 or 1.85000000000000008e30 < x Initial program 100.0%
Taylor expanded in x around inf 79.7%
if -3.1e15 < x < 8.000000000000001e-273 or 4.59999999999999976e-173 < x < 1.85000000000000008e30Initial program 99.9%
Taylor expanded in y around inf 64.3%
if 8.000000000000001e-273 < x < 4.59999999999999976e-173Initial program 100.0%
Taylor expanded in x around 0 79.0%
mul-1-neg79.0%
distribute-neg-frac79.0%
Simplified79.0%
Taylor expanded in y around 0 49.3%
*-commutative49.3%
Simplified49.3%
Final simplification69.5%
(FPCore (x y)
:precision binary64
(if (<= x -3.4e+15)
-1.0
(if (<= x 7e-274)
1.0
(if (<= x 9.5e-118) (* (- x y) 0.5) (if (<= x 2.5e+24) 1.0 -1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -3.4e+15) {
tmp = -1.0;
} else if (x <= 7e-274) {
tmp = 1.0;
} else if (x <= 9.5e-118) {
tmp = (x - y) * 0.5;
} else if (x <= 2.5e+24) {
tmp = 1.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) :: tmp
if (x <= (-3.4d+15)) then
tmp = -1.0d0
else if (x <= 7d-274) then
tmp = 1.0d0
else if (x <= 9.5d-118) then
tmp = (x - y) * 0.5d0
else if (x <= 2.5d+24) then
tmp = 1.0d0
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -3.4e+15) {
tmp = -1.0;
} else if (x <= 7e-274) {
tmp = 1.0;
} else if (x <= 9.5e-118) {
tmp = (x - y) * 0.5;
} else if (x <= 2.5e+24) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3.4e+15: tmp = -1.0 elif x <= 7e-274: tmp = 1.0 elif x <= 9.5e-118: tmp = (x - y) * 0.5 elif x <= 2.5e+24: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -3.4e+15) tmp = -1.0; elseif (x <= 7e-274) tmp = 1.0; elseif (x <= 9.5e-118) tmp = Float64(Float64(x - y) * 0.5); elseif (x <= 2.5e+24) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3.4e+15) tmp = -1.0; elseif (x <= 7e-274) tmp = 1.0; elseif (x <= 9.5e-118) tmp = (x - y) * 0.5; elseif (x <= 2.5e+24) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3.4e+15], -1.0, If[LessEqual[x, 7e-274], 1.0, If[LessEqual[x, 9.5e-118], N[(N[(x - y), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 2.5e+24], 1.0, -1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{+15}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-274}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-118}:\\
\;\;\;\;\left(x - y\right) \cdot 0.5\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+24}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -3.4e15 or 2.50000000000000023e24 < x Initial program 100.0%
Taylor expanded in x around inf 79.7%
if -3.4e15 < x < 6.99999999999999963e-274 or 9.49999999999999931e-118 < x < 2.50000000000000023e24Initial program 99.9%
Taylor expanded in y around inf 65.0%
if 6.99999999999999963e-274 < x < 9.49999999999999931e-118Initial program 100.0%
clear-num99.8%
associate-/r/100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in y around 0 67.5%
Final simplification72.2%
(FPCore (x y) :precision binary64 (if (<= x -33.0) (/ x (- 2.0 x)) (if (<= x 2.15e+30) (* (- x y) (/ 1.0 (- 2.0 y))) (/ (- x y) (- x)))))
double code(double x, double y) {
double tmp;
if (x <= -33.0) {
tmp = x / (2.0 - x);
} else if (x <= 2.15e+30) {
tmp = (x - y) * (1.0 / (2.0 - y));
} else {
tmp = (x - y) / -x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-33.0d0)) then
tmp = x / (2.0d0 - x)
else if (x <= 2.15d+30) then
tmp = (x - y) * (1.0d0 / (2.0d0 - y))
else
tmp = (x - y) / -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -33.0) {
tmp = x / (2.0 - x);
} else if (x <= 2.15e+30) {
tmp = (x - y) * (1.0 / (2.0 - y));
} else {
tmp = (x - y) / -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -33.0: tmp = x / (2.0 - x) elif x <= 2.15e+30: tmp = (x - y) * (1.0 / (2.0 - y)) else: tmp = (x - y) / -x return tmp
function code(x, y) tmp = 0.0 if (x <= -33.0) tmp = Float64(x / Float64(2.0 - x)); elseif (x <= 2.15e+30) tmp = Float64(Float64(x - y) * Float64(1.0 / Float64(2.0 - y))); else tmp = Float64(Float64(x - y) / Float64(-x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -33.0) tmp = x / (2.0 - x); elseif (x <= 2.15e+30) tmp = (x - y) * (1.0 / (2.0 - y)); else tmp = (x - y) / -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -33.0], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.15e+30], N[(N[(x - y), $MachinePrecision] * N[(1.0 / N[(2.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] / (-x)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -33:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{+30}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{1}{2 - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{-x}\\
\end{array}
\end{array}
if x < -33Initial program 100.0%
Taylor expanded in y around 0 80.4%
if -33 < x < 2.15e30Initial program 99.9%
clear-num99.8%
associate-/r/99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 97.7%
if 2.15e30 < x Initial program 99.9%
clear-num99.9%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 78.6%
expm1-log1p-u76.5%
expm1-udef76.5%
*-commutative76.5%
frac-2neg76.5%
metadata-eval76.5%
un-div-inv76.6%
Applied egg-rr76.6%
expm1-def76.6%
expm1-log1p78.8%
Simplified78.8%
Final simplification89.1%
(FPCore (x y) :precision binary64 (if (<= x -9.4e+14) -1.0 (if (<= x 3.8e+31) 1.0 -1.0)))
double code(double x, double y) {
double tmp;
if (x <= -9.4e+14) {
tmp = -1.0;
} else if (x <= 3.8e+31) {
tmp = 1.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) :: tmp
if (x <= (-9.4d+14)) then
tmp = -1.0d0
else if (x <= 3.8d+31) then
tmp = 1.0d0
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -9.4e+14) {
tmp = -1.0;
} else if (x <= 3.8e+31) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -9.4e+14: tmp = -1.0 elif x <= 3.8e+31: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -9.4e+14) tmp = -1.0; elseif (x <= 3.8e+31) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -9.4e+14) tmp = -1.0; elseif (x <= 3.8e+31) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -9.4e+14], -1.0, If[LessEqual[x, 3.8e+31], 1.0, -1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.4 \cdot 10^{+14}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{+31}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -9.4e14 or 3.8000000000000001e31 < x Initial program 100.0%
Taylor expanded in x around inf 79.7%
if -9.4e14 < x < 3.8000000000000001e31Initial program 99.9%
Taylor expanded in y around inf 56.8%
Final simplification67.3%
(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 x around inf 39.1%
Final simplification39.1%
(FPCore (x y) :precision binary64 (let* ((t_0 (- 2.0 (+ x y)))) (- (/ x t_0) (/ y t_0))))
double code(double x, double y) {
double t_0 = 2.0 - (x + y);
return (x / t_0) - (y / t_0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
t_0 = 2.0d0 - (x + y)
code = (x / t_0) - (y / t_0)
end function
public static double code(double x, double y) {
double t_0 = 2.0 - (x + y);
return (x / t_0) - (y / t_0);
}
def code(x, y): t_0 = 2.0 - (x + y) return (x / t_0) - (y / t_0)
function code(x, y) t_0 = Float64(2.0 - Float64(x + y)) return Float64(Float64(x / t_0) - Float64(y / t_0)) end
function tmp = code(x, y) t_0 = 2.0 - (x + y); tmp = (x / t_0) - (y / t_0); end
code[x_, y_] := Block[{t$95$0 = N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]}, N[(N[(x / t$95$0), $MachinePrecision] - N[(y / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 - \left(x + y\right)\\
\frac{x}{t_0} - \frac{y}{t_0}
\end{array}
\end{array}
herbie shell --seed 2024020
(FPCore (x y)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, C"
:precision binary64
:herbie-target
(- (/ x (- 2.0 (+ x y))) (/ y (- 2.0 (+ x y))))
(/ (- x y) (- 2.0 (+ x y))))