
(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 8 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%
div-fabs100.0%
div-sub100.0%
pow1100.0%
pow1100.0%
pow-div100.0%
metadata-eval100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (- x) y)))
(if (<= x -2.65e+144)
(/ x y)
(if (<= x -9.5e+46)
t_0
(if (<= x 4.3e+36)
1.0
(if (<= x 1.62e+59) t_0 (if (<= x 1.2e+136) 1.0 (/ x y))))))))
double code(double x, double y) {
double t_0 = -x / y;
double tmp;
if (x <= -2.65e+144) {
tmp = x / y;
} else if (x <= -9.5e+46) {
tmp = t_0;
} else if (x <= 4.3e+36) {
tmp = 1.0;
} else if (x <= 1.62e+59) {
tmp = t_0;
} else if (x <= 1.2e+136) {
tmp = 1.0;
} else {
tmp = 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
if (x <= (-2.65d+144)) then
tmp = x / y
else if (x <= (-9.5d+46)) then
tmp = t_0
else if (x <= 4.3d+36) then
tmp = 1.0d0
else if (x <= 1.62d+59) then
tmp = t_0
else if (x <= 1.2d+136) then
tmp = 1.0d0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = -x / y;
double tmp;
if (x <= -2.65e+144) {
tmp = x / y;
} else if (x <= -9.5e+46) {
tmp = t_0;
} else if (x <= 4.3e+36) {
tmp = 1.0;
} else if (x <= 1.62e+59) {
tmp = t_0;
} else if (x <= 1.2e+136) {
tmp = 1.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = -x / y tmp = 0 if x <= -2.65e+144: tmp = x / y elif x <= -9.5e+46: tmp = t_0 elif x <= 4.3e+36: tmp = 1.0 elif x <= 1.62e+59: tmp = t_0 elif x <= 1.2e+136: tmp = 1.0 else: tmp = x / y return tmp
function code(x, y) t_0 = Float64(Float64(-x) / y) tmp = 0.0 if (x <= -2.65e+144) tmp = Float64(x / y); elseif (x <= -9.5e+46) tmp = t_0; elseif (x <= 4.3e+36) tmp = 1.0; elseif (x <= 1.62e+59) tmp = t_0; elseif (x <= 1.2e+136) tmp = 1.0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) t_0 = -x / y; tmp = 0.0; if (x <= -2.65e+144) tmp = x / y; elseif (x <= -9.5e+46) tmp = t_0; elseif (x <= 4.3e+36) tmp = 1.0; elseif (x <= 1.62e+59) tmp = t_0; elseif (x <= 1.2e+136) tmp = 1.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[((-x) / y), $MachinePrecision]}, If[LessEqual[x, -2.65e+144], N[(x / y), $MachinePrecision], If[LessEqual[x, -9.5e+46], t$95$0, If[LessEqual[x, 4.3e+36], 1.0, If[LessEqual[x, 1.62e+59], t$95$0, If[LessEqual[x, 1.2e+136], 1.0, N[(x / y), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{y}\\
\mathbf{if}\;x \leq -2.65 \cdot 10^{+144}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -9.5 \cdot 10^{+46}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{+36}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.62 \cdot 10^{+59}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+136}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -2.6499999999999998e144 or 1.2e136 < x Initial program 100.0%
clear-num99.7%
add-sqr-sqrt45.3%
fabs-sqr45.3%
add-sqr-sqrt45.7%
add-sqr-sqrt26.5%
fabs-sqr26.5%
add-sqr-sqrt61.9%
associate-/r/62.0%
Applied egg-rr62.0%
Taylor expanded in y around 0 62.0%
if -2.6499999999999998e144 < x < -9.5000000000000008e46 or 4.30000000000000005e36 < x < 1.6200000000000001e59Initial program 100.0%
clear-num99.8%
add-sqr-sqrt55.1%
fabs-sqr55.1%
add-sqr-sqrt55.7%
add-sqr-sqrt3.9%
fabs-sqr3.9%
add-sqr-sqrt23.0%
associate-/r/22.8%
Applied egg-rr22.8%
associate-*l/23.0%
*-un-lft-identity23.0%
frac-2neg23.0%
sub-neg23.0%
distribute-neg-in23.0%
remove-double-neg23.0%
add-sqr-sqrt18.7%
sqrt-unprod56.9%
sqr-neg56.9%
sqrt-unprod51.4%
add-sqr-sqrt77.9%
Applied egg-rr77.9%
Taylor expanded in x around inf 60.4%
associate-*r/60.4%
mul-1-neg60.4%
Simplified60.4%
if -9.5000000000000008e46 < x < 4.30000000000000005e36 or 1.6200000000000001e59 < x < 1.2e136Initial program 100.0%
clear-num99.9%
add-sqr-sqrt46.1%
fabs-sqr46.1%
add-sqr-sqrt47.2%
add-sqr-sqrt9.3%
fabs-sqr9.3%
add-sqr-sqrt14.8%
associate-/r/14.9%
Applied egg-rr14.9%
associate-*l/14.9%
*-un-lft-identity14.9%
sub-neg14.9%
add-sqr-sqrt5.6%
sqrt-unprod28.7%
sqr-neg28.7%
sqrt-unprod37.9%
add-sqr-sqrt81.5%
Applied egg-rr81.5%
Taylor expanded in x around 0 69.6%
Final simplification66.6%
(FPCore (x y)
:precision binary64
(if (or (<= x -1.5e+104)
(not (or (<= x -4.5e+49) (and (not (<= x -3e-56)) (<= x 2.2e+49)))))
(/ (+ x y) y)
(- 1.0 (/ x y))))
double code(double x, double y) {
double tmp;
if ((x <= -1.5e+104) || !((x <= -4.5e+49) || (!(x <= -3e-56) && (x <= 2.2e+49)))) {
tmp = (x + y) / y;
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-1.5d+104)) .or. (.not. (x <= (-4.5d+49)) .or. (.not. (x <= (-3d-56))) .and. (x <= 2.2d+49))) then
tmp = (x + y) / y
else
tmp = 1.0d0 - (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -1.5e+104) || !((x <= -4.5e+49) || (!(x <= -3e-56) && (x <= 2.2e+49)))) {
tmp = (x + y) / y;
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.5e+104) or not ((x <= -4.5e+49) or (not (x <= -3e-56) and (x <= 2.2e+49))): tmp = (x + y) / y else: tmp = 1.0 - (x / y) return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.5e+104) || !((x <= -4.5e+49) || (!(x <= -3e-56) && (x <= 2.2e+49)))) tmp = Float64(Float64(x + y) / y); else tmp = Float64(1.0 - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.5e+104) || ~(((x <= -4.5e+49) || (~((x <= -3e-56)) && (x <= 2.2e+49))))) tmp = (x + y) / y; else tmp = 1.0 - (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.5e+104], N[Not[Or[LessEqual[x, -4.5e+49], And[N[Not[LessEqual[x, -3e-56]], $MachinePrecision], LessEqual[x, 2.2e+49]]]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{+104} \lor \neg \left(x \leq -4.5 \cdot 10^{+49} \lor \neg \left(x \leq -3 \cdot 10^{-56}\right) \land x \leq 2.2 \cdot 10^{+49}\right):\\
\;\;\;\;\frac{x + y}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y}\\
\end{array}
\end{array}
if x < -1.49999999999999984e104 or -4.49999999999999982e49 < x < -2.99999999999999989e-56 or 2.2000000000000001e49 < x Initial program 100.0%
clear-num99.8%
add-sqr-sqrt42.4%
fabs-sqr42.4%
add-sqr-sqrt43.0%
add-sqr-sqrt20.7%
fabs-sqr20.7%
add-sqr-sqrt49.2%
associate-/r/49.2%
Applied egg-rr49.2%
associate-*l/49.3%
*-un-lft-identity49.3%
sub-neg49.3%
add-sqr-sqrt28.6%
sqrt-unprod48.3%
sqr-neg48.3%
sqrt-unprod31.3%
add-sqr-sqrt79.2%
Applied egg-rr79.2%
if -1.49999999999999984e104 < x < -4.49999999999999982e49 or -2.99999999999999989e-56 < x < 2.2000000000000001e49Initial program 100.0%
clear-num99.9%
add-sqr-sqrt50.6%
fabs-sqr50.6%
add-sqr-sqrt51.7%
add-sqr-sqrt7.0%
fabs-sqr7.0%
add-sqr-sqrt10.6%
associate-/r/10.6%
Applied egg-rr10.6%
associate-*l/10.6%
*-un-lft-identity10.6%
frac-2neg10.6%
sub-neg10.6%
distribute-neg-in10.6%
remove-double-neg10.6%
add-sqr-sqrt3.5%
sqrt-unprod24.7%
sqr-neg24.7%
sqrt-unprod44.2%
add-sqr-sqrt90.7%
Applied egg-rr90.7%
Taylor expanded in x around 0 90.7%
mul-1-neg90.7%
unsub-neg90.7%
Simplified90.7%
Final simplification85.5%
(FPCore (x y) :precision binary64 (if (or (<= x -1.1e+144) (not (<= x 1.15e+137))) (/ x y) (- 1.0 (/ x y))))
double code(double x, double y) {
double tmp;
if ((x <= -1.1e+144) || !(x <= 1.15e+137)) {
tmp = x / y;
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-1.1d+144)) .or. (.not. (x <= 1.15d+137))) then
tmp = x / y
else
tmp = 1.0d0 - (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -1.1e+144) || !(x <= 1.15e+137)) {
tmp = x / y;
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.1e+144) or not (x <= 1.15e+137): tmp = x / y else: tmp = 1.0 - (x / y) return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.1e+144) || !(x <= 1.15e+137)) tmp = Float64(x / y); else tmp = Float64(1.0 - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.1e+144) || ~((x <= 1.15e+137))) tmp = x / y; else tmp = 1.0 - (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.1e+144], N[Not[LessEqual[x, 1.15e+137]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+144} \lor \neg \left(x \leq 1.15 \cdot 10^{+137}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y}\\
\end{array}
\end{array}
if x < -1.09999999999999994e144 or 1.15e137 < x Initial program 100.0%
clear-num99.7%
add-sqr-sqrt45.3%
fabs-sqr45.3%
add-sqr-sqrt45.7%
add-sqr-sqrt26.5%
fabs-sqr26.5%
add-sqr-sqrt61.9%
associate-/r/62.0%
Applied egg-rr62.0%
Taylor expanded in y around 0 62.0%
if -1.09999999999999994e144 < x < 1.15e137Initial program 100.0%
clear-num99.9%
add-sqr-sqrt47.4%
fabs-sqr47.4%
add-sqr-sqrt48.4%
add-sqr-sqrt8.5%
fabs-sqr8.5%
add-sqr-sqrt16.0%
associate-/r/16.0%
Applied egg-rr16.0%
associate-*l/16.1%
*-un-lft-identity16.1%
frac-2neg16.1%
sub-neg16.1%
distribute-neg-in16.1%
remove-double-neg16.1%
add-sqr-sqrt7.5%
sqrt-unprod23.7%
sqr-neg23.7%
sqrt-unprod39.6%
add-sqr-sqrt85.2%
Applied egg-rr85.2%
Taylor expanded in x around 0 85.2%
mul-1-neg85.2%
unsub-neg85.2%
Simplified85.2%
Final simplification79.0%
(FPCore (x y) :precision binary64 (if (<= x -2.3e+144) (/ x y) (if (<= x 3.3e+136) (- 1.0 (/ x y)) (+ (/ x y) -1.0))))
double code(double x, double y) {
double tmp;
if (x <= -2.3e+144) {
tmp = x / y;
} else if (x <= 3.3e+136) {
tmp = 1.0 - (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 (x <= (-2.3d+144)) then
tmp = x / y
else if (x <= 3.3d+136) then
tmp = 1.0d0 - (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 (x <= -2.3e+144) {
tmp = x / y;
} else if (x <= 3.3e+136) {
tmp = 1.0 - (x / y);
} else {
tmp = (x / y) + -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -2.3e+144: tmp = x / y elif x <= 3.3e+136: tmp = 1.0 - (x / y) else: tmp = (x / y) + -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -2.3e+144) tmp = Float64(x / y); elseif (x <= 3.3e+136) tmp = Float64(1.0 - 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 (x <= -2.3e+144) tmp = x / y; elseif (x <= 3.3e+136) tmp = 1.0 - (x / y); else tmp = (x / y) + -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -2.3e+144], N[(x / y), $MachinePrecision], If[LessEqual[x, 3.3e+136], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+144}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{+136}:\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + -1\\
\end{array}
\end{array}
if x < -2.3000000000000001e144Initial program 100.0%
clear-num99.8%
add-sqr-sqrt27.4%
fabs-sqr27.4%
add-sqr-sqrt27.9%
add-sqr-sqrt0.2%
fabs-sqr0.2%
add-sqr-sqrt60.3%
associate-/r/60.4%
Applied egg-rr60.4%
Taylor expanded in y around 0 61.2%
if -2.3000000000000001e144 < x < 3.29999999999999992e136Initial program 100.0%
clear-num99.9%
add-sqr-sqrt47.4%
fabs-sqr47.4%
add-sqr-sqrt48.4%
add-sqr-sqrt8.5%
fabs-sqr8.5%
add-sqr-sqrt16.0%
associate-/r/16.0%
Applied egg-rr16.0%
associate-*l/16.1%
*-un-lft-identity16.1%
frac-2neg16.1%
sub-neg16.1%
distribute-neg-in16.1%
remove-double-neg16.1%
add-sqr-sqrt7.5%
sqrt-unprod23.7%
sqr-neg23.7%
sqrt-unprod39.6%
add-sqr-sqrt85.2%
Applied egg-rr85.2%
Taylor expanded in x around 0 85.2%
mul-1-neg85.2%
unsub-neg85.2%
Simplified85.2%
if 3.29999999999999992e136 < x Initial program 100.0%
add-sqr-sqrt92.3%
fabs-sqr92.3%
add-sqr-sqrt63.9%
fabs-sqr63.9%
add-sqr-sqrt64.2%
add-sqr-sqrt64.6%
div-sub64.6%
pow164.6%
pow164.6%
pow-div64.6%
metadata-eval64.6%
metadata-eval64.6%
Applied egg-rr64.6%
Final simplification79.2%
(FPCore (x y) :precision binary64 (if (or (<= x -1.8e+69) (not (<= x 9.6e+135))) (/ x y) 1.0))
double code(double x, double y) {
double tmp;
if ((x <= -1.8e+69) || !(x <= 9.6e+135)) {
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 ((x <= (-1.8d+69)) .or. (.not. (x <= 9.6d+135))) 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 ((x <= -1.8e+69) || !(x <= 9.6e+135)) {
tmp = x / y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.8e+69) or not (x <= 9.6e+135): tmp = x / y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.8e+69) || !(x <= 9.6e+135)) tmp = Float64(x / y); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.8e+69) || ~((x <= 9.6e+135))) tmp = x / y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.8e+69], N[Not[LessEqual[x, 9.6e+135]], $MachinePrecision]], N[(x / y), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+69} \lor \neg \left(x \leq 9.6 \cdot 10^{+135}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.8000000000000001e69 or 9.59999999999999989e135 < x Initial program 100.0%
clear-num99.7%
add-sqr-sqrt48.4%
fabs-sqr48.4%
add-sqr-sqrt48.9%
add-sqr-sqrt22.5%
fabs-sqr22.5%
add-sqr-sqrt57.7%
associate-/r/57.7%
Applied egg-rr57.7%
Taylor expanded in y around 0 57.3%
if -1.8000000000000001e69 < x < 9.59999999999999989e135Initial program 100.0%
clear-num99.9%
add-sqr-sqrt46.1%
fabs-sqr46.1%
add-sqr-sqrt47.2%
add-sqr-sqrt9.1%
fabs-sqr9.1%
add-sqr-sqrt14.8%
associate-/r/14.8%
Applied egg-rr14.8%
associate-*l/14.9%
*-un-lft-identity14.9%
sub-neg14.9%
add-sqr-sqrt5.8%
sqrt-unprod28.6%
sqr-neg28.6%
sqrt-unprod36.9%
add-sqr-sqrt77.7%
Applied egg-rr77.7%
Taylor expanded in x around 0 66.0%
Final simplification63.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%
clear-num99.8%
add-sqr-sqrt46.8%
fabs-sqr46.8%
add-sqr-sqrt47.7%
add-sqr-sqrt13.3%
fabs-sqr13.3%
add-sqr-sqrt28.2%
associate-/r/28.2%
Applied egg-rr28.2%
Taylor expanded in y around inf 1.3%
Final simplification1.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%
clear-num99.8%
add-sqr-sqrt46.8%
fabs-sqr46.8%
add-sqr-sqrt47.7%
add-sqr-sqrt13.3%
fabs-sqr13.3%
add-sqr-sqrt28.2%
associate-/r/28.2%
Applied egg-rr28.2%
associate-*l/28.3%
*-un-lft-identity28.3%
sub-neg28.3%
add-sqr-sqrt15.0%
sqrt-unprod36.6%
sqr-neg36.6%
sqrt-unprod34.3%
add-sqr-sqrt75.9%
Applied egg-rr75.9%
Taylor expanded in x around 0 51.4%
Final simplification51.4%
herbie shell --seed 2024019
(FPCore (x y)
:name "Numeric.LinearAlgebra.Util:formatSparse from hmatrix-0.16.1.5"
:precision binary64
(/ (fabs (- x y)) (fabs y)))