
(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 (- x y)) 0.5 x))
double code(double x, double y) {
return fma(fabs((x - y)), 0.5, x);
}
function code(x, y) return fma(abs(Float64(x - y)), 0.5, x) end
code[x_, y_] := N[(N[Abs[N[(x - y), $MachinePrecision]], $MachinePrecision] * 0.5 + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left|x - y\right|, 0.5, x\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
sub-negN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
lower-fabs.f64N/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
lower--.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= y -3.25e+38) (* -0.5 y) (if (<= y 3.8e-41) (* 0.5 x) (* 0.5 y))))
double code(double x, double y) {
double tmp;
if (y <= -3.25e+38) {
tmp = -0.5 * y;
} else if (y <= 3.8e-41) {
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.25d+38)) then
tmp = (-0.5d0) * y
else if (y <= 3.8d-41) 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.25e+38) {
tmp = -0.5 * y;
} else if (y <= 3.8e-41) {
tmp = 0.5 * x;
} else {
tmp = 0.5 * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.25e+38: tmp = -0.5 * y elif y <= 3.8e-41: tmp = 0.5 * x else: tmp = 0.5 * y return tmp
function code(x, y) tmp = 0.0 if (y <= -3.25e+38) tmp = Float64(-0.5 * y); elseif (y <= 3.8e-41) 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.25e+38) tmp = -0.5 * y; elseif (y <= 3.8e-41) tmp = 0.5 * x; else tmp = 0.5 * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.25e+38], N[(-0.5 * y), $MachinePrecision], If[LessEqual[y, 3.8e-41], N[(0.5 * x), $MachinePrecision], N[(0.5 * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.25 \cdot 10^{+38}:\\
\;\;\;\;-0.5 \cdot y\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-41}:\\
\;\;\;\;0.5 \cdot x\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot y\\
\end{array}
\end{array}
if y < -3.25e38Initial program 100.0%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
sub-negN/A
remove-double-negN/A
distribute-neg-inN/A
+-commutativeN/A
sub-negN/A
lift--.f64N/A
rem-square-sqrtN/A
sqrt-prodN/A
rem-sqrt-square-revN/A
lift-fabs.f64N/A
lower-sqrt.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower--.f64N/A
Applied rewrites93.7%
Taylor expanded in x around inf
lower-*.f648.5
Applied rewrites8.5%
Taylor expanded in x around 0
lower-*.f6486.4
Applied rewrites86.4%
if -3.25e38 < y < 3.79999999999999979e-41Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
div-invN/A
lower-fma.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
metadata-eval62.5
Applied rewrites62.5%
Taylor expanded in x around inf
lower-*.f6455.4
Applied rewrites55.4%
if 3.79999999999999979e-41 < y Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
div-invN/A
lower-fma.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
metadata-eval89.7
Applied rewrites89.7%
Taylor expanded in x around 0
lower-*.f6475.6
Applied rewrites75.6%
(FPCore (x y) :precision binary64 (if (<= x -7.6e-100) (* 0.5 x) (if (<= x 1.1e-9) (* -0.5 y) (* 1.5 x))))
double code(double x, double y) {
double tmp;
if (x <= -7.6e-100) {
tmp = 0.5 * x;
} else if (x <= 1.1e-9) {
tmp = -0.5 * y;
} else {
tmp = 1.5 * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-7.6d-100)) then
tmp = 0.5d0 * x
else if (x <= 1.1d-9) then
tmp = (-0.5d0) * y
else
tmp = 1.5d0 * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -7.6e-100) {
tmp = 0.5 * x;
} else if (x <= 1.1e-9) {
tmp = -0.5 * y;
} else {
tmp = 1.5 * x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -7.6e-100: tmp = 0.5 * x elif x <= 1.1e-9: tmp = -0.5 * y else: tmp = 1.5 * x return tmp
function code(x, y) tmp = 0.0 if (x <= -7.6e-100) tmp = Float64(0.5 * x); elseif (x <= 1.1e-9) tmp = Float64(-0.5 * y); else tmp = Float64(1.5 * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -7.6e-100) tmp = 0.5 * x; elseif (x <= 1.1e-9) tmp = -0.5 * y; else tmp = 1.5 * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -7.6e-100], N[(0.5 * x), $MachinePrecision], If[LessEqual[x, 1.1e-9], N[(-0.5 * y), $MachinePrecision], N[(1.5 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{-100}:\\
\;\;\;\;0.5 \cdot x\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-9}:\\
\;\;\;\;-0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;1.5 \cdot x\\
\end{array}
\end{array}
if x < -7.59999999999999995e-100Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
div-invN/A
lower-fma.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
metadata-eval85.8
Applied rewrites85.8%
Taylor expanded in x around inf
lower-*.f6468.9
Applied rewrites68.9%
if -7.59999999999999995e-100 < x < 1.0999999999999999e-9Initial program 99.9%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
sub-negN/A
remove-double-negN/A
distribute-neg-inN/A
+-commutativeN/A
sub-negN/A
lift--.f64N/A
rem-square-sqrtN/A
sqrt-prodN/A
rem-sqrt-square-revN/A
lift-fabs.f64N/A
lower-sqrt.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower--.f64N/A
Applied rewrites52.0%
Taylor expanded in x around inf
lower-*.f6417.0
Applied rewrites17.0%
Taylor expanded in x around 0
lower-*.f6439.8
Applied rewrites39.8%
if 1.0999999999999999e-9 < x Initial program 99.8%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
sub-negN/A
remove-double-negN/A
distribute-neg-inN/A
+-commutativeN/A
sub-negN/A
lift--.f64N/A
rem-square-sqrtN/A
sqrt-prodN/A
rem-sqrt-square-revN/A
lift-fabs.f64N/A
lower-sqrt.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower--.f64N/A
Applied rewrites88.4%
Taylor expanded in x around inf
lower-*.f6475.3
Applied rewrites75.3%
(FPCore (x y) :precision binary64 (if (<= y -1.9e-134) (fma (- x y) 0.5 x) (* (+ y x) 0.5)))
double code(double x, double y) {
double tmp;
if (y <= -1.9e-134) {
tmp = fma((x - y), 0.5, x);
} else {
tmp = (y + x) * 0.5;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -1.9e-134) tmp = fma(Float64(x - y), 0.5, x); else tmp = Float64(Float64(y + x) * 0.5); end return tmp end
code[x_, y_] := If[LessEqual[y, -1.9e-134], N[(N[(x - y), $MachinePrecision] * 0.5 + x), $MachinePrecision], N[(N[(y + x), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-134}:\\
\;\;\;\;\mathsf{fma}\left(x - y, 0.5, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y + x\right) \cdot 0.5\\
\end{array}
\end{array}
if y < -1.90000000000000001e-134Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
sub-negN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
lower-fabs.f64N/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
lower--.f6499.9
Applied rewrites99.9%
Applied rewrites82.9%
if -1.90000000000000001e-134 < y Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
div-invN/A
lower-fma.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
metadata-eval76.6
Applied rewrites76.6%
Taylor expanded in x around 0
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6476.6
Applied rewrites76.6%
Final simplification78.8%
(FPCore (x y) :precision binary64 (if (<= y -1.5e-7) (+ (* -0.5 y) x) (* (+ y x) 0.5)))
double code(double x, double y) {
double tmp;
if (y <= -1.5e-7) {
tmp = (-0.5 * y) + x;
} else {
tmp = (y + x) * 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 <= (-1.5d-7)) then
tmp = ((-0.5d0) * y) + x
else
tmp = (y + x) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.5e-7) {
tmp = (-0.5 * y) + x;
} else {
tmp = (y + x) * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.5e-7: tmp = (-0.5 * y) + x else: tmp = (y + x) * 0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.5e-7) tmp = Float64(Float64(-0.5 * y) + x); else tmp = Float64(Float64(y + x) * 0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.5e-7) tmp = (-0.5 * y) + x; else tmp = (y + x) * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.5e-7], N[(N[(-0.5 * y), $MachinePrecision] + x), $MachinePrecision], N[(N[(y + x), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{-7}:\\
\;\;\;\;-0.5 \cdot y + x\\
\mathbf{else}:\\
\;\;\;\;\left(y + x\right) \cdot 0.5\\
\end{array}
\end{array}
if y < -1.4999999999999999e-7Initial program 99.9%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
sub-negN/A
remove-double-negN/A
distribute-neg-inN/A
+-commutativeN/A
sub-negN/A
lift--.f64N/A
rem-square-sqrtN/A
sqrt-prodN/A
rem-sqrt-square-revN/A
lift-fabs.f64N/A
lower-sqrt.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower--.f64N/A
Applied rewrites91.0%
Taylor expanded in x around 0
lower-*.f6482.9
Applied rewrites82.9%
if -1.4999999999999999e-7 < y Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
div-invN/A
lower-fma.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
metadata-eval73.4
Applied rewrites73.4%
Taylor expanded in x around 0
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6473.4
Applied rewrites73.4%
Final simplification75.7%
(FPCore (x y) :precision binary64 (if (<= y -3.25e+38) (* -0.5 y) (* (+ y x) 0.5)))
double code(double x, double y) {
double tmp;
if (y <= -3.25e+38) {
tmp = -0.5 * y;
} else {
tmp = (y + x) * 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 <= (-3.25d+38)) then
tmp = (-0.5d0) * y
else
tmp = (y + x) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.25e+38) {
tmp = -0.5 * y;
} else {
tmp = (y + x) * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.25e+38: tmp = -0.5 * y else: tmp = (y + x) * 0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.25e+38) tmp = Float64(-0.5 * y); else tmp = Float64(Float64(y + x) * 0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.25e+38) tmp = -0.5 * y; else tmp = (y + x) * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.25e+38], N[(-0.5 * y), $MachinePrecision], N[(N[(y + x), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.25 \cdot 10^{+38}:\\
\;\;\;\;-0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(y + x\right) \cdot 0.5\\
\end{array}
\end{array}
if y < -3.25e38Initial program 100.0%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
sub-negN/A
remove-double-negN/A
distribute-neg-inN/A
+-commutativeN/A
sub-negN/A
lift--.f64N/A
rem-square-sqrtN/A
sqrt-prodN/A
rem-sqrt-square-revN/A
lift-fabs.f64N/A
lower-sqrt.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower--.f64N/A
Applied rewrites93.7%
Taylor expanded in x around inf
lower-*.f648.5
Applied rewrites8.5%
Taylor expanded in x around 0
lower-*.f6486.4
Applied rewrites86.4%
if -3.25e38 < y Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
div-invN/A
lower-fma.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
metadata-eval72.2
Applied rewrites72.2%
Taylor expanded in x around 0
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6472.2
Applied rewrites72.2%
Final simplification75.1%
(FPCore (x y) :precision binary64 (if (<= y -5e+28) (* -0.5 y) (* 1.5 x)))
double code(double x, double y) {
double tmp;
if (y <= -5e+28) {
tmp = -0.5 * y;
} else {
tmp = 1.5 * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-5d+28)) then
tmp = (-0.5d0) * y
else
tmp = 1.5d0 * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5e+28) {
tmp = -0.5 * y;
} else {
tmp = 1.5 * x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5e+28: tmp = -0.5 * y else: tmp = 1.5 * x return tmp
function code(x, y) tmp = 0.0 if (y <= -5e+28) tmp = Float64(-0.5 * y); else tmp = Float64(1.5 * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5e+28) tmp = -0.5 * y; else tmp = 1.5 * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5e+28], N[(-0.5 * y), $MachinePrecision], N[(1.5 * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+28}:\\
\;\;\;\;-0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;1.5 \cdot x\\
\end{array}
\end{array}
if y < -4.99999999999999957e28Initial program 100.0%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
sub-negN/A
remove-double-negN/A
distribute-neg-inN/A
+-commutativeN/A
sub-negN/A
lift--.f64N/A
rem-square-sqrtN/A
sqrt-prodN/A
rem-sqrt-square-revN/A
lift-fabs.f64N/A
lower-sqrt.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower--.f64N/A
Applied rewrites92.0%
Taylor expanded in x around inf
lower-*.f648.6
Applied rewrites8.6%
Taylor expanded in x around 0
lower-*.f6485.1
Applied rewrites85.1%
if -4.99999999999999957e28 < y Initial program 99.9%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
sub-negN/A
remove-double-negN/A
distribute-neg-inN/A
+-commutativeN/A
sub-negN/A
lift--.f64N/A
rem-square-sqrtN/A
sqrt-prodN/A
rem-sqrt-square-revN/A
lift-fabs.f64N/A
lower-sqrt.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower--.f64N/A
Applied rewrites32.2%
Taylor expanded in x around inf
lower-*.f6432.5
Applied rewrites32.5%
(FPCore (x y) :precision binary64 (* -0.5 y))
double code(double x, double y) {
return -0.5 * y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (-0.5d0) * y
end function
public static double code(double x, double y) {
return -0.5 * y;
}
def code(x, y): return -0.5 * y
function code(x, y) return Float64(-0.5 * y) end
function tmp = code(x, y) tmp = -0.5 * y; end
code[x_, y_] := N[(-0.5 * y), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot y
\end{array}
Initial program 99.9%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
sub-negN/A
remove-double-negN/A
distribute-neg-inN/A
+-commutativeN/A
sub-negN/A
lift--.f64N/A
rem-square-sqrtN/A
sqrt-prodN/A
rem-sqrt-square-revN/A
lift-fabs.f64N/A
lower-sqrt.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower--.f64N/A
Applied rewrites45.1%
Taylor expanded in x around inf
lower-*.f6427.3
Applied rewrites27.3%
Taylor expanded in x around 0
lower-*.f6425.3
Applied rewrites25.3%
herbie shell --seed 2024298
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
:precision binary64
(+ x (/ (fabs (- y x)) 2.0)))