
(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 11 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%
(FPCore (x y) :precision binary64 (if (<= x -1.65e-93) (* 0.5 (+ x y)) (if (<= x 4.1e-57) (+ x (/ (fabs y) 2.0)) (+ x (/ (- x y) 2.0)))))
double code(double x, double y) {
double tmp;
if (x <= -1.65e-93) {
tmp = 0.5 * (x + y);
} else if (x <= 4.1e-57) {
tmp = x + (fabs(y) / 2.0);
} else {
tmp = x + ((x - y) / 2.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.65d-93)) then
tmp = 0.5d0 * (x + y)
else if (x <= 4.1d-57) then
tmp = x + (abs(y) / 2.0d0)
else
tmp = x + ((x - y) / 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.65e-93) {
tmp = 0.5 * (x + y);
} else if (x <= 4.1e-57) {
tmp = x + (Math.abs(y) / 2.0);
} else {
tmp = x + ((x - y) / 2.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.65e-93: tmp = 0.5 * (x + y) elif x <= 4.1e-57: tmp = x + (math.fabs(y) / 2.0) else: tmp = x + ((x - y) / 2.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.65e-93) tmp = Float64(0.5 * Float64(x + y)); elseif (x <= 4.1e-57) tmp = Float64(x + Float64(abs(y) / 2.0)); else tmp = Float64(x + Float64(Float64(x - y) / 2.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.65e-93) tmp = 0.5 * (x + y); elseif (x <= 4.1e-57) tmp = x + (abs(y) / 2.0); else tmp = x + ((x - y) / 2.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.65e-93], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.1e-57], N[(x + N[(N[Abs[y], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(x - y), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{-93}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-57}:\\
\;\;\;\;x + \frac{\left|y\right|}{2}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{x - y}{2}\\
\end{array}
\end{array}
if x < -1.6500000000000001e-93Initial program 100.0%
*-un-lft-identity100.0%
fma-define100.0%
add-sqr-sqrt90.5%
fabs-sqr90.5%
add-sqr-sqrt91.3%
frac-2neg91.3%
distribute-frac-neg91.3%
fmm-undef91.3%
*-un-lft-identity91.3%
metadata-eval91.3%
Applied egg-rr91.3%
Taylor expanded in x around 0 91.3%
cancel-sign-sub-inv91.3%
metadata-eval91.3%
distribute-lft-in91.3%
+-commutative91.3%
Simplified91.3%
if -1.6500000000000001e-93 < x < 4.1000000000000001e-57Initial program 100.0%
Taylor expanded in y around inf 90.5%
if 4.1000000000000001e-57 < x Initial program 99.8%
Taylor expanded in y around inf 72.0%
mul-1-neg72.0%
unsub-neg72.0%
Simplified72.0%
Taylor expanded in x around inf 71.8%
add-sqr-sqrt9.8%
fabs-sqr9.8%
add-sqr-sqrt18.1%
associate-*r*18.2%
add-sqr-sqrt18.2%
sqrt-unprod11.9%
sqr-neg11.9%
sqrt-unprod0.0%
add-sqr-sqrt80.8%
distribute-rgt-neg-out80.8%
distribute-lft-neg-in80.8%
associate-*r*61.9%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt8.3%
Applied egg-rr89.8%
associate-*r*61.9%
*-commutative61.9%
distribute-rgt-in62.0%
lft-mult-inverse62.0%
associate-*l/62.0%
associate-*r/62.0%
distribute-lft-in62.0%
neg-mul-162.0%
distribute-rgt-neg-in62.0%
unsub-neg62.0%
associate-*r/81.1%
associate-*l/89.8%
*-inverses89.8%
*-lft-identity89.8%
*-rgt-identity89.8%
associate-+l-89.8%
neg-sub089.8%
+-commutative89.8%
sub-neg89.8%
Simplified89.8%
Final simplification90.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.5 (+ x y))))
(if (<= x -2.85e-154)
t_0
(if (<= x -6.1e-232)
(* y -0.5)
(if (<= x 2.4e-280) t_0 (if (<= x 3e-57) (* y -0.5) (* x 1.5)))))))
double code(double x, double y) {
double t_0 = 0.5 * (x + y);
double tmp;
if (x <= -2.85e-154) {
tmp = t_0;
} else if (x <= -6.1e-232) {
tmp = y * -0.5;
} else if (x <= 2.4e-280) {
tmp = t_0;
} else if (x <= 3e-57) {
tmp = y * -0.5;
} else {
tmp = x * 1.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 = 0.5d0 * (x + y)
if (x <= (-2.85d-154)) then
tmp = t_0
else if (x <= (-6.1d-232)) then
tmp = y * (-0.5d0)
else if (x <= 2.4d-280) then
tmp = t_0
else if (x <= 3d-57) then
tmp = y * (-0.5d0)
else
tmp = x * 1.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.5 * (x + y);
double tmp;
if (x <= -2.85e-154) {
tmp = t_0;
} else if (x <= -6.1e-232) {
tmp = y * -0.5;
} else if (x <= 2.4e-280) {
tmp = t_0;
} else if (x <= 3e-57) {
tmp = y * -0.5;
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): t_0 = 0.5 * (x + y) tmp = 0 if x <= -2.85e-154: tmp = t_0 elif x <= -6.1e-232: tmp = y * -0.5 elif x <= 2.4e-280: tmp = t_0 elif x <= 3e-57: tmp = y * -0.5 else: tmp = x * 1.5 return tmp
function code(x, y) t_0 = Float64(0.5 * Float64(x + y)) tmp = 0.0 if (x <= -2.85e-154) tmp = t_0; elseif (x <= -6.1e-232) tmp = Float64(y * -0.5); elseif (x <= 2.4e-280) tmp = t_0; elseif (x <= 3e-57) tmp = Float64(y * -0.5); else tmp = Float64(x * 1.5); end return tmp end
function tmp_2 = code(x, y) t_0 = 0.5 * (x + y); tmp = 0.0; if (x <= -2.85e-154) tmp = t_0; elseif (x <= -6.1e-232) tmp = y * -0.5; elseif (x <= 2.4e-280) tmp = t_0; elseif (x <= 3e-57) tmp = y * -0.5; else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.85e-154], t$95$0, If[LessEqual[x, -6.1e-232], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 2.4e-280], t$95$0, If[LessEqual[x, 3e-57], N[(y * -0.5), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(x + y\right)\\
\mathbf{if}\;x \leq -2.85 \cdot 10^{-154}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -6.1 \cdot 10^{-232}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-280}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-57}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -2.8499999999999999e-154 or -6.1000000000000001e-232 < x < 2.3999999999999998e-280Initial program 100.0%
*-un-lft-identity100.0%
fma-define100.0%
add-sqr-sqrt82.3%
fabs-sqr82.3%
add-sqr-sqrt83.4%
frac-2neg83.4%
distribute-frac-neg83.4%
fmm-undef83.4%
*-un-lft-identity83.4%
metadata-eval83.4%
Applied egg-rr83.4%
Taylor expanded in x around 0 83.4%
cancel-sign-sub-inv83.4%
metadata-eval83.4%
distribute-lft-in83.4%
+-commutative83.4%
Simplified83.4%
if -2.8499999999999999e-154 < x < -6.1000000000000001e-232 or 2.3999999999999998e-280 < x < 3.00000000000000001e-57Initial program 99.9%
add-cube-cbrt98.1%
fabs-mul98.1%
pow298.1%
Applied egg-rr98.1%
Applied egg-rr62.1%
Taylor expanded in x around 0 60.3%
*-commutative60.3%
Simplified60.3%
if 3.00000000000000001e-57 < x Initial program 99.8%
Taylor expanded in y around 0 74.3%
neg-mul-174.3%
Simplified74.3%
add-sqr-sqrt74.2%
associate-/l*74.2%
fabs-neg74.2%
add-sqr-sqrt74.2%
fabs-sqr74.2%
add-sqr-sqrt74.2%
fabs-neg74.2%
add-sqr-sqrt74.2%
fabs-sqr74.2%
add-sqr-sqrt74.2%
Applied egg-rr74.2%
associate-*r/74.2%
rem-square-sqrt74.3%
Simplified74.3%
Taylor expanded in x around 0 74.3%
*-commutative74.3%
Simplified74.3%
Final simplification75.4%
(FPCore (x y)
:precision binary64
(if (<= x -9.5e-103)
(* x 0.5)
(if (<= x -3e-252)
(* y -0.5)
(if (<= x 7.4e-281) (* y 0.5) (if (<= x 3e-57) (* y -0.5) (* x 1.5))))))
double code(double x, double y) {
double tmp;
if (x <= -9.5e-103) {
tmp = x * 0.5;
} else if (x <= -3e-252) {
tmp = y * -0.5;
} else if (x <= 7.4e-281) {
tmp = y * 0.5;
} else if (x <= 3e-57) {
tmp = y * -0.5;
} else {
tmp = x * 1.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-9.5d-103)) then
tmp = x * 0.5d0
else if (x <= (-3d-252)) then
tmp = y * (-0.5d0)
else if (x <= 7.4d-281) then
tmp = y * 0.5d0
else if (x <= 3d-57) then
tmp = y * (-0.5d0)
else
tmp = x * 1.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -9.5e-103) {
tmp = x * 0.5;
} else if (x <= -3e-252) {
tmp = y * -0.5;
} else if (x <= 7.4e-281) {
tmp = y * 0.5;
} else if (x <= 3e-57) {
tmp = y * -0.5;
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -9.5e-103: tmp = x * 0.5 elif x <= -3e-252: tmp = y * -0.5 elif x <= 7.4e-281: tmp = y * 0.5 elif x <= 3e-57: tmp = y * -0.5 else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= -9.5e-103) tmp = Float64(x * 0.5); elseif (x <= -3e-252) tmp = Float64(y * -0.5); elseif (x <= 7.4e-281) tmp = Float64(y * 0.5); elseif (x <= 3e-57) tmp = Float64(y * -0.5); else tmp = Float64(x * 1.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -9.5e-103) tmp = x * 0.5; elseif (x <= -3e-252) tmp = y * -0.5; elseif (x <= 7.4e-281) tmp = y * 0.5; elseif (x <= 3e-57) tmp = y * -0.5; else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -9.5e-103], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, -3e-252], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 7.4e-281], N[(y * 0.5), $MachinePrecision], If[LessEqual[x, 3e-57], N[(y * -0.5), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-103}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq -3 \cdot 10^{-252}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 7.4 \cdot 10^{-281}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-57}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -9.50000000000000065e-103Initial program 100.0%
*-un-lft-identity100.0%
fma-define100.0%
add-sqr-sqrt90.8%
fabs-sqr90.8%
add-sqr-sqrt91.6%
frac-2neg91.6%
distribute-frac-neg91.6%
fmm-undef91.6%
*-un-lft-identity91.6%
metadata-eval91.6%
Applied egg-rr91.6%
Taylor expanded in x around inf 73.0%
if -9.50000000000000065e-103 < x < -2.99999999999999995e-252 or 7.39999999999999983e-281 < x < 3.00000000000000001e-57Initial program 100.0%
add-cube-cbrt98.0%
fabs-mul98.0%
pow298.0%
Applied egg-rr98.0%
Applied egg-rr63.9%
Taylor expanded in x around 0 57.5%
*-commutative57.5%
Simplified57.5%
if -2.99999999999999995e-252 < x < 7.39999999999999983e-281Initial program 100.0%
*-un-lft-identity100.0%
fma-define100.0%
add-sqr-sqrt69.6%
fabs-sqr69.6%
add-sqr-sqrt71.3%
frac-2neg71.3%
distribute-frac-neg71.3%
fmm-undef71.3%
*-un-lft-identity71.3%
metadata-eval71.3%
Applied egg-rr71.3%
Taylor expanded in x around 0 67.9%
if 3.00000000000000001e-57 < x Initial program 99.8%
Taylor expanded in y around 0 74.3%
neg-mul-174.3%
Simplified74.3%
add-sqr-sqrt74.2%
associate-/l*74.2%
fabs-neg74.2%
add-sqr-sqrt74.2%
fabs-sqr74.2%
add-sqr-sqrt74.2%
fabs-neg74.2%
add-sqr-sqrt74.2%
fabs-sqr74.2%
add-sqr-sqrt74.2%
Applied egg-rr74.2%
associate-*r/74.2%
rem-square-sqrt74.3%
Simplified74.3%
Taylor expanded in x around 0 74.3%
*-commutative74.3%
Simplified74.3%
Final simplification68.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.5 (+ x y))))
(if (<= y -2.65e-133)
(- x t_0)
(if (<= y -2.4e-279) (+ x (/ (- x y) 2.0)) t_0))))
double code(double x, double y) {
double t_0 = 0.5 * (x + y);
double tmp;
if (y <= -2.65e-133) {
tmp = x - t_0;
} else if (y <= -2.4e-279) {
tmp = x + ((x - y) / 2.0);
} 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 = 0.5d0 * (x + y)
if (y <= (-2.65d-133)) then
tmp = x - t_0
else if (y <= (-2.4d-279)) then
tmp = x + ((x - y) / 2.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.5 * (x + y);
double tmp;
if (y <= -2.65e-133) {
tmp = x - t_0;
} else if (y <= -2.4e-279) {
tmp = x + ((x - y) / 2.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.5 * (x + y) tmp = 0 if y <= -2.65e-133: tmp = x - t_0 elif y <= -2.4e-279: tmp = x + ((x - y) / 2.0) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(0.5 * Float64(x + y)) tmp = 0.0 if (y <= -2.65e-133) tmp = Float64(x - t_0); elseif (y <= -2.4e-279) tmp = Float64(x + Float64(Float64(x - y) / 2.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 0.5 * (x + y); tmp = 0.0; if (y <= -2.65e-133) tmp = x - t_0; elseif (y <= -2.4e-279) tmp = x + ((x - y) / 2.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.65e-133], N[(x - t$95$0), $MachinePrecision], If[LessEqual[y, -2.4e-279], N[(x + N[(N[(x - y), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(x + y\right)\\
\mathbf{if}\;y \leq -2.65 \cdot 10^{-133}:\\
\;\;\;\;x - t\_0\\
\mathbf{elif}\;y \leq -2.4 \cdot 10^{-279}:\\
\;\;\;\;x + \frac{x - y}{2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.64999999999999992e-133Initial program 100.0%
add-cube-cbrt98.3%
fabs-mul98.3%
pow298.3%
Applied egg-rr98.3%
Applied egg-rr88.4%
if -2.64999999999999992e-133 < y < -2.3999999999999999e-279Initial program 99.8%
Taylor expanded in y around inf 67.6%
mul-1-neg67.6%
unsub-neg67.6%
Simplified67.6%
Taylor expanded in x around inf 67.3%
add-sqr-sqrt16.9%
fabs-sqr16.9%
add-sqr-sqrt21.9%
associate-*r*26.8%
add-sqr-sqrt10.0%
sqrt-unprod8.9%
sqr-neg8.9%
sqrt-unprod4.7%
add-sqr-sqrt51.9%
distribute-rgt-neg-out51.9%
distribute-lft-neg-in51.9%
associate-*r*53.7%
add-sqr-sqrt3.3%
fabs-sqr3.3%
add-sqr-sqrt8.2%
Applied egg-rr81.6%
associate-*r*53.7%
*-commutative53.7%
distribute-rgt-in53.7%
lft-mult-inverse53.8%
associate-*l/53.9%
associate-*r/53.9%
distribute-lft-in53.9%
neg-mul-153.9%
distribute-rgt-neg-in53.9%
unsub-neg53.9%
associate-*r/74.3%
associate-*l/81.7%
*-inverses81.7%
*-lft-identity81.7%
*-rgt-identity81.7%
associate-+l-81.7%
neg-sub081.7%
+-commutative81.7%
sub-neg81.7%
Simplified81.7%
if -2.3999999999999999e-279 < y Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt78.8%
fabs-sqr78.8%
add-sqr-sqrt83.1%
frac-2neg83.1%
distribute-frac-neg83.1%
fmm-undef83.1%
*-un-lft-identity83.1%
metadata-eval83.1%
Applied egg-rr83.1%
Taylor expanded in x around 0 83.1%
cancel-sign-sub-inv83.1%
metadata-eval83.1%
distribute-lft-in83.1%
+-commutative83.1%
Simplified83.1%
Final simplification84.8%
(FPCore (x y) :precision binary64 (if (<= y -2.8e-133) (* 0.5 (- x y)) (if (<= y -1.22e-281) (+ x (/ (- x y) 2.0)) (* 0.5 (+ x y)))))
double code(double x, double y) {
double tmp;
if (y <= -2.8e-133) {
tmp = 0.5 * (x - y);
} else if (y <= -1.22e-281) {
tmp = x + ((x - y) / 2.0);
} 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 <= (-2.8d-133)) then
tmp = 0.5d0 * (x - y)
else if (y <= (-1.22d-281)) then
tmp = x + ((x - y) / 2.0d0)
else
tmp = 0.5d0 * (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.8e-133) {
tmp = 0.5 * (x - y);
} else if (y <= -1.22e-281) {
tmp = x + ((x - y) / 2.0);
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.8e-133: tmp = 0.5 * (x - y) elif y <= -1.22e-281: tmp = x + ((x - y) / 2.0) else: tmp = 0.5 * (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= -2.8e-133) tmp = Float64(0.5 * Float64(x - y)); elseif (y <= -1.22e-281) tmp = Float64(x + Float64(Float64(x - y) / 2.0)); else tmp = Float64(0.5 * Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.8e-133) tmp = 0.5 * (x - y); elseif (y <= -1.22e-281) tmp = x + ((x - y) / 2.0); else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.8e-133], N[(0.5 * N[(x - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.22e-281], N[(x + N[(N[(x - y), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{-133}:\\
\;\;\;\;0.5 \cdot \left(x - y\right)\\
\mathbf{elif}\;y \leq -1.22 \cdot 10^{-281}:\\
\;\;\;\;x + \frac{x - y}{2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -2.7999999999999999e-133Initial program 100.0%
add-cube-cbrt98.3%
fabs-mul98.3%
pow298.3%
Applied egg-rr98.3%
Applied egg-rr88.4%
Taylor expanded in x around 0 88.4%
distribute-lft-out--88.4%
Simplified88.4%
if -2.7999999999999999e-133 < y < -1.21999999999999996e-281Initial program 99.8%
Taylor expanded in y around inf 67.6%
mul-1-neg67.6%
unsub-neg67.6%
Simplified67.6%
Taylor expanded in x around inf 67.3%
add-sqr-sqrt16.9%
fabs-sqr16.9%
add-sqr-sqrt21.9%
associate-*r*26.8%
add-sqr-sqrt10.0%
sqrt-unprod8.9%
sqr-neg8.9%
sqrt-unprod4.7%
add-sqr-sqrt51.9%
distribute-rgt-neg-out51.9%
distribute-lft-neg-in51.9%
associate-*r*53.7%
add-sqr-sqrt3.3%
fabs-sqr3.3%
add-sqr-sqrt8.2%
Applied egg-rr81.6%
associate-*r*53.7%
*-commutative53.7%
distribute-rgt-in53.7%
lft-mult-inverse53.8%
associate-*l/53.9%
associate-*r/53.9%
distribute-lft-in53.9%
neg-mul-153.9%
distribute-rgt-neg-in53.9%
unsub-neg53.9%
associate-*r/74.3%
associate-*l/81.7%
*-inverses81.7%
*-lft-identity81.7%
*-rgt-identity81.7%
associate-+l-81.7%
neg-sub081.7%
+-commutative81.7%
sub-neg81.7%
Simplified81.7%
if -1.21999999999999996e-281 < y Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt78.8%
fabs-sqr78.8%
add-sqr-sqrt83.1%
frac-2neg83.1%
distribute-frac-neg83.1%
fmm-undef83.1%
*-un-lft-identity83.1%
metadata-eval83.1%
Applied egg-rr83.1%
Taylor expanded in x around 0 83.1%
cancel-sign-sub-inv83.1%
metadata-eval83.1%
distribute-lft-in83.1%
+-commutative83.1%
Simplified83.1%
Final simplification84.8%
(FPCore (x y) :precision binary64 (if (<= y -1.05e-184) (* 0.5 (- x y)) (if (<= y -3.8e-280) (* x 1.5) (* 0.5 (+ x y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.05e-184) {
tmp = 0.5 * (x - y);
} else if (y <= -3.8e-280) {
tmp = x * 1.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) :: tmp
if (y <= (-1.05d-184)) then
tmp = 0.5d0 * (x - y)
else if (y <= (-3.8d-280)) then
tmp = x * 1.5d0
else
tmp = 0.5d0 * (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.05e-184) {
tmp = 0.5 * (x - y);
} else if (y <= -3.8e-280) {
tmp = x * 1.5;
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.05e-184: tmp = 0.5 * (x - y) elif y <= -3.8e-280: tmp = x * 1.5 else: tmp = 0.5 * (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.05e-184) tmp = Float64(0.5 * Float64(x - y)); elseif (y <= -3.8e-280) tmp = Float64(x * 1.5); else tmp = Float64(0.5 * Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.05e-184) tmp = 0.5 * (x - y); elseif (y <= -3.8e-280) tmp = x * 1.5; else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.05e-184], N[(0.5 * N[(x - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3.8e-280], N[(x * 1.5), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{-184}:\\
\;\;\;\;0.5 \cdot \left(x - y\right)\\
\mathbf{elif}\;y \leq -3.8 \cdot 10^{-280}:\\
\;\;\;\;x \cdot 1.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -1.0499999999999999e-184Initial program 100.0%
add-cube-cbrt98.2%
fabs-mul98.2%
pow298.2%
Applied egg-rr98.2%
Applied egg-rr85.2%
Taylor expanded in x around 0 85.2%
distribute-lft-out--85.2%
Simplified85.2%
if -1.0499999999999999e-184 < y < -3.8000000000000001e-280Initial program 99.7%
Taylor expanded in y around 0 84.3%
neg-mul-184.3%
Simplified84.3%
add-sqr-sqrt84.2%
associate-/l*84.2%
fabs-neg84.2%
add-sqr-sqrt63.0%
fabs-sqr63.0%
add-sqr-sqrt63.0%
fabs-neg63.0%
add-sqr-sqrt63.0%
fabs-sqr63.0%
add-sqr-sqrt63.0%
Applied egg-rr63.0%
associate-*r/63.0%
rem-square-sqrt67.2%
Simplified67.2%
Taylor expanded in x around 0 67.2%
*-commutative67.2%
Simplified67.2%
if -3.8000000000000001e-280 < y Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt78.8%
fabs-sqr78.8%
add-sqr-sqrt83.1%
frac-2neg83.1%
distribute-frac-neg83.1%
fmm-undef83.1%
*-un-lft-identity83.1%
metadata-eval83.1%
Applied egg-rr83.1%
Taylor expanded in x around 0 83.1%
cancel-sign-sub-inv83.1%
metadata-eval83.1%
distribute-lft-in83.1%
+-commutative83.1%
Simplified83.1%
Final simplification82.5%
(FPCore (x y) :precision binary64 (if (<= x -1.85e-69) (* x 0.5) (if (<= x 4.3e-57) (* y 0.5) (* x 1.5))))
double code(double x, double y) {
double tmp;
if (x <= -1.85e-69) {
tmp = x * 0.5;
} else if (x <= 4.3e-57) {
tmp = y * 0.5;
} else {
tmp = x * 1.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.85d-69)) then
tmp = x * 0.5d0
else if (x <= 4.3d-57) then
tmp = y * 0.5d0
else
tmp = x * 1.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.85e-69) {
tmp = x * 0.5;
} else if (x <= 4.3e-57) {
tmp = y * 0.5;
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.85e-69: tmp = x * 0.5 elif x <= 4.3e-57: tmp = y * 0.5 else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= -1.85e-69) tmp = Float64(x * 0.5); elseif (x <= 4.3e-57) tmp = Float64(y * 0.5); else tmp = Float64(x * 1.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.85e-69) tmp = x * 0.5; elseif (x <= 4.3e-57) tmp = y * 0.5; else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.85e-69], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 4.3e-57], N[(y * 0.5), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{-69}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{-57}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -1.8500000000000001e-69Initial program 100.0%
*-un-lft-identity100.0%
fma-define100.0%
add-sqr-sqrt90.8%
fabs-sqr90.8%
add-sqr-sqrt91.6%
frac-2neg91.6%
distribute-frac-neg91.6%
fmm-undef91.6%
*-un-lft-identity91.6%
metadata-eval91.6%
Applied egg-rr91.6%
Taylor expanded in x around inf 79.5%
if -1.8500000000000001e-69 < x < 4.30000000000000022e-57Initial program 100.0%
*-un-lft-identity100.0%
fma-define100.0%
add-sqr-sqrt50.0%
fabs-sqr50.0%
add-sqr-sqrt52.0%
frac-2neg52.0%
distribute-frac-neg52.0%
fmm-undef52.0%
*-un-lft-identity52.0%
metadata-eval52.0%
Applied egg-rr52.0%
Taylor expanded in x around 0 43.2%
if 4.30000000000000022e-57 < x Initial program 99.8%
Taylor expanded in y around 0 75.3%
neg-mul-175.3%
Simplified75.3%
add-sqr-sqrt75.2%
associate-/l*75.2%
fabs-neg75.2%
add-sqr-sqrt75.2%
fabs-sqr75.2%
add-sqr-sqrt75.2%
fabs-neg75.2%
add-sqr-sqrt75.2%
fabs-sqr75.2%
add-sqr-sqrt75.2%
Applied egg-rr75.2%
associate-*r/75.2%
rem-square-sqrt75.3%
Simplified75.3%
Taylor expanded in x around 0 75.3%
*-commutative75.3%
Simplified75.3%
Final simplification62.1%
(FPCore (x y) :precision binary64 (if (<= y 5.6e-31) (* x 0.5) (* y 0.5)))
double code(double x, double y) {
double tmp;
if (y <= 5.6e-31) {
tmp = x * 0.5;
} 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 <= 5.6d-31) then
tmp = x * 0.5d0
else
tmp = y * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 5.6e-31) {
tmp = x * 0.5;
} else {
tmp = y * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 5.6e-31: tmp = x * 0.5 else: tmp = y * 0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= 5.6e-31) tmp = Float64(x * 0.5); else tmp = Float64(y * 0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 5.6e-31) tmp = x * 0.5; else tmp = y * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 5.6e-31], N[(x * 0.5), $MachinePrecision], N[(y * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.6 \cdot 10^{-31}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < 5.5999999999999998e-31Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt38.9%
fabs-sqr38.9%
add-sqr-sqrt44.4%
frac-2neg44.4%
distribute-frac-neg44.4%
fmm-undef44.4%
*-un-lft-identity44.4%
metadata-eval44.4%
Applied egg-rr44.4%
Taylor expanded in x around inf 37.6%
if 5.5999999999999998e-31 < y Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt87.6%
fabs-sqr87.6%
add-sqr-sqrt90.4%
frac-2neg90.4%
distribute-frac-neg90.4%
fmm-undef90.4%
*-un-lft-identity90.4%
metadata-eval90.4%
Applied egg-rr90.4%
Taylor expanded in x around 0 80.7%
Final simplification47.7%
(FPCore (x y) :precision binary64 (* x 0.5))
double code(double x, double y) {
return x * 0.5;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * 0.5d0
end function
public static double code(double x, double y) {
return x * 0.5;
}
def code(x, y): return x * 0.5
function code(x, y) return Float64(x * 0.5) end
function tmp = code(x, y) tmp = x * 0.5; end
code[x_, y_] := N[(x * 0.5), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5
\end{array}
Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt50.3%
fabs-sqr50.3%
add-sqr-sqrt55.2%
frac-2neg55.2%
distribute-frac-neg55.2%
fmm-undef55.2%
*-un-lft-identity55.2%
metadata-eval55.2%
Applied egg-rr55.2%
Taylor expanded in x around inf 31.5%
Final simplification31.5%
(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.2%
herbie shell --seed 2024180
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
:precision binary64
(+ x (/ (fabs (- y x)) 2.0)))