
(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 7 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 (- 1.0 (/ x y))))
double code(double x, double y) {
return fabs((1.0 - (x / y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = abs((1.0d0 - (x / y)))
end function
public static double code(double x, double y) {
return Math.abs((1.0 - (x / y)));
}
def code(x, y): return math.fabs((1.0 - (x / y)))
function code(x, y) return abs(Float64(1.0 - Float64(x / y))) end
function tmp = code(x, y) tmp = abs((1.0 - (x / y))); end
code[x_, y_] := N[Abs[N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|1 - \frac{x}{y}\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
(let* ((t_0 (* (/ (/ x y) (+ x y)) (- x))))
(if (<= x -1.25e+171)
t_0
(if (<= x -5.4e+142)
(/ x y)
(if (or (<= x -1e+59) (not (<= x 3.75e+65))) t_0 (/ y (+ x y)))))))
double code(double x, double y) {
double t_0 = ((x / y) / (x + y)) * -x;
double tmp;
if (x <= -1.25e+171) {
tmp = t_0;
} else if (x <= -5.4e+142) {
tmp = x / y;
} else if ((x <= -1e+59) || !(x <= 3.75e+65)) {
tmp = t_0;
} else {
tmp = y / (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 / y) / (x + y)) * -x
if (x <= (-1.25d+171)) then
tmp = t_0
else if (x <= (-5.4d+142)) then
tmp = x / y
else if ((x <= (-1d+59)) .or. (.not. (x <= 3.75d+65))) then
tmp = t_0
else
tmp = y / (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((x / y) / (x + y)) * -x;
double tmp;
if (x <= -1.25e+171) {
tmp = t_0;
} else if (x <= -5.4e+142) {
tmp = x / y;
} else if ((x <= -1e+59) || !(x <= 3.75e+65)) {
tmp = t_0;
} else {
tmp = y / (x + y);
}
return tmp;
}
def code(x, y): t_0 = ((x / y) / (x + y)) * -x tmp = 0 if x <= -1.25e+171: tmp = t_0 elif x <= -5.4e+142: tmp = x / y elif (x <= -1e+59) or not (x <= 3.75e+65): tmp = t_0 else: tmp = y / (x + y) return tmp
function code(x, y) t_0 = Float64(Float64(Float64(x / y) / Float64(x + y)) * Float64(-x)) tmp = 0.0 if (x <= -1.25e+171) tmp = t_0; elseif (x <= -5.4e+142) tmp = Float64(x / y); elseif ((x <= -1e+59) || !(x <= 3.75e+65)) tmp = t_0; else tmp = Float64(y / Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) t_0 = ((x / y) / (x + y)) * -x; tmp = 0.0; if (x <= -1.25e+171) tmp = t_0; elseif (x <= -5.4e+142) tmp = x / y; elseif ((x <= -1e+59) || ~((x <= 3.75e+65))) tmp = t_0; else tmp = y / (x + y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x / y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] * (-x)), $MachinePrecision]}, If[LessEqual[x, -1.25e+171], t$95$0, If[LessEqual[x, -5.4e+142], N[(x / y), $MachinePrecision], If[Or[LessEqual[x, -1e+59], N[Not[LessEqual[x, 3.75e+65]], $MachinePrecision]], t$95$0, N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{x}{y}}{x + y} \cdot \left(-x\right)\\
\mathbf{if}\;x \leq -1.25 \cdot 10^{+171}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -5.4 \cdot 10^{+142}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -1 \cdot 10^{+59} \lor \neg \left(x \leq 3.75 \cdot 10^{+65}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x + y}\\
\end{array}
\end{array}
if x < -1.2500000000000001e171 or -5.39999999999999965e142 < x < -9.99999999999999972e58 or 3.75000000000000003e65 < x Initial program 100.0%
div-inv99.6%
add-sqr-sqrt44.3%
fabs-sqr44.3%
add-sqr-sqrt44.8%
*-commutative44.8%
add-sqr-sqrt17.5%
fabs-sqr17.5%
add-sqr-sqrt34.0%
Applied egg-rr34.0%
flip--14.2%
associate-*r/14.2%
+-commutative14.2%
Applied egg-rr14.2%
Taylor expanded in y around 0 14.9%
unpow214.9%
associate-/l*19.6%
associate-/r/19.6%
Simplified19.6%
associate-*l/14.9%
*-un-lft-identity14.9%
associate-*l/14.9%
frac-2neg14.9%
distribute-frac-neg14.9%
associate-*l/14.9%
*-un-lft-identity14.9%
frac-2neg14.9%
add-sqr-sqrt5.3%
sqrt-unprod20.0%
sqr-neg20.0%
sqrt-unprod15.3%
add-sqr-sqrt25.7%
distribute-neg-frac25.7%
associate-*l/32.8%
frac-2neg32.8%
associate-/l*53.3%
associate-/r/53.3%
+-commutative53.3%
Applied egg-rr53.3%
if -1.2500000000000001e171 < x < -5.39999999999999965e142Initial program 100.0%
div-inv99.5%
add-sqr-sqrt29.8%
fabs-sqr29.8%
add-sqr-sqrt30.3%
*-commutative30.3%
add-sqr-sqrt0.3%
fabs-sqr0.3%
add-sqr-sqrt50.6%
Applied egg-rr50.6%
Taylor expanded in y around 0 52.1%
if -9.99999999999999972e58 < x < 3.75000000000000003e65Initial program 100.0%
div-inv99.7%
add-sqr-sqrt47.0%
fabs-sqr47.0%
add-sqr-sqrt47.9%
*-commutative47.9%
add-sqr-sqrt9.0%
fabs-sqr9.0%
add-sqr-sqrt21.2%
Applied egg-rr21.2%
flip--16.9%
associate-*r/17.0%
+-commutative17.0%
Applied egg-rr17.0%
Taylor expanded in x around 0 1.8%
unpow21.8%
mul-1-neg1.8%
distribute-rgt-neg-out1.8%
Simplified1.8%
associate-*r*2.1%
lft-mult-inverse2.1%
*-un-lft-identity2.1%
neg-sub02.1%
metadata-eval2.1%
sub-neg2.1%
metadata-eval2.1%
add-sqr-sqrt1.0%
sqrt-unprod23.4%
sqr-neg23.4%
sqrt-unprod35.3%
add-sqr-sqrt67.5%
Applied egg-rr67.5%
+-lft-identity67.5%
Simplified67.5%
Final simplification61.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (/ (/ x y) (- y x)))))
(if (<= x -8.5e+173)
t_0
(if (<= x -9.2e+137)
(/ x y)
(if (or (<= x -8.5e+58) (not (<= x 2.55e+65))) t_0 (/ y (+ x y)))))))
double code(double x, double y) {
double t_0 = x * ((x / y) / (y - x));
double tmp;
if (x <= -8.5e+173) {
tmp = t_0;
} else if (x <= -9.2e+137) {
tmp = x / y;
} else if ((x <= -8.5e+58) || !(x <= 2.55e+65)) {
tmp = t_0;
} else {
tmp = y / (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 * ((x / y) / (y - x))
if (x <= (-8.5d+173)) then
tmp = t_0
else if (x <= (-9.2d+137)) then
tmp = x / y
else if ((x <= (-8.5d+58)) .or. (.not. (x <= 2.55d+65))) then
tmp = t_0
else
tmp = y / (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * ((x / y) / (y - x));
double tmp;
if (x <= -8.5e+173) {
tmp = t_0;
} else if (x <= -9.2e+137) {
tmp = x / y;
} else if ((x <= -8.5e+58) || !(x <= 2.55e+65)) {
tmp = t_0;
} else {
tmp = y / (x + y);
}
return tmp;
}
def code(x, y): t_0 = x * ((x / y) / (y - x)) tmp = 0 if x <= -8.5e+173: tmp = t_0 elif x <= -9.2e+137: tmp = x / y elif (x <= -8.5e+58) or not (x <= 2.55e+65): tmp = t_0 else: tmp = y / (x + y) return tmp
function code(x, y) t_0 = Float64(x * Float64(Float64(x / y) / Float64(y - x))) tmp = 0.0 if (x <= -8.5e+173) tmp = t_0; elseif (x <= -9.2e+137) tmp = Float64(x / y); elseif ((x <= -8.5e+58) || !(x <= 2.55e+65)) tmp = t_0; else tmp = Float64(y / Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) t_0 = x * ((x / y) / (y - x)); tmp = 0.0; if (x <= -8.5e+173) tmp = t_0; elseif (x <= -9.2e+137) tmp = x / y; elseif ((x <= -8.5e+58) || ~((x <= 2.55e+65))) tmp = t_0; else tmp = y / (x + y); 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]}, If[LessEqual[x, -8.5e+173], t$95$0, If[LessEqual[x, -9.2e+137], N[(x / y), $MachinePrecision], If[Or[LessEqual[x, -8.5e+58], N[Not[LessEqual[x, 2.55e+65]], $MachinePrecision]], t$95$0, N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{\frac{x}{y}}{y - x}\\
\mathbf{if}\;x \leq -8.5 \cdot 10^{+173}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{+137}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -8.5 \cdot 10^{+58} \lor \neg \left(x \leq 2.55 \cdot 10^{+65}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x + y}\\
\end{array}
\end{array}
if x < -8.5000000000000003e173 or -9.19999999999999997e137 < x < -8.50000000000000015e58 or 2.54999999999999994e65 < x Initial program 100.0%
div-inv99.6%
add-sqr-sqrt44.3%
fabs-sqr44.3%
add-sqr-sqrt44.8%
*-commutative44.8%
add-sqr-sqrt17.5%
fabs-sqr17.5%
add-sqr-sqrt34.0%
Applied egg-rr34.0%
flip--14.2%
associate-*r/14.2%
+-commutative14.2%
Applied egg-rr14.2%
Taylor expanded in y around 0 14.9%
unpow214.9%
associate-/l*19.6%
associate-/r/19.6%
Simplified19.6%
associate-*l/14.9%
*-un-lft-identity14.9%
associate-*l/14.9%
frac-2neg14.9%
div-inv14.9%
associate-*l/14.9%
*-un-lft-identity14.9%
distribute-neg-frac14.9%
add-sqr-sqrt9.6%
sqrt-unprod19.6%
sqr-neg19.6%
sqrt-unprod10.4%
add-sqr-sqrt25.7%
frac-2neg25.7%
associate-*r/32.7%
distribute-neg-in32.7%
add-sqr-sqrt15.8%
sqrt-unprod29.8%
sqr-neg29.8%
sqrt-unprod16.7%
add-sqr-sqrt32.4%
sub-neg32.4%
Applied egg-rr32.4%
associate-*l*52.8%
associate-*r/52.9%
*-rgt-identity52.9%
Simplified52.9%
if -8.5000000000000003e173 < x < -9.19999999999999997e137Initial program 100.0%
div-inv99.5%
add-sqr-sqrt29.8%
fabs-sqr29.8%
add-sqr-sqrt30.3%
*-commutative30.3%
add-sqr-sqrt0.3%
fabs-sqr0.3%
add-sqr-sqrt50.6%
Applied egg-rr50.6%
Taylor expanded in y around 0 52.1%
if -8.50000000000000015e58 < x < 2.54999999999999994e65Initial program 100.0%
div-inv99.7%
add-sqr-sqrt47.0%
fabs-sqr47.0%
add-sqr-sqrt47.9%
*-commutative47.9%
add-sqr-sqrt9.0%
fabs-sqr9.0%
add-sqr-sqrt21.2%
Applied egg-rr21.2%
flip--16.9%
associate-*r/17.0%
+-commutative17.0%
Applied egg-rr17.0%
Taylor expanded in x around 0 1.8%
unpow21.8%
mul-1-neg1.8%
distribute-rgt-neg-out1.8%
Simplified1.8%
associate-*r*2.1%
lft-mult-inverse2.1%
*-un-lft-identity2.1%
neg-sub02.1%
metadata-eval2.1%
sub-neg2.1%
metadata-eval2.1%
add-sqr-sqrt1.0%
sqrt-unprod23.4%
sqr-neg23.4%
sqrt-unprod35.3%
add-sqr-sqrt67.5%
Applied egg-rr67.5%
+-lft-identity67.5%
Simplified67.5%
Final simplification61.7%
(FPCore (x y) :precision binary64 (if (<= y -4.8e-71) (/ y (+ x y)) (if (<= y 3.5e-199) (+ (/ x y) -1.0) (* y (/ 1.0 (- y x))))))
double code(double x, double y) {
double tmp;
if (y <= -4.8e-71) {
tmp = y / (x + y);
} else if (y <= 3.5e-199) {
tmp = (x / y) + -1.0;
} else {
tmp = y * (1.0 / (y - x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-4.8d-71)) then
tmp = y / (x + y)
else if (y <= 3.5d-199) then
tmp = (x / y) + (-1.0d0)
else
tmp = y * (1.0d0 / (y - x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4.8e-71) {
tmp = y / (x + y);
} else if (y <= 3.5e-199) {
tmp = (x / y) + -1.0;
} else {
tmp = y * (1.0 / (y - x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.8e-71: tmp = y / (x + y) elif y <= 3.5e-199: tmp = (x / y) + -1.0 else: tmp = y * (1.0 / (y - x)) return tmp
function code(x, y) tmp = 0.0 if (y <= -4.8e-71) tmp = Float64(y / Float64(x + y)); elseif (y <= 3.5e-199) tmp = Float64(Float64(x / y) + -1.0); else tmp = Float64(y * Float64(1.0 / Float64(y - x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.8e-71) tmp = y / (x + y); elseif (y <= 3.5e-199) tmp = (x / y) + -1.0; else tmp = y * (1.0 / (y - x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.8e-71], N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.5e-199], N[(N[(x / y), $MachinePrecision] + -1.0), $MachinePrecision], N[(y * N[(1.0 / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-71}:\\
\;\;\;\;\frac{y}{x + y}\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{-199}:\\
\;\;\;\;\frac{x}{y} + -1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{1}{y - x}\\
\end{array}
\end{array}
if y < -4.8e-71Initial program 100.0%
div-inv99.6%
add-sqr-sqrt79.6%
fabs-sqr79.6%
add-sqr-sqrt80.1%
*-commutative80.1%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt20.7%
Applied egg-rr20.7%
flip--5.3%
associate-*r/5.3%
+-commutative5.3%
Applied egg-rr5.3%
Taylor expanded in x around 0 1.8%
unpow21.8%
mul-1-neg1.8%
distribute-rgt-neg-out1.8%
Simplified1.8%
associate-*r*2.2%
lft-mult-inverse2.2%
*-un-lft-identity2.2%
neg-sub02.2%
metadata-eval2.2%
sub-neg2.2%
metadata-eval2.2%
add-sqr-sqrt2.2%
sqrt-unprod1.8%
sqr-neg1.8%
sqrt-unprod0.0%
add-sqr-sqrt60.5%
Applied egg-rr60.5%
+-lft-identity60.5%
Simplified60.5%
if -4.8e-71 < y < 3.4999999999999999e-199Initial 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-sqrt49.7%
fabs-sqr49.7%
rem-square-sqrt50.4%
div-sub50.4%
sub-neg50.4%
*-inverses50.4%
metadata-eval50.4%
+-commutative50.4%
Simplified50.4%
if 3.4999999999999999e-199 < y Initial program 100.0%
div-inv99.6%
add-sqr-sqrt14.0%
fabs-sqr14.0%
add-sqr-sqrt15.2%
*-commutative15.2%
add-sqr-sqrt15.1%
fabs-sqr15.1%
add-sqr-sqrt15.2%
Applied egg-rr15.2%
flip--7.8%
associate-*r/7.8%
+-commutative7.8%
Applied egg-rr7.8%
Taylor expanded in y around inf 2.3%
neg-mul-12.3%
Simplified2.3%
frac-2neg2.3%
div-inv2.3%
remove-double-neg2.3%
distribute-neg-in2.3%
add-sqr-sqrt0.0%
sqrt-unprod33.4%
sqr-neg33.4%
sqrt-unprod61.1%
add-sqr-sqrt61.4%
sub-neg61.4%
Applied egg-rr61.4%
Final simplification58.0%
(FPCore (x y) :precision binary64 (if (or (<= y -3.8e-71) (not (<= y 3.5e-199))) (/ y (+ x y)) (+ (/ x y) -1.0)))
double code(double x, double y) {
double tmp;
if ((y <= -3.8e-71) || !(y <= 3.5e-199)) {
tmp = y / (x + y);
} else {
tmp = (x / 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 <= (-3.8d-71)) .or. (.not. (y <= 3.5d-199))) then
tmp = y / (x + y)
else
tmp = (x / y) + (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -3.8e-71) || !(y <= 3.5e-199)) {
tmp = y / (x + y);
} else {
tmp = (x / y) + -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -3.8e-71) or not (y <= 3.5e-199): tmp = y / (x + y) else: tmp = (x / y) + -1.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -3.8e-71) || !(y <= 3.5e-199)) tmp = Float64(y / Float64(x + y)); else tmp = Float64(Float64(x / y) + -1.0); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -3.8e-71) || ~((y <= 3.5e-199))) tmp = y / (x + y); else tmp = (x / y) + -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -3.8e-71], N[Not[LessEqual[y, 3.5e-199]], $MachinePrecision]], N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{-71} \lor \neg \left(y \leq 3.5 \cdot 10^{-199}\right):\\
\;\;\;\;\frac{y}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + -1\\
\end{array}
\end{array}
if y < -3.79999999999999992e-71 or 3.4999999999999999e-199 < y Initial program 100.0%
div-inv99.6%
add-sqr-sqrt41.4%
fabs-sqr41.4%
add-sqr-sqrt42.3%
*-commutative42.3%
add-sqr-sqrt8.8%
fabs-sqr8.8%
add-sqr-sqrt17.5%
Applied egg-rr17.5%
flip--6.7%
associate-*r/6.7%
+-commutative6.7%
Applied egg-rr6.7%
Taylor expanded in x around 0 1.8%
unpow21.8%
mul-1-neg1.8%
distribute-rgt-neg-out1.8%
Simplified1.8%
associate-*r*2.3%
lft-mult-inverse2.3%
*-un-lft-identity2.3%
neg-sub02.3%
metadata-eval2.3%
sub-neg2.3%
metadata-eval2.3%
add-sqr-sqrt0.9%
sqrt-unprod20.1%
sqr-neg20.1%
sqrt-unprod35.4%
add-sqr-sqrt61.0%
Applied egg-rr61.0%
+-lft-identity61.0%
Simplified61.0%
if -3.79999999999999992e-71 < y < 3.4999999999999999e-199Initial 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-sqrt49.7%
fabs-sqr49.7%
rem-square-sqrt50.4%
div-sub50.4%
sub-neg50.4%
*-inverses50.4%
metadata-eval50.4%
+-commutative50.4%
Simplified50.4%
Final simplification57.9%
(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%
div-inv99.6%
add-sqr-sqrt45.4%
fabs-sqr45.4%
add-sqr-sqrt46.1%
*-commutative46.1%
add-sqr-sqrt11.7%
fabs-sqr11.7%
add-sqr-sqrt27.0%
Applied egg-rr27.0%
Taylor expanded in y around 0 27.3%
Final simplification27.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%
div-inv99.6%
add-sqr-sqrt45.4%
fabs-sqr45.4%
add-sqr-sqrt46.1%
*-commutative46.1%
add-sqr-sqrt11.7%
fabs-sqr11.7%
add-sqr-sqrt27.0%
Applied egg-rr27.0%
Taylor expanded in y around inf 1.3%
Final simplification1.3%
herbie shell --seed 2023268
(FPCore (x y)
:name "Numeric.LinearAlgebra.Util:formatSparse from hmatrix-0.16.1.5"
:precision binary64
(/ (fabs (- x y)) (fabs y)))