
(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 (/ y (+ x y))))
(if (<= y -3.6e-35)
t_0
(if (<= y -7.2e-265)
(/ x y)
(if (<= y 1.15e-136) (/ (/ x y) (/ (- y x) x)) t_0)))))
double code(double x, double y) {
double t_0 = y / (x + y);
double tmp;
if (y <= -3.6e-35) {
tmp = t_0;
} else if (y <= -7.2e-265) {
tmp = x / y;
} else if (y <= 1.15e-136) {
tmp = (x / y) / ((y - x) / x);
} 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 <= (-3.6d-35)) then
tmp = t_0
else if (y <= (-7.2d-265)) then
tmp = x / y
else if (y <= 1.15d-136) then
tmp = (x / y) / ((y - x) / x)
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 <= -3.6e-35) {
tmp = t_0;
} else if (y <= -7.2e-265) {
tmp = x / y;
} else if (y <= 1.15e-136) {
tmp = (x / y) / ((y - x) / x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = y / (x + y) tmp = 0 if y <= -3.6e-35: tmp = t_0 elif y <= -7.2e-265: tmp = x / y elif y <= 1.15e-136: tmp = (x / y) / ((y - x) / x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(y / Float64(x + y)) tmp = 0.0 if (y <= -3.6e-35) tmp = t_0; elseif (y <= -7.2e-265) tmp = Float64(x / y); elseif (y <= 1.15e-136) tmp = Float64(Float64(x / y) / Float64(Float64(y - x) / x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = y / (x + y); tmp = 0.0; if (y <= -3.6e-35) tmp = t_0; elseif (y <= -7.2e-265) tmp = x / y; elseif (y <= 1.15e-136) tmp = (x / y) / ((y - x) / x); 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, -3.6e-35], t$95$0, If[LessEqual[y, -7.2e-265], N[(x / y), $MachinePrecision], If[LessEqual[y, 1.15e-136], N[(N[(x / y), $MachinePrecision] / N[(N[(y - x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{x + y}\\
\mathbf{if}\;y \leq -3.6 \cdot 10^{-35}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -7.2 \cdot 10^{-265}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-136}:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{y - x}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -3.60000000000000019e-35 or 1.14999999999999999e-136 < y Initial program 100.0%
div-inv99.7%
add-sqr-sqrt41.8%
fabs-sqr41.8%
add-sqr-sqrt42.8%
*-commutative42.8%
add-sqr-sqrt8.1%
fabs-sqr8.1%
add-sqr-sqrt13.7%
Applied egg-rr13.7%
flip--5.5%
associate-*r/4.9%
+-commutative4.9%
Applied egg-rr4.9%
Taylor expanded in y around inf 2.0%
neg-mul-12.0%
Simplified2.0%
*-un-lft-identity2.0%
lft-mult-inverse2.0%
associate-*r*1.5%
*-commutative1.5%
*-commutative1.5%
*-un-lft-identity1.5%
times-frac1.5%
*-un-lft-identity1.5%
*-un-lft-identity1.5%
add-sqr-sqrt0.5%
sqrt-unprod24.5%
sqr-neg24.5%
sqrt-unprod23.8%
add-sqr-sqrt37.4%
Applied egg-rr37.4%
/-rgt-identity37.4%
*-commutative37.4%
associate-*l/37.4%
/-rgt-identity37.4%
associate-/r/37.4%
remove-double-div37.5%
associate-/l*73.8%
*-inverses73.8%
/-rgt-identity73.8%
Simplified73.8%
if -3.60000000000000019e-35 < y < -7.2000000000000004e-265Initial program 100.0%
div-inv99.7%
add-sqr-sqrt48.7%
fabs-sqr48.7%
add-sqr-sqrt49.1%
*-commutative49.1%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt51.2%
Applied egg-rr51.2%
Taylor expanded in y around 0 51.6%
if -7.2000000000000004e-265 < y < 1.14999999999999999e-136Initial program 100.0%
div-inv99.8%
add-sqr-sqrt45.0%
fabs-sqr45.0%
add-sqr-sqrt45.5%
*-commutative45.5%
add-sqr-sqrt28.7%
fabs-sqr28.7%
add-sqr-sqrt31.2%
Applied egg-rr31.2%
flip--24.5%
associate-*r/22.3%
+-commutative22.3%
Applied egg-rr22.3%
Taylor expanded in x around inf 22.4%
unpow222.4%
Simplified22.4%
expm1-log1p-u21.6%
expm1-udef21.6%
Applied egg-rr56.9%
expm1-def57.1%
expm1-log1p60.3%
associate-/r/60.4%
associate-/l*62.5%
Simplified62.5%
Final simplification67.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ x y))))
(if (<= y -4.5e-35)
t_0
(if (<= y -7.2e-235)
(/ x y)
(if (<= y 4.4e-187) (/ (* x x) (* y y)) t_0)))))
double code(double x, double y) {
double t_0 = y / (x + y);
double tmp;
if (y <= -4.5e-35) {
tmp = t_0;
} else if (y <= -7.2e-235) {
tmp = x / y;
} else if (y <= 4.4e-187) {
tmp = (x * x) / (y * 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 <= (-4.5d-35)) then
tmp = t_0
else if (y <= (-7.2d-235)) then
tmp = x / y
else if (y <= 4.4d-187) then
tmp = (x * x) / (y * 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 <= -4.5e-35) {
tmp = t_0;
} else if (y <= -7.2e-235) {
tmp = x / y;
} else if (y <= 4.4e-187) {
tmp = (x * x) / (y * y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = y / (x + y) tmp = 0 if y <= -4.5e-35: tmp = t_0 elif y <= -7.2e-235: tmp = x / y elif y <= 4.4e-187: tmp = (x * x) / (y * y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(y / Float64(x + y)) tmp = 0.0 if (y <= -4.5e-35) tmp = t_0; elseif (y <= -7.2e-235) tmp = Float64(x / y); elseif (y <= 4.4e-187) tmp = Float64(Float64(x * x) / Float64(y * 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 <= -4.5e-35) tmp = t_0; elseif (y <= -7.2e-235) tmp = x / y; elseif (y <= 4.4e-187) tmp = (x * x) / (y * 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, -4.5e-35], t$95$0, If[LessEqual[y, -7.2e-235], N[(x / y), $MachinePrecision], If[LessEqual[y, 4.4e-187], N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{x + y}\\
\mathbf{if}\;y \leq -4.5 \cdot 10^{-35}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -7.2 \cdot 10^{-235}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{-187}:\\
\;\;\;\;\frac{x \cdot x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -4.5000000000000001e-35 or 4.40000000000000016e-187 < y Initial program 100.0%
div-inv99.7%
add-sqr-sqrt40.5%
fabs-sqr40.5%
add-sqr-sqrt41.5%
*-commutative41.5%
add-sqr-sqrt8.4%
fabs-sqr8.4%
add-sqr-sqrt13.6%
Applied egg-rr13.6%
flip--5.9%
associate-*r/5.3%
+-commutative5.3%
Applied egg-rr5.3%
Taylor expanded in y around inf 2.0%
neg-mul-12.0%
Simplified2.0%
*-un-lft-identity2.0%
lft-mult-inverse2.0%
associate-*r*1.5%
*-commutative1.5%
*-commutative1.5%
*-un-lft-identity1.5%
times-frac1.5%
*-un-lft-identity1.5%
*-un-lft-identity1.5%
add-sqr-sqrt0.5%
sqrt-unprod23.7%
sqr-neg23.7%
sqrt-unprod23.0%
add-sqr-sqrt36.0%
Applied egg-rr36.0%
/-rgt-identity36.0%
*-commutative36.0%
associate-*l/35.9%
/-rgt-identity35.9%
associate-/r/36.0%
remove-double-div36.1%
associate-/l*72.1%
*-inverses72.1%
/-rgt-identity72.1%
Simplified72.1%
if -4.5000000000000001e-35 < y < -7.19999999999999998e-235Initial program 100.0%
div-inv99.6%
add-sqr-sqrt51.8%
fabs-sqr51.8%
add-sqr-sqrt52.3%
*-commutative52.3%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt48.0%
Applied egg-rr48.0%
Taylor expanded in y around 0 48.3%
if -7.19999999999999998e-235 < y < 4.40000000000000016e-187Initial program 100.0%
div-inv99.8%
add-sqr-sqrt48.6%
fabs-sqr48.6%
add-sqr-sqrt48.9%
*-commutative48.9%
add-sqr-sqrt25.6%
fabs-sqr25.6%
add-sqr-sqrt42.0%
Applied egg-rr42.0%
flip--35.4%
associate-*r/33.3%
+-commutative33.3%
Applied egg-rr33.3%
Taylor expanded in x around inf 33.3%
unpow233.3%
Simplified33.3%
Taylor expanded in y around inf 55.3%
unpow255.3%
unpow255.3%
Simplified55.3%
Final simplification65.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ x y))))
(if (<= y -6e-35)
t_0
(if (<= y -8.8e-235)
(/ x y)
(if (<= y 8.2e-187) (/ (/ x (/ y x)) y) t_0)))))
double code(double x, double y) {
double t_0 = y / (x + y);
double tmp;
if (y <= -6e-35) {
tmp = t_0;
} else if (y <= -8.8e-235) {
tmp = x / y;
} else if (y <= 8.2e-187) {
tmp = (x / (y / 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 <= (-6d-35)) then
tmp = t_0
else if (y <= (-8.8d-235)) then
tmp = x / y
else if (y <= 8.2d-187) then
tmp = (x / (y / 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 <= -6e-35) {
tmp = t_0;
} else if (y <= -8.8e-235) {
tmp = x / y;
} else if (y <= 8.2e-187) {
tmp = (x / (y / x)) / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = y / (x + y) tmp = 0 if y <= -6e-35: tmp = t_0 elif y <= -8.8e-235: tmp = x / y elif y <= 8.2e-187: tmp = (x / (y / x)) / y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(y / Float64(x + y)) tmp = 0.0 if (y <= -6e-35) tmp = t_0; elseif (y <= -8.8e-235) tmp = Float64(x / y); elseif (y <= 8.2e-187) tmp = Float64(Float64(x / Float64(y / 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 <= -6e-35) tmp = t_0; elseif (y <= -8.8e-235) tmp = x / y; elseif (y <= 8.2e-187) tmp = (x / (y / 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, -6e-35], t$95$0, If[LessEqual[y, -8.8e-235], N[(x / y), $MachinePrecision], If[LessEqual[y, 8.2e-187], N[(N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{x + y}\\
\mathbf{if}\;y \leq -6 \cdot 10^{-35}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -8.8 \cdot 10^{-235}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-187}:\\
\;\;\;\;\frac{\frac{x}{\frac{y}{x}}}{y}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -5.99999999999999978e-35 or 8.2000000000000004e-187 < y Initial program 100.0%
div-inv99.7%
add-sqr-sqrt40.5%
fabs-sqr40.5%
add-sqr-sqrt41.5%
*-commutative41.5%
add-sqr-sqrt8.4%
fabs-sqr8.4%
add-sqr-sqrt13.6%
Applied egg-rr13.6%
flip--5.9%
associate-*r/5.3%
+-commutative5.3%
Applied egg-rr5.3%
Taylor expanded in y around inf 2.0%
neg-mul-12.0%
Simplified2.0%
*-un-lft-identity2.0%
lft-mult-inverse2.0%
associate-*r*1.5%
*-commutative1.5%
*-commutative1.5%
*-un-lft-identity1.5%
times-frac1.5%
*-un-lft-identity1.5%
*-un-lft-identity1.5%
add-sqr-sqrt0.5%
sqrt-unprod23.7%
sqr-neg23.7%
sqrt-unprod23.0%
add-sqr-sqrt36.0%
Applied egg-rr36.0%
/-rgt-identity36.0%
*-commutative36.0%
associate-*l/35.9%
/-rgt-identity35.9%
associate-/r/36.0%
remove-double-div36.1%
associate-/l*72.1%
*-inverses72.1%
/-rgt-identity72.1%
Simplified72.1%
if -5.99999999999999978e-35 < y < -8.79999999999999935e-235Initial program 100.0%
div-inv99.6%
add-sqr-sqrt51.8%
fabs-sqr51.8%
add-sqr-sqrt52.3%
*-commutative52.3%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt48.0%
Applied egg-rr48.0%
Taylor expanded in y around 0 48.3%
if -8.79999999999999935e-235 < y < 8.2000000000000004e-187Initial program 100.0%
div-inv99.8%
add-sqr-sqrt48.6%
fabs-sqr48.6%
add-sqr-sqrt48.9%
*-commutative48.9%
add-sqr-sqrt25.6%
fabs-sqr25.6%
add-sqr-sqrt42.0%
Applied egg-rr42.0%
flip--35.4%
associate-*r/33.3%
+-commutative33.3%
Applied egg-rr33.3%
Taylor expanded in x around inf 33.3%
unpow233.3%
Simplified33.3%
Taylor expanded in y around inf 55.3%
unpow255.3%
unpow255.3%
associate-/r*55.9%
associate-/l*56.8%
Simplified56.8%
Final simplification65.5%
(FPCore (x y) :precision binary64 (if (or (<= y -6.2e-35) (not (<= y 5.8e-216))) (/ y (+ x y)) (/ x y)))
double code(double x, double y) {
double tmp;
if ((y <= -6.2e-35) || !(y <= 5.8e-216)) {
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 <= (-6.2d-35)) .or. (.not. (y <= 5.8d-216))) 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 <= -6.2e-35) || !(y <= 5.8e-216)) {
tmp = y / (x + y);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -6.2e-35) or not (y <= 5.8e-216): tmp = y / (x + y) else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if ((y <= -6.2e-35) || !(y <= 5.8e-216)) 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 <= -6.2e-35) || ~((y <= 5.8e-216))) tmp = y / (x + y); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -6.2e-35], N[Not[LessEqual[y, 5.8e-216]], $MachinePrecision]], N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{-35} \lor \neg \left(y \leq 5.8 \cdot 10^{-216}\right):\\
\;\;\;\;\frac{y}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if y < -6.20000000000000024e-35 or 5.8000000000000001e-216 < y Initial program 100.0%
div-inv99.7%
add-sqr-sqrt39.1%
fabs-sqr39.1%
add-sqr-sqrt40.0%
*-commutative40.0%
add-sqr-sqrt8.1%
fabs-sqr8.1%
add-sqr-sqrt13.2%
Applied egg-rr13.2%
flip--5.7%
associate-*r/5.1%
+-commutative5.1%
Applied egg-rr5.1%
Taylor expanded in y around inf 2.0%
neg-mul-12.0%
Simplified2.0%
*-un-lft-identity2.0%
lft-mult-inverse2.0%
associate-*r*1.5%
*-commutative1.5%
*-commutative1.5%
*-un-lft-identity1.5%
times-frac1.5%
*-un-lft-identity1.5%
*-un-lft-identity1.5%
add-sqr-sqrt0.5%
sqrt-unprod22.9%
sqr-neg22.9%
sqrt-unprod22.3%
add-sqr-sqrt34.8%
Applied egg-rr34.8%
/-rgt-identity34.8%
*-commutative34.8%
associate-*l/34.8%
/-rgt-identity34.8%
associate-/r/34.8%
remove-double-div34.9%
associate-/l*69.7%
*-inverses69.7%
/-rgt-identity69.7%
Simplified69.7%
if -6.20000000000000024e-35 < y < 5.8000000000000001e-216Initial program 100.0%
div-inv99.7%
add-sqr-sqrt54.0%
fabs-sqr54.0%
add-sqr-sqrt54.4%
*-commutative54.4%
add-sqr-sqrt13.6%
fabs-sqr13.6%
add-sqr-sqrt48.4%
Applied egg-rr48.4%
Taylor expanded in y around 0 48.6%
Final simplification63.0%
(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.7%
add-sqr-sqrt43.8%
fabs-sqr43.8%
add-sqr-sqrt44.6%
*-commutative44.6%
add-sqr-sqrt9.8%
fabs-sqr9.8%
add-sqr-sqrt24.3%
Applied egg-rr24.3%
Taylor expanded in y around 0 25.1%
Final simplification25.1%
(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.7%
add-sqr-sqrt43.8%
fabs-sqr43.8%
add-sqr-sqrt44.6%
*-commutative44.6%
add-sqr-sqrt9.8%
fabs-sqr9.8%
add-sqr-sqrt24.3%
Applied egg-rr24.3%
Taylor expanded in y around inf 1.3%
Final simplification1.3%
herbie shell --seed 2023229
(FPCore (x y)
:name "Numeric.LinearAlgebra.Util:formatSparse from hmatrix-0.16.1.5"
:precision binary64
(/ (fabs (- x y)) (fabs y)))