
(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 (fma (fabs (- y x)) 0.5 x))
double code(double x, double y) {
return fma(fabs((y - x)), 0.5, x);
}
function code(x, y) return fma(abs(Float64(y - x)), 0.5, x) end
code[x_, y_] := N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] * 0.5 + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left|y - x\right|, 0.5, x\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-lft-identityN/A
metadata-evalN/A
fabs-subN/A
fp-cancel-sign-sub-invN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= (+ x (/ (fabs (- y x)) 2.0)) 4.8e-246) (* 0.5 x) (* 0.5 y)))
double code(double x, double y) {
double tmp;
if ((x + (fabs((y - x)) / 2.0)) <= 4.8e-246) {
tmp = 0.5 * x;
} else {
tmp = 0.5 * y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x + (abs((y - x)) / 2.0d0)) <= 4.8d-246) then
tmp = 0.5d0 * x
else
tmp = 0.5d0 * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x + (Math.abs((y - x)) / 2.0)) <= 4.8e-246) {
tmp = 0.5 * x;
} else {
tmp = 0.5 * y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x + (math.fabs((y - x)) / 2.0)) <= 4.8e-246: tmp = 0.5 * x else: tmp = 0.5 * y return tmp
function code(x, y) tmp = 0.0 if (Float64(x + Float64(abs(Float64(y - x)) / 2.0)) <= 4.8e-246) tmp = Float64(0.5 * x); else tmp = Float64(0.5 * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x + (abs((y - x)) / 2.0)) <= 4.8e-246) tmp = 0.5 * x; else tmp = 0.5 * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(x + N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 4.8e-246], N[(0.5 * x), $MachinePrecision], N[(0.5 * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + \frac{\left|y - x\right|}{2} \leq 4.8 \cdot 10^{-246}:\\
\;\;\;\;0.5 \cdot x\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot y\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (fabs.f64 (-.f64 y x)) #s(literal 2 binary64))) < 4.7999999999999996e-246Initial program 100.0%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6493.5
Applied rewrites93.5%
Taylor expanded in y around 0
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f6494.4
Applied rewrites94.4%
if 4.7999999999999996e-246 < (+.f64 x (/.f64 (fabs.f64 (-.f64 y x)) #s(literal 2 binary64))) Initial program 99.9%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6436.4
Applied rewrites36.4%
Taylor expanded in x around 0
lower-*.f6436.9
Applied rewrites36.9%
(FPCore (x y) :precision binary64 (if (<= y -3.7e-81) (* -0.5 y) (if (<= y -1e-213) (* 0.5 x) (if (<= y 1.95e+14) (* 1.5 x) (* 0.5 y)))))
double code(double x, double y) {
double tmp;
if (y <= -3.7e-81) {
tmp = -0.5 * y;
} else if (y <= -1e-213) {
tmp = 0.5 * x;
} else if (y <= 1.95e+14) {
tmp = 1.5 * x;
} else {
tmp = 0.5 * y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-3.7d-81)) then
tmp = (-0.5d0) * y
else if (y <= (-1d-213)) then
tmp = 0.5d0 * x
else if (y <= 1.95d+14) then
tmp = 1.5d0 * x
else
tmp = 0.5d0 * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.7e-81) {
tmp = -0.5 * y;
} else if (y <= -1e-213) {
tmp = 0.5 * x;
} else if (y <= 1.95e+14) {
tmp = 1.5 * x;
} else {
tmp = 0.5 * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.7e-81: tmp = -0.5 * y elif y <= -1e-213: tmp = 0.5 * x elif y <= 1.95e+14: tmp = 1.5 * x else: tmp = 0.5 * y return tmp
function code(x, y) tmp = 0.0 if (y <= -3.7e-81) tmp = Float64(-0.5 * y); elseif (y <= -1e-213) tmp = Float64(0.5 * x); elseif (y <= 1.95e+14) tmp = Float64(1.5 * x); else tmp = Float64(0.5 * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.7e-81) tmp = -0.5 * y; elseif (y <= -1e-213) tmp = 0.5 * x; elseif (y <= 1.95e+14) tmp = 1.5 * x; else tmp = 0.5 * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.7e-81], N[(-0.5 * y), $MachinePrecision], If[LessEqual[y, -1e-213], N[(0.5 * x), $MachinePrecision], If[LessEqual[y, 1.95e+14], N[(1.5 * x), $MachinePrecision], N[(0.5 * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{-81}:\\
\;\;\;\;-0.5 \cdot y\\
\mathbf{elif}\;y \leq -1 \cdot 10^{-213}:\\
\;\;\;\;0.5 \cdot x\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+14}:\\
\;\;\;\;1.5 \cdot x\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot y\\
\end{array}
\end{array}
if y < -3.69999999999999986e-81Initial program 100.0%
lift-+.f64N/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqrt-prodN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6453.1
lift-/.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
frac-2negN/A
Applied rewrites53.1%
Taylor expanded in x around 0
lower-*.f6467.4
Applied rewrites67.4%
if -3.69999999999999986e-81 < y < -9.9999999999999995e-214Initial program 99.9%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6455.2
Applied rewrites55.2%
Taylor expanded in y around 0
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f6460.4
Applied rewrites60.4%
if -9.9999999999999995e-214 < y < 1.95e14Initial program 99.8%
lift-+.f64N/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqrt-prodN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6458.5
lift-/.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
frac-2negN/A
Applied rewrites50.6%
Taylor expanded in x around inf
lower-*.f6453.0
Applied rewrites53.0%
if 1.95e14 < y Initial program 100.0%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6494.7
Applied rewrites94.7%
Taylor expanded in x around 0
lower-*.f6484.4
Applied rewrites84.4%
(FPCore (x y) :precision binary64 (if (<= y -1e-213) (* (- x y) 0.5) (if (<= y 7.5e-257) (fma (- x y) 0.5 x) (* 0.5 (+ y x)))))
double code(double x, double y) {
double tmp;
if (y <= -1e-213) {
tmp = (x - y) * 0.5;
} else if (y <= 7.5e-257) {
tmp = fma((x - y), 0.5, x);
} else {
tmp = 0.5 * (y + x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -1e-213) tmp = Float64(Float64(x - y) * 0.5); elseif (y <= 7.5e-257) tmp = fma(Float64(x - y), 0.5, x); else tmp = Float64(0.5 * Float64(y + x)); end return tmp end
code[x_, y_] := If[LessEqual[y, -1e-213], N[(N[(x - y), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[y, 7.5e-257], N[(N[(x - y), $MachinePrecision] * 0.5 + x), $MachinePrecision], N[(0.5 * N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{-213}:\\
\;\;\;\;\left(x - y\right) \cdot 0.5\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{-257}:\\
\;\;\;\;\mathsf{fma}\left(x - y, 0.5, x\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y + x\right)\\
\end{array}
\end{array}
if y < -9.9999999999999995e-214Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-lft-identityN/A
metadata-evalN/A
fabs-subN/A
fp-cancel-sign-sub-invN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6458.0
Applied rewrites58.0%
Applied rewrites85.7%
if -9.9999999999999995e-214 < y < 7.4999999999999995e-257Initial program 99.8%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-lft-identityN/A
metadata-evalN/A
fabs-subN/A
fp-cancel-sign-sub-invN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.8
Applied rewrites99.8%
Applied rewrites77.6%
if 7.4999999999999995e-257 < y Initial program 99.9%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6476.8
Applied rewrites76.8%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6481.4
Applied rewrites81.4%
Final simplification82.8%
(FPCore (x y) :precision binary64 (if (<= y -2.2e-246) (* (- x y) 0.5) (if (<= y 7.5e-257) (* 1.5 x) (* 0.5 (+ y x)))))
double code(double x, double y) {
double tmp;
if (y <= -2.2e-246) {
tmp = (x - y) * 0.5;
} else if (y <= 7.5e-257) {
tmp = 1.5 * x;
} else {
tmp = 0.5 * (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 <= (-2.2d-246)) then
tmp = (x - y) * 0.5d0
else if (y <= 7.5d-257) then
tmp = 1.5d0 * x
else
tmp = 0.5d0 * (y + x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.2e-246) {
tmp = (x - y) * 0.5;
} else if (y <= 7.5e-257) {
tmp = 1.5 * x;
} else {
tmp = 0.5 * (y + x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.2e-246: tmp = (x - y) * 0.5 elif y <= 7.5e-257: tmp = 1.5 * x else: tmp = 0.5 * (y + x) return tmp
function code(x, y) tmp = 0.0 if (y <= -2.2e-246) tmp = Float64(Float64(x - y) * 0.5); elseif (y <= 7.5e-257) tmp = Float64(1.5 * x); else tmp = Float64(0.5 * Float64(y + x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.2e-246) tmp = (x - y) * 0.5; elseif (y <= 7.5e-257) tmp = 1.5 * x; else tmp = 0.5 * (y + x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.2e-246], N[(N[(x - y), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[y, 7.5e-257], N[(1.5 * x), $MachinePrecision], N[(0.5 * N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{-246}:\\
\;\;\;\;\left(x - y\right) \cdot 0.5\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{-257}:\\
\;\;\;\;1.5 \cdot x\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y + x\right)\\
\end{array}
\end{array}
if y < -2.19999999999999998e-246Initial program 99.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-lft-identityN/A
metadata-evalN/A
fabs-subN/A
fp-cancel-sign-sub-invN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6456.4
Applied rewrites56.4%
Applied rewrites83.8%
if -2.19999999999999998e-246 < y < 7.4999999999999995e-257Initial program 99.8%
lift-+.f64N/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqrt-prodN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6471.8
lift-/.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
frac-2negN/A
Applied rewrites71.8%
Taylor expanded in x around inf
lower-*.f6469.4
Applied rewrites69.4%
if 7.4999999999999995e-257 < y Initial program 99.9%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6476.8
Applied rewrites76.8%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6481.4
Applied rewrites81.4%
Final simplification81.6%
(FPCore (x y) :precision binary64 (if (<= y -2.2e-246) (* (- x y) 0.5) (if (<= y 1.95e+14) (* 1.5 x) (* 0.5 y))))
double code(double x, double y) {
double tmp;
if (y <= -2.2e-246) {
tmp = (x - y) * 0.5;
} else if (y <= 1.95e+14) {
tmp = 1.5 * x;
} else {
tmp = 0.5 * 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-246)) then
tmp = (x - y) * 0.5d0
else if (y <= 1.95d+14) then
tmp = 1.5d0 * x
else
tmp = 0.5d0 * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.2e-246) {
tmp = (x - y) * 0.5;
} else if (y <= 1.95e+14) {
tmp = 1.5 * x;
} else {
tmp = 0.5 * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.2e-246: tmp = (x - y) * 0.5 elif y <= 1.95e+14: tmp = 1.5 * x else: tmp = 0.5 * y return tmp
function code(x, y) tmp = 0.0 if (y <= -2.2e-246) tmp = Float64(Float64(x - y) * 0.5); elseif (y <= 1.95e+14) tmp = Float64(1.5 * x); else tmp = Float64(0.5 * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.2e-246) tmp = (x - y) * 0.5; elseif (y <= 1.95e+14) tmp = 1.5 * x; else tmp = 0.5 * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.2e-246], N[(N[(x - y), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[y, 1.95e+14], N[(1.5 * x), $MachinePrecision], N[(0.5 * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{-246}:\\
\;\;\;\;\left(x - y\right) \cdot 0.5\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+14}:\\
\;\;\;\;1.5 \cdot x\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot y\\
\end{array}
\end{array}
if y < -2.19999999999999998e-246Initial program 99.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-lft-identityN/A
metadata-evalN/A
fabs-subN/A
fp-cancel-sign-sub-invN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6456.4
Applied rewrites56.4%
Applied rewrites83.8%
if -2.19999999999999998e-246 < y < 1.95e14Initial program 99.9%
lift-+.f64N/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqrt-prodN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6458.2
lift-/.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
frac-2negN/A
Applied rewrites49.4%
Taylor expanded in x around inf
lower-*.f6452.7
Applied rewrites52.7%
if 1.95e14 < y Initial program 100.0%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6494.7
Applied rewrites94.7%
Taylor expanded in x around 0
lower-*.f6484.4
Applied rewrites84.4%
Final simplification74.6%
(FPCore (x y) :precision binary64 (if (<= y -3.7e-81) (* -0.5 y) (if (<= y 0.085) (* 0.5 x) (* 0.5 y))))
double code(double x, double y) {
double tmp;
if (y <= -3.7e-81) {
tmp = -0.5 * y;
} else if (y <= 0.085) {
tmp = 0.5 * x;
} else {
tmp = 0.5 * y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-3.7d-81)) then
tmp = (-0.5d0) * y
else if (y <= 0.085d0) then
tmp = 0.5d0 * x
else
tmp = 0.5d0 * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.7e-81) {
tmp = -0.5 * y;
} else if (y <= 0.085) {
tmp = 0.5 * x;
} else {
tmp = 0.5 * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.7e-81: tmp = -0.5 * y elif y <= 0.085: tmp = 0.5 * x else: tmp = 0.5 * y return tmp
function code(x, y) tmp = 0.0 if (y <= -3.7e-81) tmp = Float64(-0.5 * y); elseif (y <= 0.085) tmp = Float64(0.5 * x); else tmp = Float64(0.5 * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.7e-81) tmp = -0.5 * y; elseif (y <= 0.085) tmp = 0.5 * x; else tmp = 0.5 * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.7e-81], N[(-0.5 * y), $MachinePrecision], If[LessEqual[y, 0.085], N[(0.5 * x), $MachinePrecision], N[(0.5 * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{-81}:\\
\;\;\;\;-0.5 \cdot y\\
\mathbf{elif}\;y \leq 0.085:\\
\;\;\;\;0.5 \cdot x\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot y\\
\end{array}
\end{array}
if y < -3.69999999999999986e-81Initial program 100.0%
lift-+.f64N/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqrt-prodN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6453.1
lift-/.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
frac-2negN/A
Applied rewrites53.1%
Taylor expanded in x around 0
lower-*.f6467.4
Applied rewrites67.4%
if -3.69999999999999986e-81 < y < 0.0850000000000000061Initial program 99.9%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6450.0
Applied rewrites50.0%
Taylor expanded in y around 0
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f6447.7
Applied rewrites47.7%
if 0.0850000000000000061 < y Initial program 100.0%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6492.0
Applied rewrites92.0%
Taylor expanded in x around 0
lower-*.f6482.2
Applied rewrites82.2%
(FPCore (x y) :precision binary64 (* 0.5 x))
double code(double x, double y) {
return 0.5 * x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.5d0 * x
end function
public static double code(double x, double y) {
return 0.5 * x;
}
def code(x, y): return 0.5 * x
function code(x, y) return Float64(0.5 * x) end
function tmp = code(x, y) tmp = 0.5 * x; end
code[x_, y_] := N[(0.5 * x), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot x
\end{array}
Initial program 99.9%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6451.6
Applied rewrites51.6%
Taylor expanded in y around 0
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f6430.9
Applied rewrites30.9%
herbie shell --seed 2024337
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
:precision binary64
(+ x (/ (fabs (- y x)) 2.0)))