
(FPCore (x y) :precision binary64 (/ (fabs (- x y)) (fabs y)))
double code(double x, double y) {
return fabs((x - y)) / fabs(y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = abs((x - y)) / abs(y)
end function
public static double code(double x, double y) {
return Math.abs((x - y)) / Math.abs(y);
}
def code(x, y): return math.fabs((x - y)) / math.fabs(y)
function code(x, y) return Float64(abs(Float64(x - y)) / abs(y)) end
function tmp = code(x, y) tmp = abs((x - y)) / abs(y); end
code[x_, y_] := N[(N[Abs[N[(x - y), $MachinePrecision]], $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left|x - y\right|}{\left|y\right|}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (fabs (- x y)) (fabs y)))
double code(double x, double y) {
return fabs((x - y)) / fabs(y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = abs((x - y)) / abs(y)
end function
public static double code(double x, double y) {
return Math.abs((x - y)) / Math.abs(y);
}
def code(x, y): return math.fabs((x - y)) / math.fabs(y)
function code(x, y) return Float64(abs(Float64(x - y)) / abs(y)) end
function tmp = code(x, y) tmp = abs((x - y)) / abs(y); end
code[x_, y_] := N[(N[Abs[N[(x - y), $MachinePrecision]], $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left|x - y\right|}{\left|y\right|}
\end{array}
(FPCore (x y) :precision binary64 (fabs (+ (/ x y) -1.0)))
double code(double x, double y) {
return fabs(((x / y) + -1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = abs(((x / y) + (-1.0d0)))
end function
public static double code(double x, double y) {
return Math.abs(((x / y) + -1.0));
}
def code(x, y): return math.fabs(((x / y) + -1.0))
function code(x, y) return abs(Float64(Float64(x / y) + -1.0)) end
function tmp = code(x, y) tmp = abs(((x / y) + -1.0)); end
code[x_, y_] := N[Abs[N[(N[(x / y), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x}{y} + -1\right|
\end{array}
Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-div100.0%
div-sub100.0%
*-inverses100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (<= y -2e-67) 1.0 (if (<= y 7e-73) (fabs (/ x y)) 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -2e-67) {
tmp = 1.0;
} else if (y <= 7e-73) {
tmp = fabs((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 <= (-2d-67)) then
tmp = 1.0d0
else if (y <= 7d-73) then
tmp = abs((x / y))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2e-67) {
tmp = 1.0;
} else if (y <= 7e-73) {
tmp = Math.abs((x / y));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2e-67: tmp = 1.0 elif y <= 7e-73: tmp = math.fabs((x / y)) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -2e-67) tmp = 1.0; elseif (y <= 7e-73) tmp = abs(Float64(x / y)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2e-67) tmp = 1.0; elseif (y <= 7e-73) tmp = abs((x / y)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2e-67], 1.0, If[LessEqual[y, 7e-73], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-67}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-73}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.99999999999999989e-67 or 6.9999999999999995e-73 < y Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-div100.0%
div-sub100.0%
*-inverses100.0%
Simplified100.0%
Taylor expanded in x around 0 75.9%
if -1.99999999999999989e-67 < y < 6.9999999999999995e-73Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-div100.0%
div-sub100.0%
*-inverses100.0%
Simplified100.0%
Taylor expanded in x around inf 85.7%
Simplified85.7%
Final simplification79.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (/ (/ x y) (- y x)))) (t_1 (/ y (+ x y))))
(if (<= y -4.8e-65)
t_1
(if (<= y -3.2e-168)
(/ x y)
(if (<= y -2.8e-273)
t_0
(if (<= y 2.9e-296)
(/ x y)
(if (<= y 4.4e-211) t_0 (if (<= y 1.3e-155) (/ x y) t_1))))))))
double code(double x, double y) {
double t_0 = x * ((x / y) / (y - x));
double t_1 = y / (x + y);
double tmp;
if (y <= -4.8e-65) {
tmp = t_1;
} else if (y <= -3.2e-168) {
tmp = x / y;
} else if (y <= -2.8e-273) {
tmp = t_0;
} else if (y <= 2.9e-296) {
tmp = x / y;
} else if (y <= 4.4e-211) {
tmp = t_0;
} else if (y <= 1.3e-155) {
tmp = x / y;
} else {
tmp = t_1;
}
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 = x * ((x / y) / (y - x))
t_1 = y / (x + y)
if (y <= (-4.8d-65)) then
tmp = t_1
else if (y <= (-3.2d-168)) then
tmp = x / y
else if (y <= (-2.8d-273)) then
tmp = t_0
else if (y <= 2.9d-296) then
tmp = x / y
else if (y <= 4.4d-211) then
tmp = t_0
else if (y <= 1.3d-155) then
tmp = x / y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * ((x / y) / (y - x));
double t_1 = y / (x + y);
double tmp;
if (y <= -4.8e-65) {
tmp = t_1;
} else if (y <= -3.2e-168) {
tmp = x / y;
} else if (y <= -2.8e-273) {
tmp = t_0;
} else if (y <= 2.9e-296) {
tmp = x / y;
} else if (y <= 4.4e-211) {
tmp = t_0;
} else if (y <= 1.3e-155) {
tmp = x / y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y): t_0 = x * ((x / y) / (y - x)) t_1 = y / (x + y) tmp = 0 if y <= -4.8e-65: tmp = t_1 elif y <= -3.2e-168: tmp = x / y elif y <= -2.8e-273: tmp = t_0 elif y <= 2.9e-296: tmp = x / y elif y <= 4.4e-211: tmp = t_0 elif y <= 1.3e-155: tmp = x / y else: tmp = t_1 return tmp
function code(x, y) t_0 = Float64(x * Float64(Float64(x / y) / Float64(y - x))) t_1 = Float64(y / Float64(x + y)) tmp = 0.0 if (y <= -4.8e-65) tmp = t_1; elseif (y <= -3.2e-168) tmp = Float64(x / y); elseif (y <= -2.8e-273) tmp = t_0; elseif (y <= 2.9e-296) tmp = Float64(x / y); elseif (y <= 4.4e-211) tmp = t_0; elseif (y <= 1.3e-155) tmp = Float64(x / y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y) t_0 = x * ((x / y) / (y - x)); t_1 = y / (x + y); tmp = 0.0; if (y <= -4.8e-65) tmp = t_1; elseif (y <= -3.2e-168) tmp = x / y; elseif (y <= -2.8e-273) tmp = t_0; elseif (y <= 2.9e-296) tmp = x / y; elseif (y <= 4.4e-211) tmp = t_0; elseif (y <= 1.3e-155) tmp = x / y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(N[(x / y), $MachinePrecision] / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.8e-65], t$95$1, If[LessEqual[y, -3.2e-168], N[(x / y), $MachinePrecision], If[LessEqual[y, -2.8e-273], t$95$0, If[LessEqual[y, 2.9e-296], N[(x / y), $MachinePrecision], If[LessEqual[y, 4.4e-211], t$95$0, If[LessEqual[y, 1.3e-155], N[(x / y), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{\frac{x}{y}}{y - x}\\
t_1 := \frac{y}{x + y}\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{-65}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -3.2 \cdot 10^{-168}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq -2.8 \cdot 10^{-273}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{-296}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{-211}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-155}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -4.8000000000000003e-65 or 1.30000000000000004e-155 < y Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt14.1%
fabs-sqr14.1%
rem-square-sqrt15.4%
div-sub15.4%
sub-neg15.4%
*-inverses15.4%
metadata-eval15.4%
+-commutative15.4%
Simplified15.4%
+-commutative15.4%
metadata-eval15.4%
sub-neg15.4%
*-inverses15.4%
div-sub15.4%
clear-num15.3%
associate-/r/15.4%
flip--6.4%
associate-*r/5.9%
Applied egg-rr5.9%
Taylor expanded in x around 0 1.6%
unpow21.6%
mul-1-neg1.6%
distribute-rgt-neg-out1.6%
Simplified1.6%
associate-*r*2.0%
lft-mult-inverse2.0%
*-un-lft-identity2.0%
add-sqr-sqrt1.0%
sqrt-unprod23.1%
sqr-neg23.1%
sqrt-unprod32.0%
add-sqr-sqrt71.3%
add-log-exp3.6%
*-un-lft-identity3.6%
log-prod3.6%
add-log-exp71.3%
metadata-eval71.3%
Applied egg-rr71.3%
+-lft-identity71.3%
Simplified71.3%
if -4.8000000000000003e-65 < y < -3.20000000000000006e-168 or -2.79999999999999985e-273 < y < 2.89999999999999983e-296 or 4.39999999999999996e-211 < y < 1.30000000000000004e-155Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt68.6%
fabs-sqr68.6%
rem-square-sqrt69.1%
div-sub69.1%
sub-neg69.1%
*-inverses69.1%
metadata-eval69.1%
+-commutative69.1%
Simplified69.1%
Taylor expanded in x around inf 69.8%
if -3.20000000000000006e-168 < y < -2.79999999999999985e-273 or 2.89999999999999983e-296 < y < 4.39999999999999996e-211Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt31.3%
fabs-sqr31.3%
rem-square-sqrt31.8%
div-sub31.8%
sub-neg31.8%
*-inverses31.8%
metadata-eval31.8%
+-commutative31.8%
Simplified31.8%
+-commutative31.8%
metadata-eval31.8%
sub-neg31.8%
*-inverses31.8%
div-sub31.8%
clear-num31.7%
associate-/r/31.7%
flip--31.9%
associate-*r/29.3%
Applied egg-rr29.3%
Taylor expanded in y around 0 29.3%
unpow229.3%
associate-/l*29.1%
associate-/r/29.1%
*-commutative29.1%
Simplified29.1%
associate-*r/29.3%
*-un-lft-identity29.3%
associate-*l/29.3%
frac-2neg29.3%
div-inv29.4%
associate-*l/29.4%
*-un-lft-identity29.4%
distribute-neg-frac29.4%
add-sqr-sqrt11.6%
sqrt-unprod23.6%
sqr-neg23.6%
sqrt-unprod26.7%
add-sqr-sqrt52.6%
frac-2neg52.6%
associate-*r/63.6%
+-commutative63.6%
distribute-neg-in63.6%
add-sqr-sqrt34.9%
sqrt-unprod62.4%
sqr-neg62.4%
sqrt-unprod28.7%
fma-def28.7%
fma-neg28.7%
add-sqr-sqrt62.3%
Applied egg-rr62.3%
associate-*l*62.4%
associate-*r/62.4%
*-rgt-identity62.4%
Simplified62.4%
Final simplification69.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ x y))))
(if (<= y -1.2e-66)
t_0
(if (<= y -3.6e-168)
(/ x y)
(if (<= y -2.9e-273)
(* (/ x y) (/ (- x) (+ x y)))
(if (<= y 9.8e-296)
(/ x y)
(if (<= y 4.7e-211)
(* x (/ (/ x y) (- y x)))
(if (<= y 1.65e-156) (/ x y) t_0))))))))
double code(double x, double y) {
double t_0 = y / (x + y);
double tmp;
if (y <= -1.2e-66) {
tmp = t_0;
} else if (y <= -3.6e-168) {
tmp = x / y;
} else if (y <= -2.9e-273) {
tmp = (x / y) * (-x / (x + y));
} else if (y <= 9.8e-296) {
tmp = x / y;
} else if (y <= 4.7e-211) {
tmp = x * ((x / y) / (y - x));
} else if (y <= 1.65e-156) {
tmp = 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 = y / (x + y)
if (y <= (-1.2d-66)) then
tmp = t_0
else if (y <= (-3.6d-168)) then
tmp = x / y
else if (y <= (-2.9d-273)) then
tmp = (x / y) * (-x / (x + y))
else if (y <= 9.8d-296) then
tmp = x / y
else if (y <= 4.7d-211) then
tmp = x * ((x / y) / (y - x))
else if (y <= 1.65d-156) then
tmp = x / y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / (x + y);
double tmp;
if (y <= -1.2e-66) {
tmp = t_0;
} else if (y <= -3.6e-168) {
tmp = x / y;
} else if (y <= -2.9e-273) {
tmp = (x / y) * (-x / (x + y));
} else if (y <= 9.8e-296) {
tmp = x / y;
} else if (y <= 4.7e-211) {
tmp = x * ((x / y) / (y - x));
} else if (y <= 1.65e-156) {
tmp = x / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = y / (x + y) tmp = 0 if y <= -1.2e-66: tmp = t_0 elif y <= -3.6e-168: tmp = x / y elif y <= -2.9e-273: tmp = (x / y) * (-x / (x + y)) elif y <= 9.8e-296: tmp = x / y elif y <= 4.7e-211: tmp = x * ((x / y) / (y - x)) elif y <= 1.65e-156: tmp = x / y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(y / Float64(x + y)) tmp = 0.0 if (y <= -1.2e-66) tmp = t_0; elseif (y <= -3.6e-168) tmp = Float64(x / y); elseif (y <= -2.9e-273) tmp = Float64(Float64(x / y) * Float64(Float64(-x) / Float64(x + y))); elseif (y <= 9.8e-296) tmp = Float64(x / y); elseif (y <= 4.7e-211) tmp = Float64(x * Float64(Float64(x / y) / Float64(y - x))); elseif (y <= 1.65e-156) tmp = Float64(x / y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = y / (x + y); tmp = 0.0; if (y <= -1.2e-66) tmp = t_0; elseif (y <= -3.6e-168) tmp = x / y; elseif (y <= -2.9e-273) tmp = (x / y) * (-x / (x + y)); elseif (y <= 9.8e-296) tmp = x / y; elseif (y <= 4.7e-211) tmp = x * ((x / y) / (y - x)); elseif (y <= 1.65e-156) tmp = x / y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.2e-66], t$95$0, If[LessEqual[y, -3.6e-168], N[(x / y), $MachinePrecision], If[LessEqual[y, -2.9e-273], N[(N[(x / y), $MachinePrecision] * N[((-x) / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.8e-296], N[(x / y), $MachinePrecision], If[LessEqual[y, 4.7e-211], N[(x * N[(N[(x / y), $MachinePrecision] / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.65e-156], N[(x / y), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{x + y}\\
\mathbf{if}\;y \leq -1.2 \cdot 10^{-66}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-168}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq -2.9 \cdot 10^{-273}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{-x}{x + y}\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{-296}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-211}:\\
\;\;\;\;x \cdot \frac{\frac{x}{y}}{y - x}\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{-156}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.20000000000000013e-66 or 1.6499999999999999e-156 < y Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt14.1%
fabs-sqr14.1%
rem-square-sqrt15.4%
div-sub15.4%
sub-neg15.4%
*-inverses15.4%
metadata-eval15.4%
+-commutative15.4%
Simplified15.4%
+-commutative15.4%
metadata-eval15.4%
sub-neg15.4%
*-inverses15.4%
div-sub15.4%
clear-num15.3%
associate-/r/15.4%
flip--6.4%
associate-*r/5.9%
Applied egg-rr5.9%
Taylor expanded in x around 0 1.6%
unpow21.6%
mul-1-neg1.6%
distribute-rgt-neg-out1.6%
Simplified1.6%
associate-*r*2.0%
lft-mult-inverse2.0%
*-un-lft-identity2.0%
add-sqr-sqrt1.0%
sqrt-unprod23.1%
sqr-neg23.1%
sqrt-unprod32.0%
add-sqr-sqrt71.3%
add-log-exp3.6%
*-un-lft-identity3.6%
log-prod3.6%
add-log-exp71.3%
metadata-eval71.3%
Applied egg-rr71.3%
+-lft-identity71.3%
Simplified71.3%
if -1.20000000000000013e-66 < y < -3.5999999999999999e-168 or -2.89999999999999986e-273 < y < 9.7999999999999997e-296 or 4.6999999999999997e-211 < y < 1.6499999999999999e-156Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt68.6%
fabs-sqr68.6%
rem-square-sqrt69.1%
div-sub69.1%
sub-neg69.1%
*-inverses69.1%
metadata-eval69.1%
+-commutative69.1%
Simplified69.1%
Taylor expanded in x around inf 69.8%
if -3.5999999999999999e-168 < y < -2.89999999999999986e-273Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt34.8%
fabs-sqr34.8%
rem-square-sqrt35.4%
div-sub35.4%
sub-neg35.4%
*-inverses35.4%
metadata-eval35.4%
+-commutative35.4%
Simplified35.4%
+-commutative35.4%
metadata-eval35.4%
sub-neg35.4%
*-inverses35.4%
div-sub35.4%
clear-num35.3%
associate-/r/35.3%
flip--35.5%
associate-*r/31.0%
Applied egg-rr31.0%
Taylor expanded in y around 0 31.0%
unpow231.0%
associate-/l*30.8%
associate-/r/30.8%
*-commutative30.8%
Simplified30.8%
associate-*r/31.0%
*-un-lft-identity31.0%
associate-*l/31.0%
frac-2neg31.0%
distribute-frac-neg31.0%
*-commutative31.0%
div-inv31.0%
frac-2neg31.0%
add-sqr-sqrt30.9%
sqrt-unprod16.2%
sqr-neg16.2%
sqrt-unprod0.0%
add-sqr-sqrt46.9%
distribute-neg-frac46.9%
associate-*r/61.2%
frac-2neg61.2%
associate-/l*61.3%
associate-/r/61.3%
Applied egg-rr61.3%
distribute-rgt-neg-in61.3%
Simplified61.3%
if 9.7999999999999997e-296 < y < 4.6999999999999997e-211Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt26.7%
fabs-sqr26.7%
rem-square-sqrt26.9%
div-sub26.9%
sub-neg26.9%
*-inverses26.9%
metadata-eval26.9%
+-commutative26.9%
Simplified26.9%
+-commutative26.9%
metadata-eval26.9%
sub-neg26.9%
*-inverses26.9%
div-sub26.9%
clear-num26.9%
associate-/r/26.9%
flip--27.1%
associate-*r/27.1%
Applied egg-rr27.1%
Taylor expanded in y around 0 27.1%
unpow227.1%
associate-/l*26.9%
associate-/r/27.0%
*-commutative27.0%
Simplified27.0%
associate-*r/27.1%
*-un-lft-identity27.1%
associate-*l/27.1%
frac-2neg27.1%
div-inv27.1%
associate-*l/27.1%
*-un-lft-identity27.1%
distribute-neg-frac27.1%
add-sqr-sqrt27.1%
sqrt-unprod20.3%
sqr-neg20.3%
sqrt-unprod0.0%
add-sqr-sqrt60.2%
frac-2neg60.2%
associate-*r/66.9%
+-commutative66.9%
distribute-neg-in66.9%
add-sqr-sqrt0.0%
sqrt-unprod66.9%
sqr-neg66.9%
sqrt-unprod66.9%
fma-def66.9%
fma-neg66.9%
add-sqr-sqrt66.9%
Applied egg-rr66.9%
associate-*l*67.1%
associate-*r/67.1%
*-rgt-identity67.1%
Simplified67.1%
Final simplification70.0%
(FPCore (x y)
:precision binary64
(if (<= y -3.4e-70)
1.0
(if (<= y -3e-168)
(/ x y)
(if (<= y -1e-272)
(* (/ x y) (/ (- x) (+ x y)))
(if (<= y 1.05e-296)
(/ x y)
(if (<= y 4.7e-211)
(* x (/ (/ x y) (- y x)))
(if (<= y 5.8e-155) (/ x y) 1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -3.4e-70) {
tmp = 1.0;
} else if (y <= -3e-168) {
tmp = x / y;
} else if (y <= -1e-272) {
tmp = (x / y) * (-x / (x + y));
} else if (y <= 1.05e-296) {
tmp = x / y;
} else if (y <= 4.7e-211) {
tmp = x * ((x / y) / (y - x));
} else if (y <= 5.8e-155) {
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 <= (-3.4d-70)) then
tmp = 1.0d0
else if (y <= (-3d-168)) then
tmp = x / y
else if (y <= (-1d-272)) then
tmp = (x / y) * (-x / (x + y))
else if (y <= 1.05d-296) then
tmp = x / y
else if (y <= 4.7d-211) then
tmp = x * ((x / y) / (y - x))
else if (y <= 5.8d-155) 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 <= -3.4e-70) {
tmp = 1.0;
} else if (y <= -3e-168) {
tmp = x / y;
} else if (y <= -1e-272) {
tmp = (x / y) * (-x / (x + y));
} else if (y <= 1.05e-296) {
tmp = x / y;
} else if (y <= 4.7e-211) {
tmp = x * ((x / y) / (y - x));
} else if (y <= 5.8e-155) {
tmp = x / y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.4e-70: tmp = 1.0 elif y <= -3e-168: tmp = x / y elif y <= -1e-272: tmp = (x / y) * (-x / (x + y)) elif y <= 1.05e-296: tmp = x / y elif y <= 4.7e-211: tmp = x * ((x / y) / (y - x)) elif y <= 5.8e-155: tmp = x / y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.4e-70) tmp = 1.0; elseif (y <= -3e-168) tmp = Float64(x / y); elseif (y <= -1e-272) tmp = Float64(Float64(x / y) * Float64(Float64(-x) / Float64(x + y))); elseif (y <= 1.05e-296) tmp = Float64(x / y); elseif (y <= 4.7e-211) tmp = Float64(x * Float64(Float64(x / y) / Float64(y - x))); elseif (y <= 5.8e-155) tmp = Float64(x / y); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.4e-70) tmp = 1.0; elseif (y <= -3e-168) tmp = x / y; elseif (y <= -1e-272) tmp = (x / y) * (-x / (x + y)); elseif (y <= 1.05e-296) tmp = x / y; elseif (y <= 4.7e-211) tmp = x * ((x / y) / (y - x)); elseif (y <= 5.8e-155) tmp = x / y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.4e-70], 1.0, If[LessEqual[y, -3e-168], N[(x / y), $MachinePrecision], If[LessEqual[y, -1e-272], N[(N[(x / y), $MachinePrecision] * N[((-x) / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.05e-296], N[(x / y), $MachinePrecision], If[LessEqual[y, 4.7e-211], N[(x * N[(N[(x / y), $MachinePrecision] / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.8e-155], N[(x / y), $MachinePrecision], 1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{-70}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -3 \cdot 10^{-168}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq -1 \cdot 10^{-272}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{-x}{x + y}\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-296}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-211}:\\
\;\;\;\;x \cdot \frac{\frac{x}{y}}{y - x}\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-155}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.39999999999999995e-70 or 5.80000000000000021e-155 < y Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-div100.0%
div-sub100.0%
*-inverses100.0%
Simplified100.0%
Taylor expanded in x around 0 71.9%
if -3.39999999999999995e-70 < y < -2.99999999999999991e-168 or -9.9999999999999993e-273 < y < 1.05e-296 or 4.6999999999999997e-211 < y < 5.80000000000000021e-155Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt68.6%
fabs-sqr68.6%
rem-square-sqrt69.1%
div-sub69.1%
sub-neg69.1%
*-inverses69.1%
metadata-eval69.1%
+-commutative69.1%
Simplified69.1%
Taylor expanded in x around inf 69.8%
if -2.99999999999999991e-168 < y < -9.9999999999999993e-273Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt34.8%
fabs-sqr34.8%
rem-square-sqrt35.4%
div-sub35.4%
sub-neg35.4%
*-inverses35.4%
metadata-eval35.4%
+-commutative35.4%
Simplified35.4%
+-commutative35.4%
metadata-eval35.4%
sub-neg35.4%
*-inverses35.4%
div-sub35.4%
clear-num35.3%
associate-/r/35.3%
flip--35.5%
associate-*r/31.0%
Applied egg-rr31.0%
Taylor expanded in y around 0 31.0%
unpow231.0%
associate-/l*30.8%
associate-/r/30.8%
*-commutative30.8%
Simplified30.8%
associate-*r/31.0%
*-un-lft-identity31.0%
associate-*l/31.0%
frac-2neg31.0%
distribute-frac-neg31.0%
*-commutative31.0%
div-inv31.0%
frac-2neg31.0%
add-sqr-sqrt30.9%
sqrt-unprod16.2%
sqr-neg16.2%
sqrt-unprod0.0%
add-sqr-sqrt46.9%
distribute-neg-frac46.9%
associate-*r/61.2%
frac-2neg61.2%
associate-/l*61.3%
associate-/r/61.3%
Applied egg-rr61.3%
distribute-rgt-neg-in61.3%
Simplified61.3%
if 1.05e-296 < y < 4.6999999999999997e-211Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt26.7%
fabs-sqr26.7%
rem-square-sqrt26.9%
div-sub26.9%
sub-neg26.9%
*-inverses26.9%
metadata-eval26.9%
+-commutative26.9%
Simplified26.9%
+-commutative26.9%
metadata-eval26.9%
sub-neg26.9%
*-inverses26.9%
div-sub26.9%
clear-num26.9%
associate-/r/26.9%
flip--27.1%
associate-*r/27.1%
Applied egg-rr27.1%
Taylor expanded in y around 0 27.1%
unpow227.1%
associate-/l*26.9%
associate-/r/27.0%
*-commutative27.0%
Simplified27.0%
associate-*r/27.1%
*-un-lft-identity27.1%
associate-*l/27.1%
frac-2neg27.1%
div-inv27.1%
associate-*l/27.1%
*-un-lft-identity27.1%
distribute-neg-frac27.1%
add-sqr-sqrt27.1%
sqrt-unprod20.3%
sqr-neg20.3%
sqrt-unprod0.0%
add-sqr-sqrt60.2%
frac-2neg60.2%
associate-*r/66.9%
+-commutative66.9%
distribute-neg-in66.9%
add-sqr-sqrt0.0%
sqrt-unprod66.9%
sqr-neg66.9%
sqrt-unprod66.9%
fma-def66.9%
fma-neg66.9%
add-sqr-sqrt66.9%
Applied egg-rr66.9%
associate-*l*67.1%
associate-*r/67.1%
*-rgt-identity67.1%
Simplified67.1%
Final simplification70.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ x y))))
(if (<= y -8.5e-73)
t_0
(if (<= y 7.2e-304)
(/ x y)
(if (<= y 3.75e-211)
(/ (* x x) (* y y))
(if (<= y 4.6e-159) (/ x y) t_0))))))
double code(double x, double y) {
double t_0 = y / (x + y);
double tmp;
if (y <= -8.5e-73) {
tmp = t_0;
} else if (y <= 7.2e-304) {
tmp = x / y;
} else if (y <= 3.75e-211) {
tmp = (x * x) / (y * y);
} else if (y <= 4.6e-159) {
tmp = 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 = y / (x + y)
if (y <= (-8.5d-73)) then
tmp = t_0
else if (y <= 7.2d-304) then
tmp = x / y
else if (y <= 3.75d-211) then
tmp = (x * x) / (y * y)
else if (y <= 4.6d-159) then
tmp = x / y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / (x + y);
double tmp;
if (y <= -8.5e-73) {
tmp = t_0;
} else if (y <= 7.2e-304) {
tmp = x / y;
} else if (y <= 3.75e-211) {
tmp = (x * x) / (y * y);
} else if (y <= 4.6e-159) {
tmp = x / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = y / (x + y) tmp = 0 if y <= -8.5e-73: tmp = t_0 elif y <= 7.2e-304: tmp = x / y elif y <= 3.75e-211: tmp = (x * x) / (y * y) elif y <= 4.6e-159: tmp = x / y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(y / Float64(x + y)) tmp = 0.0 if (y <= -8.5e-73) tmp = t_0; elseif (y <= 7.2e-304) tmp = Float64(x / y); elseif (y <= 3.75e-211) tmp = Float64(Float64(x * x) / Float64(y * y)); elseif (y <= 4.6e-159) tmp = Float64(x / y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = y / (x + y); tmp = 0.0; if (y <= -8.5e-73) tmp = t_0; elseif (y <= 7.2e-304) tmp = x / y; elseif (y <= 3.75e-211) tmp = (x * x) / (y * y); elseif (y <= 4.6e-159) tmp = x / y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.5e-73], t$95$0, If[LessEqual[y, 7.2e-304], N[(x / y), $MachinePrecision], If[LessEqual[y, 3.75e-211], N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.6e-159], N[(x / y), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{x + y}\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{-73}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-304}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 3.75 \cdot 10^{-211}:\\
\;\;\;\;\frac{x \cdot x}{y \cdot y}\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{-159}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -8.4999999999999996e-73 or 4.59999999999999957e-159 < y Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt14.1%
fabs-sqr14.1%
rem-square-sqrt15.4%
div-sub15.4%
sub-neg15.4%
*-inverses15.4%
metadata-eval15.4%
+-commutative15.4%
Simplified15.4%
+-commutative15.4%
metadata-eval15.4%
sub-neg15.4%
*-inverses15.4%
div-sub15.4%
clear-num15.3%
associate-/r/15.4%
flip--6.4%
associate-*r/5.9%
Applied egg-rr5.9%
Taylor expanded in x around 0 1.6%
unpow21.6%
mul-1-neg1.6%
distribute-rgt-neg-out1.6%
Simplified1.6%
associate-*r*2.0%
lft-mult-inverse2.0%
*-un-lft-identity2.0%
add-sqr-sqrt1.0%
sqrt-unprod23.1%
sqr-neg23.1%
sqrt-unprod32.0%
add-sqr-sqrt71.3%
add-log-exp3.6%
*-un-lft-identity3.6%
log-prod3.6%
add-log-exp71.3%
metadata-eval71.3%
Applied egg-rr71.3%
+-lft-identity71.3%
Simplified71.3%
if -8.4999999999999996e-73 < y < 7.2000000000000003e-304 or 3.7500000000000002e-211 < y < 4.59999999999999957e-159Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt57.6%
fabs-sqr57.6%
rem-square-sqrt58.1%
div-sub58.1%
sub-neg58.1%
*-inverses58.1%
metadata-eval58.1%
+-commutative58.1%
Simplified58.1%
Taylor expanded in x around inf 58.6%
if 7.2000000000000003e-304 < y < 3.7500000000000002e-211Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt31.3%
fabs-sqr31.3%
rem-square-sqrt31.5%
div-sub31.5%
sub-neg31.5%
*-inverses31.5%
metadata-eval31.5%
+-commutative31.5%
Simplified31.5%
+-commutative31.5%
metadata-eval31.5%
sub-neg31.5%
*-inverses31.5%
div-sub31.5%
clear-num31.5%
associate-/r/31.5%
flip--31.7%
associate-*r/31.7%
Applied egg-rr31.7%
Taylor expanded in y around 0 31.7%
unpow231.7%
associate-/l*31.5%
associate-/r/31.6%
*-commutative31.6%
Simplified31.6%
Taylor expanded in x around 0 63.9%
unpow263.9%
unpow263.9%
Simplified63.9%
Final simplification67.7%
(FPCore (x y) :precision binary64 (if (or (<= y -2.2e-71) (not (<= y 3.6e-159))) (/ y (+ x y)) (/ x y)))
double code(double x, double y) {
double tmp;
if ((y <= -2.2e-71) || !(y <= 3.6e-159)) {
tmp = y / (x + y);
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-2.2d-71)) .or. (.not. (y <= 3.6d-159))) then
tmp = y / (x + y)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -2.2e-71) || !(y <= 3.6e-159)) {
tmp = y / (x + y);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -2.2e-71) or not (y <= 3.6e-159): tmp = y / (x + y) else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if ((y <= -2.2e-71) || !(y <= 3.6e-159)) tmp = Float64(y / Float64(x + y)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -2.2e-71) || ~((y <= 3.6e-159))) tmp = y / (x + y); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -2.2e-71], N[Not[LessEqual[y, 3.6e-159]], $MachinePrecision]], N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{-71} \lor \neg \left(y \leq 3.6 \cdot 10^{-159}\right):\\
\;\;\;\;\frac{y}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if y < -2.19999999999999997e-71 or 3.60000000000000021e-159 < y Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt14.1%
fabs-sqr14.1%
rem-square-sqrt15.4%
div-sub15.4%
sub-neg15.4%
*-inverses15.4%
metadata-eval15.4%
+-commutative15.4%
Simplified15.4%
+-commutative15.4%
metadata-eval15.4%
sub-neg15.4%
*-inverses15.4%
div-sub15.4%
clear-num15.3%
associate-/r/15.4%
flip--6.4%
associate-*r/5.9%
Applied egg-rr5.9%
Taylor expanded in x around 0 1.6%
unpow21.6%
mul-1-neg1.6%
distribute-rgt-neg-out1.6%
Simplified1.6%
associate-*r*2.0%
lft-mult-inverse2.0%
*-un-lft-identity2.0%
add-sqr-sqrt1.0%
sqrt-unprod23.1%
sqr-neg23.1%
sqrt-unprod32.0%
add-sqr-sqrt71.3%
add-log-exp3.6%
*-un-lft-identity3.6%
log-prod3.6%
add-log-exp71.3%
metadata-eval71.3%
Applied egg-rr71.3%
+-lft-identity71.3%
Simplified71.3%
if -2.19999999999999997e-71 < y < 3.60000000000000021e-159Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt52.3%
fabs-sqr52.3%
rem-square-sqrt52.8%
div-sub52.8%
sub-neg52.8%
*-inverses52.8%
metadata-eval52.8%
+-commutative52.8%
Simplified52.8%
Taylor expanded in x around inf 53.2%
Final simplification65.7%
(FPCore (x y) :precision binary64 (/ x y))
double code(double x, double y) {
return x / y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / y
end function
public static double code(double x, double y) {
return x / y;
}
def code(x, y): return x / y
function code(x, y) return Float64(x / y) end
function tmp = code(x, y) tmp = x / y; end
code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y}
\end{array}
Initial program 100.0%
Taylor expanded in x around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt26.1%
fabs-sqr26.1%
rem-square-sqrt27.1%
div-sub27.1%
sub-neg27.1%
*-inverses27.1%
metadata-eval27.1%
+-commutative27.1%
Simplified27.1%
Taylor expanded in x around inf 27.9%
Final simplification27.9%
(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 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
fabs-div100.0%
rem-square-sqrt26.1%
fabs-sqr26.1%
rem-square-sqrt27.1%
div-sub27.1%
sub-neg27.1%
*-inverses27.1%
metadata-eval27.1%
+-commutative27.1%
Simplified27.1%
Taylor expanded in x around 0 1.3%
Final simplification1.3%
herbie shell --seed 2023192
(FPCore (x y)
:name "Numeric.LinearAlgebra.Util:formatSparse from hmatrix-0.16.1.5"
:precision binary64
(/ (fabs (- x y)) (fabs y)))