
(FPCore (x y) :precision binary64 (+ x (/ (fabs (- y x)) 2.0)))
double code(double x, double y) {
return x + (fabs((y - x)) / 2.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x + (abs((y - x)) / 2.0d0)
end function
public static double code(double x, double y) {
return x + (Math.abs((y - x)) / 2.0);
}
def code(x, y): return x + (math.fabs((y - x)) / 2.0)
function code(x, y) return Float64(x + Float64(abs(Float64(y - x)) / 2.0)) end
function tmp = code(x, y) tmp = x + (abs((y - x)) / 2.0); end
code[x_, y_] := N[(x + N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left|y - x\right|}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ x (/ (fabs (- y x)) 2.0)))
double code(double x, double y) {
return x + (fabs((y - x)) / 2.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x + (abs((y - x)) / 2.0d0)
end function
public static double code(double x, double y) {
return x + (Math.abs((y - x)) / 2.0);
}
def code(x, y): return x + (math.fabs((y - x)) / 2.0)
function code(x, y) return Float64(x + Float64(abs(Float64(y - x)) / 2.0)) end
function tmp = code(x, y) tmp = x + (abs((y - x)) / 2.0); end
code[x_, y_] := N[(x + N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left|y - x\right|}{2}
\end{array}
(FPCore (x y) :precision binary64 (+ x (/ (fabs (- y x)) 2.0)))
double code(double x, double y) {
return x + (fabs((y - x)) / 2.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x + (abs((y - x)) / 2.0d0)
end function
public static double code(double x, double y) {
return x + (Math.abs((y - x)) / 2.0);
}
def code(x, y): return x + (math.fabs((y - x)) / 2.0)
function code(x, y) return Float64(x + Float64(abs(Float64(y - x)) / 2.0)) end
function tmp = code(x, y) tmp = x + (abs((y - x)) / 2.0); end
code[x_, y_] := N[(x + N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left|y - x\right|}{2}
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (- y x) 0.5)))
(if (<= x -7e-75)
(* 0.5 (+ x y))
(if (or (<= x 6.3e-52) (not (<= x 2.25e+109)))
(* (fabs (- y x)) 0.5)
(/ (- (* t_0 t_0) (* x x)) (+ (* y -0.5) (* x -0.5)))))))
double code(double x, double y) {
double t_0 = (y - x) * 0.5;
double tmp;
if (x <= -7e-75) {
tmp = 0.5 * (x + y);
} else if ((x <= 6.3e-52) || !(x <= 2.25e+109)) {
tmp = fabs((y - x)) * 0.5;
} else {
tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5));
}
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) * 0.5d0
if (x <= (-7d-75)) then
tmp = 0.5d0 * (x + y)
else if ((x <= 6.3d-52) .or. (.not. (x <= 2.25d+109))) then
tmp = abs((y - x)) * 0.5d0
else
tmp = ((t_0 * t_0) - (x * x)) / ((y * (-0.5d0)) + (x * (-0.5d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y - x) * 0.5;
double tmp;
if (x <= -7e-75) {
tmp = 0.5 * (x + y);
} else if ((x <= 6.3e-52) || !(x <= 2.25e+109)) {
tmp = Math.abs((y - x)) * 0.5;
} else {
tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5));
}
return tmp;
}
def code(x, y): t_0 = (y - x) * 0.5 tmp = 0 if x <= -7e-75: tmp = 0.5 * (x + y) elif (x <= 6.3e-52) or not (x <= 2.25e+109): tmp = math.fabs((y - x)) * 0.5 else: tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5)) return tmp
function code(x, y) t_0 = Float64(Float64(y - x) * 0.5) tmp = 0.0 if (x <= -7e-75) tmp = Float64(0.5 * Float64(x + y)); elseif ((x <= 6.3e-52) || !(x <= 2.25e+109)) tmp = Float64(abs(Float64(y - x)) * 0.5); else tmp = Float64(Float64(Float64(t_0 * t_0) - Float64(x * x)) / Float64(Float64(y * -0.5) + Float64(x * -0.5))); end return tmp end
function tmp_2 = code(x, y) t_0 = (y - x) * 0.5; tmp = 0.0; if (x <= -7e-75) tmp = 0.5 * (x + y); elseif ((x <= 6.3e-52) || ~((x <= 2.25e+109))) tmp = abs((y - x)) * 0.5; else tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y - x), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[x, -7e-75], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 6.3e-52], N[Not[LessEqual[x, 2.25e+109]], $MachinePrecision]], N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(N[(y * -0.5), $MachinePrecision] + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y - x\right) \cdot 0.5\\
\mathbf{if}\;x \leq -7 \cdot 10^{-75}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 6.3 \cdot 10^{-52} \lor \neg \left(x \leq 2.25 \cdot 10^{+109}\right):\\
\;\;\;\;\left|y - x\right| \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 \cdot t_0 - x \cdot x}{y \cdot -0.5 + x \cdot -0.5}\\
\end{array}
\end{array}
if x < -6.9999999999999997e-75Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-def100.0%
add-sqr-sqrt80.2%
fabs-sqr80.2%
add-sqr-sqrt80.9%
metadata-eval80.9%
Applied egg-rr80.9%
Taylor expanded in y around 0 80.9%
+-commutative80.9%
associate-+r+80.9%
distribute-lft1-in80.9%
metadata-eval80.9%
distribute-lft-out80.9%
Simplified80.9%
if -6.9999999999999997e-75 < x < 6.3000000000000003e-52 or 2.2499999999999998e109 < x Initial program 99.9%
Taylor expanded in x around 0 72.0%
if 6.3000000000000003e-52 < x < 2.2499999999999998e109Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt23.6%
fabs-sqr23.6%
add-sqr-sqrt34.5%
metadata-eval34.5%
Applied egg-rr34.5%
fma-udef34.5%
flip-+22.4%
Applied egg-rr22.4%
add-sqr-sqrt11.4%
sqrt-prod81.2%
associate-*r*81.2%
sqrt-prod81.2%
fma-neg81.2%
*-commutative81.2%
associate-*l*81.2%
pow281.2%
Applied egg-rr81.2%
Taylor expanded in y around -inf 70.9%
sub-neg70.9%
+-commutative70.9%
associate-+l+70.9%
*-commutative70.9%
*-commutative70.9%
unpow270.9%
rem-square-sqrt71.1%
associate-*l*71.1%
metadata-eval71.1%
unpow271.1%
rem-square-sqrt71.8%
neg-mul-171.8%
distribute-rgt-out71.8%
metadata-eval71.8%
Simplified71.8%
Final simplification74.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (- y x) 0.5)))
(if (<= y -6.3e+153)
(* (/ y 0.5) -0.25)
(if (<= y -3.5e-246)
(/ (- (* t_0 t_0) (* x x)) (+ (* y -0.5) (* x -0.5)))
(* 0.5 (+ x y))))))
double code(double x, double y) {
double t_0 = (y - x) * 0.5;
double tmp;
if (y <= -6.3e+153) {
tmp = (y / 0.5) * -0.25;
} else if (y <= -3.5e-246) {
tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5));
} else {
tmp = 0.5 * (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 = (y - x) * 0.5d0
if (y <= (-6.3d+153)) then
tmp = (y / 0.5d0) * (-0.25d0)
else if (y <= (-3.5d-246)) then
tmp = ((t_0 * t_0) - (x * x)) / ((y * (-0.5d0)) + (x * (-0.5d0)))
else
tmp = 0.5d0 * (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y - x) * 0.5;
double tmp;
if (y <= -6.3e+153) {
tmp = (y / 0.5) * -0.25;
} else if (y <= -3.5e-246) {
tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5));
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): t_0 = (y - x) * 0.5 tmp = 0 if y <= -6.3e+153: tmp = (y / 0.5) * -0.25 elif y <= -3.5e-246: tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5)) else: tmp = 0.5 * (x + y) return tmp
function code(x, y) t_0 = Float64(Float64(y - x) * 0.5) tmp = 0.0 if (y <= -6.3e+153) tmp = Float64(Float64(y / 0.5) * -0.25); elseif (y <= -3.5e-246) tmp = Float64(Float64(Float64(t_0 * t_0) - Float64(x * x)) / Float64(Float64(y * -0.5) + Float64(x * -0.5))); else tmp = Float64(0.5 * Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) t_0 = (y - x) * 0.5; tmp = 0.0; if (y <= -6.3e+153) tmp = (y / 0.5) * -0.25; elseif (y <= -3.5e-246) tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5)); else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y - x), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[y, -6.3e+153], N[(N[(y / 0.5), $MachinePrecision] * -0.25), $MachinePrecision], If[LessEqual[y, -3.5e-246], N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(N[(y * -0.5), $MachinePrecision] + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y - x\right) \cdot 0.5\\
\mathbf{if}\;y \leq -6.3 \cdot 10^{+153}:\\
\;\;\;\;\frac{y}{0.5} \cdot -0.25\\
\mathbf{elif}\;y \leq -3.5 \cdot 10^{-246}:\\
\;\;\;\;\frac{t_0 \cdot t_0 - x \cdot x}{y \cdot -0.5 + x \cdot -0.5}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -6.3000000000000001e153Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-def100.0%
add-sqr-sqrt15.1%
fabs-sqr15.1%
add-sqr-sqrt17.0%
metadata-eval17.0%
Applied egg-rr17.0%
fma-udef17.0%
flip-+0.1%
Applied egg-rr0.1%
add-sqr-sqrt0.0%
sqrt-prod0.0%
associate-*r*0.0%
sqrt-prod0.0%
fma-neg0.0%
*-commutative0.0%
associate-*l*0.0%
pow20.0%
Applied egg-rr0.0%
Taylor expanded in y around -inf 71.9%
*-commutative71.9%
unpow271.9%
rem-square-sqrt73.3%
Simplified73.3%
if -6.3000000000000001e153 < y < -3.5000000000000002e-246Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt20.1%
fabs-sqr20.1%
add-sqr-sqrt28.1%
metadata-eval28.1%
Applied egg-rr28.1%
fma-udef28.1%
flip-+13.9%
Applied egg-rr13.9%
add-sqr-sqrt8.8%
sqrt-prod66.9%
associate-*r*66.9%
sqrt-prod66.8%
fma-neg66.8%
*-commutative66.8%
associate-*l*66.8%
pow266.8%
Applied egg-rr66.8%
Taylor expanded in y around -inf 58.8%
sub-neg58.8%
+-commutative58.8%
associate-+l+58.8%
*-commutative58.8%
*-commutative58.8%
unpow258.8%
rem-square-sqrt59.4%
associate-*l*59.4%
metadata-eval59.4%
unpow259.4%
rem-square-sqrt59.7%
neg-mul-159.7%
distribute-rgt-out59.7%
metadata-eval59.7%
Simplified59.7%
if -3.5000000000000002e-246 < y Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-def100.0%
add-sqr-sqrt75.8%
fabs-sqr75.8%
add-sqr-sqrt80.4%
metadata-eval80.4%
Applied egg-rr80.4%
Taylor expanded in y around 0 80.4%
+-commutative80.4%
associate-+r+80.4%
distribute-lft1-in80.4%
metadata-eval80.4%
distribute-lft-out80.4%
Simplified80.4%
Final simplification72.8%
(FPCore (x y) :precision binary64 (if (<= x -5e-29) (* x 0.5) (if (<= x 5.2e+160) (* y 0.5) x)))
double code(double x, double y) {
double tmp;
if (x <= -5e-29) {
tmp = x * 0.5;
} else if (x <= 5.2e+160) {
tmp = y * 0.5;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-5d-29)) then
tmp = x * 0.5d0
else if (x <= 5.2d+160) then
tmp = y * 0.5d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -5e-29) {
tmp = x * 0.5;
} else if (x <= 5.2e+160) {
tmp = y * 0.5;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -5e-29: tmp = x * 0.5 elif x <= 5.2e+160: tmp = y * 0.5 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (x <= -5e-29) tmp = Float64(x * 0.5); elseif (x <= 5.2e+160) tmp = Float64(y * 0.5); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -5e-29) tmp = x * 0.5; elseif (x <= 5.2e+160) tmp = y * 0.5; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -5e-29], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 5.2e+160], N[(y * 0.5), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-29}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+160}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.99999999999999986e-29Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-def100.0%
add-sqr-sqrt78.7%
fabs-sqr78.7%
add-sqr-sqrt79.5%
metadata-eval79.5%
Applied egg-rr79.5%
Taylor expanded in y around 0 71.5%
distribute-lft1-in71.5%
metadata-eval71.5%
*-commutative71.5%
Simplified71.5%
if -4.99999999999999986e-29 < x < 5.2000000000000001e160Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-def100.0%
add-sqr-sqrt44.0%
fabs-sqr44.0%
add-sqr-sqrt48.9%
metadata-eval48.9%
Applied egg-rr48.9%
Taylor expanded in y around inf 40.1%
if 5.2000000000000001e160 < x Initial program 99.7%
Taylor expanded in x around inf 19.3%
Final simplification45.6%
(FPCore (x y) :precision binary64 (if (<= y -4.8e-16) (* (/ y 0.5) -0.25) (* 0.5 (+ x y))))
double code(double x, double y) {
double tmp;
if (y <= -4.8e-16) {
tmp = (y / 0.5) * -0.25;
} else {
tmp = 0.5 * (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 <= (-4.8d-16)) then
tmp = (y / 0.5d0) * (-0.25d0)
else
tmp = 0.5d0 * (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4.8e-16) {
tmp = (y / 0.5) * -0.25;
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.8e-16: tmp = (y / 0.5) * -0.25 else: tmp = 0.5 * (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= -4.8e-16) tmp = Float64(Float64(y / 0.5) * -0.25); else tmp = Float64(0.5 * Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.8e-16) tmp = (y / 0.5) * -0.25; else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.8e-16], N[(N[(y / 0.5), $MachinePrecision] * -0.25), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-16}:\\
\;\;\;\;\frac{y}{0.5} \cdot -0.25\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -4.8000000000000001e-16Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-def100.0%
add-sqr-sqrt15.1%
fabs-sqr15.1%
add-sqr-sqrt17.7%
metadata-eval17.7%
Applied egg-rr17.7%
fma-udef17.7%
flip-+3.3%
Applied egg-rr3.3%
add-sqr-sqrt2.5%
sqrt-prod34.1%
associate-*r*34.1%
sqrt-prod34.0%
fma-neg34.0%
*-commutative34.0%
associate-*l*34.0%
pow234.0%
Applied egg-rr34.0%
Taylor expanded in y around -inf 69.7%
*-commutative69.7%
unpow269.7%
rem-square-sqrt71.1%
Simplified71.1%
if -4.8000000000000001e-16 < y Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt62.3%
fabs-sqr62.3%
add-sqr-sqrt68.6%
metadata-eval68.6%
Applied egg-rr68.6%
Taylor expanded in y around 0 68.6%
+-commutative68.6%
associate-+r+68.6%
distribute-lft1-in68.6%
metadata-eval68.6%
distribute-lft-out68.6%
Simplified68.6%
Final simplification69.4%
(FPCore (x y) :precision binary64 (if (<= y 2.9e-240) x (* y 0.5)))
double code(double x, double y) {
double tmp;
if (y <= 2.9e-240) {
tmp = x;
} else {
tmp = y * 0.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.9d-240) then
tmp = x
else
tmp = y * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.9e-240) {
tmp = x;
} else {
tmp = y * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.9e-240: tmp = x else: tmp = y * 0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= 2.9e-240) tmp = x; else tmp = Float64(y * 0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.9e-240) tmp = x; else tmp = y * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.9e-240], x, N[(y * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.9 \cdot 10^{-240}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < 2.9000000000000002e-240Initial program 99.9%
Taylor expanded in x around inf 12.1%
if 2.9000000000000002e-240 < y Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-def100.0%
add-sqr-sqrt83.1%
fabs-sqr83.1%
add-sqr-sqrt86.5%
metadata-eval86.5%
Applied egg-rr86.5%
Taylor expanded in y around inf 61.8%
Final simplification33.5%
(FPCore (x y) :precision binary64 (* 0.5 (+ x y)))
double code(double x, double y) {
return 0.5 * (x + y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.5d0 * (x + y)
end function
public static double code(double x, double y) {
return 0.5 * (x + y);
}
def code(x, y): return 0.5 * (x + y)
function code(x, y) return Float64(0.5 * Float64(x + y)) end
function tmp = code(x, y) tmp = 0.5 * (x + y); end
code[x_, y_] := N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(x + y\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt47.7%
fabs-sqr47.7%
add-sqr-sqrt52.9%
metadata-eval52.9%
Applied egg-rr52.9%
Taylor expanded in y around 0 52.9%
+-commutative52.9%
associate-+r+52.9%
distribute-lft1-in52.9%
metadata-eval52.9%
distribute-lft-out52.9%
Simplified52.9%
Final simplification52.9%
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
return x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x
end function
public static double code(double x, double y) {
return x;
}
def code(x, y): return x
function code(x, y) return x end
function tmp = code(x, y) tmp = x; end
code[x_, y_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
Taylor expanded in x around inf 11.1%
Final simplification11.1%
herbie shell --seed 2023309
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
:precision binary64
(+ x (/ (fabs (- y x)) 2.0)))