
(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 13 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 (- x y)) 2.0)))
double code(double x, double y) {
return x + (fabs((x - y)) / 2.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x + (abs((x - y)) / 2.0d0)
end function
public static double code(double x, double y) {
return x + (Math.abs((x - y)) / 2.0);
}
def code(x, y): return x + (math.fabs((x - y)) / 2.0)
function code(x, y) return Float64(x + Float64(abs(Float64(x - y)) / 2.0)) end
function tmp = code(x, y) tmp = x + (abs((x - y)) / 2.0); end
code[x_, y_] := N[(x + N[(N[Abs[N[(x - y), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left|x - y\right|}{2}
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= y -6e-182) (fma x 1.5 (* y -0.5)) (if (<= y 9.2e-67) (+ x (/ (fabs x) 2.0)) (* 0.5 (+ x y)))))
double code(double x, double y) {
double tmp;
if (y <= -6e-182) {
tmp = fma(x, 1.5, (y * -0.5));
} else if (y <= 9.2e-67) {
tmp = x + (fabs(x) / 2.0);
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -6e-182) tmp = fma(x, 1.5, Float64(y * -0.5)); elseif (y <= 9.2e-67) tmp = Float64(x + Float64(abs(x) / 2.0)); else tmp = Float64(0.5 * Float64(x + y)); end return tmp end
code[x_, y_] := If[LessEqual[y, -6e-182], N[(x * 1.5 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.2e-67], N[(x + N[(N[Abs[x], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{-182}:\\
\;\;\;\;\mathsf{fma}\left(x, 1.5, y \cdot -0.5\right)\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{-67}:\\
\;\;\;\;x + \frac{\left|x\right|}{2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -6.0000000000000003e-182Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt15.6%
fabs-sqr15.6%
add-sqr-sqrt20.0%
frac-2neg20.0%
distribute-frac-neg20.0%
fmm-undef20.0%
*-un-lft-identity20.0%
metadata-eval20.0%
Applied egg-rr20.0%
*-un-lft-identity20.0%
div-inv20.0%
add-sqr-sqrt15.6%
fabs-sqr15.6%
add-sqr-sqrt99.9%
fabs-sub99.9%
add-sqr-sqrt83.7%
fabs-sqr83.7%
add-sqr-sqrt87.0%
metadata-eval87.0%
Applied egg-rr87.0%
*-lft-identity87.0%
Simplified87.0%
Taylor expanded in x around 0 87.0%
*-commutative87.0%
fmm-def87.1%
distribute-lft-neg-in87.1%
metadata-eval87.1%
*-commutative87.1%
Simplified87.1%
if -6.0000000000000003e-182 < y < 9.2000000000000002e-67Initial program 99.7%
Taylor expanded in y around 0 90.3%
neg-mul-190.3%
Simplified90.3%
if 9.2000000000000002e-67 < y Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt87.3%
fabs-sqr87.3%
add-sqr-sqrt90.1%
frac-2neg90.1%
distribute-frac-neg90.1%
fmm-undef90.1%
*-un-lft-identity90.1%
metadata-eval90.1%
Applied egg-rr90.1%
Taylor expanded in x around 0 90.1%
cancel-sign-sub-inv90.1%
metadata-eval90.1%
distribute-lft-out90.1%
Simplified90.1%
Final simplification89.1%
(FPCore (x y) :precision binary64 (if (<= x -1.9e-111) (* 0.5 (+ x y)) (if (<= x 5.5e-35) (+ x (/ (fabs y) 2.0)) (fma x 1.5 (* y -0.5)))))
double code(double x, double y) {
double tmp;
if (x <= -1.9e-111) {
tmp = 0.5 * (x + y);
} else if (x <= 5.5e-35) {
tmp = x + (fabs(y) / 2.0);
} else {
tmp = fma(x, 1.5, (y * -0.5));
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -1.9e-111) tmp = Float64(0.5 * Float64(x + y)); elseif (x <= 5.5e-35) tmp = Float64(x + Float64(abs(y) / 2.0)); else tmp = fma(x, 1.5, Float64(y * -0.5)); end return tmp end
code[x_, y_] := If[LessEqual[x, -1.9e-111], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.5e-35], N[(x + N[(N[Abs[y], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(x * 1.5 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{-111}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-35}:\\
\;\;\;\;x + \frac{\left|y\right|}{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, 1.5, y \cdot -0.5\right)\\
\end{array}
\end{array}
if x < -1.90000000000000011e-111Initial program 100.0%
*-un-lft-identity100.0%
fma-define100.0%
add-sqr-sqrt83.2%
fabs-sqr83.2%
add-sqr-sqrt84.0%
frac-2neg84.0%
distribute-frac-neg84.0%
fmm-undef84.0%
*-un-lft-identity84.0%
metadata-eval84.0%
Applied egg-rr84.0%
Taylor expanded in x around 0 84.0%
cancel-sign-sub-inv84.0%
metadata-eval84.0%
distribute-lft-out84.0%
Simplified84.0%
if -1.90000000000000011e-111 < x < 5.4999999999999997e-35Initial program 99.9%
Taylor expanded in y around inf 81.9%
if 5.4999999999999997e-35 < x Initial program 99.7%
*-un-lft-identity99.7%
fma-define99.7%
add-sqr-sqrt14.4%
fabs-sqr14.4%
add-sqr-sqrt27.7%
frac-2neg27.7%
distribute-frac-neg27.7%
fmm-undef27.7%
*-un-lft-identity27.7%
metadata-eval27.7%
Applied egg-rr27.7%
*-un-lft-identity27.7%
div-inv27.7%
add-sqr-sqrt14.4%
fabs-sqr14.4%
add-sqr-sqrt99.7%
fabs-sub99.7%
add-sqr-sqrt85.0%
fabs-sqr85.0%
add-sqr-sqrt85.3%
metadata-eval85.3%
Applied egg-rr85.3%
*-lft-identity85.3%
Simplified85.3%
Taylor expanded in x around 0 85.3%
*-commutative85.3%
fmm-def85.6%
distribute-lft-neg-in85.6%
metadata-eval85.6%
*-commutative85.6%
Simplified85.6%
(FPCore (x y) :precision binary64 (if (<= x -2.8e-111) (* 0.5 (+ x y)) (if (<= x 4.2e-35) (+ x (/ (fabs y) 2.0)) (- (* x 1.5) (* y 0.5)))))
double code(double x, double y) {
double tmp;
if (x <= -2.8e-111) {
tmp = 0.5 * (x + y);
} else if (x <= 4.2e-35) {
tmp = x + (fabs(y) / 2.0);
} else {
tmp = (x * 1.5) - (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 (x <= (-2.8d-111)) then
tmp = 0.5d0 * (x + y)
else if (x <= 4.2d-35) then
tmp = x + (abs(y) / 2.0d0)
else
tmp = (x * 1.5d0) - (y * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -2.8e-111) {
tmp = 0.5 * (x + y);
} else if (x <= 4.2e-35) {
tmp = x + (Math.abs(y) / 2.0);
} else {
tmp = (x * 1.5) - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -2.8e-111: tmp = 0.5 * (x + y) elif x <= 4.2e-35: tmp = x + (math.fabs(y) / 2.0) else: tmp = (x * 1.5) - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if (x <= -2.8e-111) tmp = Float64(0.5 * Float64(x + y)); elseif (x <= 4.2e-35) tmp = Float64(x + Float64(abs(y) / 2.0)); else tmp = Float64(Float64(x * 1.5) - Float64(y * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -2.8e-111) tmp = 0.5 * (x + y); elseif (x <= 4.2e-35) tmp = x + (abs(y) / 2.0); else tmp = (x * 1.5) - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -2.8e-111], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.2e-35], N[(x + N[(N[Abs[y], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * 1.5), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{-111}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-35}:\\
\;\;\;\;x + \frac{\left|y\right|}{2}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -2.79999999999999995e-111Initial program 100.0%
*-un-lft-identity100.0%
fma-define100.0%
add-sqr-sqrt83.2%
fabs-sqr83.2%
add-sqr-sqrt84.0%
frac-2neg84.0%
distribute-frac-neg84.0%
fmm-undef84.0%
*-un-lft-identity84.0%
metadata-eval84.0%
Applied egg-rr84.0%
Taylor expanded in x around 0 84.0%
cancel-sign-sub-inv84.0%
metadata-eval84.0%
distribute-lft-out84.0%
Simplified84.0%
if -2.79999999999999995e-111 < x < 4.2e-35Initial program 99.9%
Taylor expanded in y around inf 81.9%
if 4.2e-35 < x Initial program 99.7%
*-un-lft-identity99.7%
fma-define99.7%
add-sqr-sqrt14.4%
fabs-sqr14.4%
add-sqr-sqrt27.7%
frac-2neg27.7%
distribute-frac-neg27.7%
fmm-undef27.7%
*-un-lft-identity27.7%
metadata-eval27.7%
Applied egg-rr27.7%
*-un-lft-identity27.7%
div-inv27.7%
add-sqr-sqrt14.4%
fabs-sqr14.4%
add-sqr-sqrt99.7%
fabs-sub99.7%
add-sqr-sqrt85.0%
fabs-sqr85.0%
add-sqr-sqrt85.3%
metadata-eval85.3%
Applied egg-rr85.3%
*-lft-identity85.3%
Simplified85.3%
Taylor expanded in x around 0 85.3%
Final simplification83.6%
(FPCore (x y) :precision binary64 (if (<= y -3.15e-164) (- x (* y 0.5)) (if (<= y 9e-213) (* x 1.5) (* 0.5 (+ x y)))))
double code(double x, double y) {
double tmp;
if (y <= -3.15e-164) {
tmp = x - (y * 0.5);
} else if (y <= 9e-213) {
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 <= (-3.15d-164)) then
tmp = x - (y * 0.5d0)
else if (y <= 9d-213) 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 <= -3.15e-164) {
tmp = x - (y * 0.5);
} else if (y <= 9e-213) {
tmp = x * 1.5;
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.15e-164: tmp = x - (y * 0.5) elif y <= 9e-213: tmp = x * 1.5 else: tmp = 0.5 * (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= -3.15e-164) tmp = Float64(x - Float64(y * 0.5)); elseif (y <= 9e-213) 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 <= -3.15e-164) tmp = x - (y * 0.5); elseif (y <= 9e-213) tmp = x * 1.5; else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.15e-164], N[(x - N[(y * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e-213], N[(x * 1.5), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.15 \cdot 10^{-164}:\\
\;\;\;\;x - y \cdot 0.5\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-213}:\\
\;\;\;\;x \cdot 1.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -3.15000000000000004e-164Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt16.7%
fabs-sqr16.7%
add-sqr-sqrt20.5%
frac-2neg20.5%
distribute-frac-neg20.5%
fmm-undef20.5%
*-un-lft-identity20.5%
metadata-eval20.5%
Applied egg-rr20.5%
*-un-lft-identity20.5%
div-inv20.5%
add-sqr-sqrt16.7%
fabs-sqr16.7%
add-sqr-sqrt99.9%
fabs-sub99.9%
add-sqr-sqrt82.5%
fabs-sqr82.5%
add-sqr-sqrt86.0%
metadata-eval86.0%
Applied egg-rr86.0%
*-lft-identity86.0%
Simplified86.0%
Taylor expanded in x around 0 70.2%
if -3.15000000000000004e-164 < y < 9.0000000000000002e-213Initial program 99.7%
*-un-lft-identity99.7%
fma-define99.7%
add-sqr-sqrt38.5%
fabs-sqr38.5%
add-sqr-sqrt48.7%
frac-2neg48.7%
distribute-frac-neg48.7%
fmm-undef48.7%
*-un-lft-identity48.7%
metadata-eval48.7%
Applied egg-rr48.7%
*-un-lft-identity48.7%
div-inv48.7%
add-sqr-sqrt38.5%
fabs-sqr38.5%
add-sqr-sqrt99.7%
fabs-sub99.7%
add-sqr-sqrt60.7%
fabs-sqr60.7%
add-sqr-sqrt67.3%
metadata-eval67.3%
Applied egg-rr67.3%
*-lft-identity67.3%
Simplified67.3%
Taylor expanded in x around inf 60.1%
*-commutative60.1%
Simplified60.1%
if 9.0000000000000002e-213 < y Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt79.3%
fabs-sqr79.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-out83.4%
Simplified83.4%
Final simplification74.2%
(FPCore (x y) :precision binary64 (if (<= y -1.12e-152) (* y -0.5) (if (<= y 5.8e-213) (* x 1.5) (* 0.5 (+ x y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.12e-152) {
tmp = y * -0.5;
} else if (y <= 5.8e-213) {
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.12d-152)) then
tmp = y * (-0.5d0)
else if (y <= 5.8d-213) 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.12e-152) {
tmp = y * -0.5;
} else if (y <= 5.8e-213) {
tmp = x * 1.5;
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.12e-152: tmp = y * -0.5 elif y <= 5.8e-213: tmp = x * 1.5 else: tmp = 0.5 * (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.12e-152) tmp = Float64(y * -0.5); elseif (y <= 5.8e-213) 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.12e-152) tmp = y * -0.5; elseif (y <= 5.8e-213) tmp = x * 1.5; else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.12e-152], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 5.8e-213], N[(x * 1.5), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.12 \cdot 10^{-152}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-213}:\\
\;\;\;\;x \cdot 1.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -1.12e-152Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt14.7%
fabs-sqr14.7%
add-sqr-sqrt18.5%
frac-2neg18.5%
distribute-frac-neg18.5%
fmm-undef18.5%
*-un-lft-identity18.5%
metadata-eval18.5%
Applied egg-rr18.5%
*-un-lft-identity18.5%
div-inv18.5%
add-sqr-sqrt14.7%
fabs-sqr14.7%
add-sqr-sqrt99.9%
fabs-sub99.9%
add-sqr-sqrt84.5%
fabs-sqr84.5%
add-sqr-sqrt87.7%
metadata-eval87.7%
Applied egg-rr87.7%
*-lft-identity87.7%
Simplified87.7%
Taylor expanded in x around 0 66.2%
*-commutative66.2%
Simplified66.2%
if -1.12e-152 < y < 5.7999999999999999e-213Initial program 99.7%
*-un-lft-identity99.7%
fma-define99.7%
add-sqr-sqrt40.6%
fabs-sqr40.6%
add-sqr-sqrt50.5%
frac-2neg50.5%
distribute-frac-neg50.5%
fmm-undef50.5%
*-un-lft-identity50.5%
metadata-eval50.5%
Applied egg-rr50.5%
*-un-lft-identity50.5%
div-inv50.5%
add-sqr-sqrt40.6%
fabs-sqr40.6%
add-sqr-sqrt99.7%
fabs-sub99.7%
add-sqr-sqrt58.6%
fabs-sqr58.6%
add-sqr-sqrt65.5%
metadata-eval65.5%
Applied egg-rr65.5%
*-lft-identity65.5%
Simplified65.5%
Taylor expanded in x around inf 58.6%
*-commutative58.6%
Simplified58.6%
if 5.7999999999999999e-213 < y Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt79.3%
fabs-sqr79.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-out83.4%
Simplified83.4%
(FPCore (x y) :precision binary64 (if (<= y -3.1e-154) (* y -0.5) (if (<= y 8.2e-63) (* x 1.5) (* y 0.5))))
double code(double x, double y) {
double tmp;
if (y <= -3.1e-154) {
tmp = y * -0.5;
} else if (y <= 8.2e-63) {
tmp = x * 1.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 <= (-3.1d-154)) then
tmp = y * (-0.5d0)
else if (y <= 8.2d-63) then
tmp = x * 1.5d0
else
tmp = y * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.1e-154) {
tmp = y * -0.5;
} else if (y <= 8.2e-63) {
tmp = x * 1.5;
} else {
tmp = y * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.1e-154: tmp = y * -0.5 elif y <= 8.2e-63: tmp = x * 1.5 else: tmp = y * 0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.1e-154) tmp = Float64(y * -0.5); elseif (y <= 8.2e-63) tmp = Float64(x * 1.5); else tmp = Float64(y * 0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.1e-154) tmp = y * -0.5; elseif (y <= 8.2e-63) tmp = x * 1.5; else tmp = y * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.1e-154], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 8.2e-63], N[(x * 1.5), $MachinePrecision], N[(y * 0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{-154}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-63}:\\
\;\;\;\;x \cdot 1.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < -3.09999999999999982e-154Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt14.7%
fabs-sqr14.7%
add-sqr-sqrt18.5%
frac-2neg18.5%
distribute-frac-neg18.5%
fmm-undef18.5%
*-un-lft-identity18.5%
metadata-eval18.5%
Applied egg-rr18.5%
*-un-lft-identity18.5%
div-inv18.5%
add-sqr-sqrt14.7%
fabs-sqr14.7%
add-sqr-sqrt99.9%
fabs-sub99.9%
add-sqr-sqrt84.5%
fabs-sqr84.5%
add-sqr-sqrt87.7%
metadata-eval87.7%
Applied egg-rr87.7%
*-lft-identity87.7%
Simplified87.7%
Taylor expanded in x around 0 66.2%
*-commutative66.2%
Simplified66.2%
if -3.09999999999999982e-154 < y < 8.1999999999999995e-63Initial program 99.8%
*-un-lft-identity99.8%
fma-define99.8%
add-sqr-sqrt46.1%
fabs-sqr46.1%
add-sqr-sqrt55.3%
frac-2neg55.3%
distribute-frac-neg55.3%
fmm-undef55.3%
*-un-lft-identity55.3%
metadata-eval55.3%
Applied egg-rr55.3%
*-un-lft-identity55.3%
div-inv55.3%
add-sqr-sqrt46.1%
fabs-sqr46.1%
add-sqr-sqrt99.8%
fabs-sub99.8%
add-sqr-sqrt53.2%
fabs-sqr53.2%
add-sqr-sqrt60.7%
metadata-eval60.7%
Applied egg-rr60.7%
*-lft-identity60.7%
Simplified60.7%
Taylor expanded in x around inf 55.8%
*-commutative55.8%
Simplified55.8%
if 8.1999999999999995e-63 < y Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt87.0%
fabs-sqr87.0%
add-sqr-sqrt89.8%
frac-2neg89.8%
distribute-frac-neg89.8%
fmm-undef89.8%
*-un-lft-identity89.8%
metadata-eval89.8%
Applied egg-rr89.8%
Taylor expanded in x around 0 78.4%
Final simplification67.0%
(FPCore (x y) :precision binary64 (if (<= x -2.2e-32) (* x 0.5) (if (<= x 3e-130) (* y 0.5) (* x 1.5))))
double code(double x, double y) {
double tmp;
if (x <= -2.2e-32) {
tmp = x * 0.5;
} else if (x <= 3e-130) {
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 <= (-2.2d-32)) then
tmp = x * 0.5d0
else if (x <= 3d-130) 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 <= -2.2e-32) {
tmp = x * 0.5;
} else if (x <= 3e-130) {
tmp = y * 0.5;
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -2.2e-32: tmp = x * 0.5 elif x <= 3e-130: tmp = y * 0.5 else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= -2.2e-32) tmp = Float64(x * 0.5); elseif (x <= 3e-130) 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 <= -2.2e-32) tmp = x * 0.5; elseif (x <= 3e-130) tmp = y * 0.5; else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -2.2e-32], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 3e-130], N[(y * 0.5), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-32}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-130}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -2.2e-32Initial program 100.0%
*-un-lft-identity100.0%
fma-define100.0%
add-sqr-sqrt83.4%
fabs-sqr83.4%
add-sqr-sqrt84.1%
frac-2neg84.1%
distribute-frac-neg84.1%
fmm-undef84.1%
*-un-lft-identity84.1%
metadata-eval84.1%
Applied egg-rr84.1%
Taylor expanded in x around inf 65.7%
if -2.2e-32 < x < 2.99999999999999986e-130Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt59.1%
fabs-sqr59.1%
add-sqr-sqrt61.1%
frac-2neg61.1%
distribute-frac-neg61.1%
fmm-undef61.1%
*-un-lft-identity61.1%
metadata-eval61.1%
Applied egg-rr61.1%
Taylor expanded in x around 0 49.4%
if 2.99999999999999986e-130 < x Initial program 99.8%
*-un-lft-identity99.8%
fma-define99.8%
add-sqr-sqrt19.2%
fabs-sqr19.2%
add-sqr-sqrt30.7%
frac-2neg30.7%
distribute-frac-neg30.7%
fmm-undef30.7%
*-un-lft-identity30.7%
metadata-eval30.7%
Applied egg-rr30.7%
*-un-lft-identity30.7%
div-inv30.7%
add-sqr-sqrt19.2%
fabs-sqr19.2%
add-sqr-sqrt99.8%
fabs-sub99.8%
add-sqr-sqrt80.0%
fabs-sqr80.0%
add-sqr-sqrt80.5%
metadata-eval80.5%
Applied egg-rr80.5%
*-lft-identity80.5%
Simplified80.5%
Taylor expanded in x around inf 63.2%
*-commutative63.2%
Simplified63.2%
Final simplification59.1%
(FPCore (x y) :precision binary64 (if (<= y 7e-213) (- (* x 1.5) (* y 0.5)) (* 0.5 (+ x y))))
double code(double x, double y) {
double tmp;
if (y <= 7e-213) {
tmp = (x * 1.5) - (y * 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) :: tmp
if (y <= 7d-213) then
tmp = (x * 1.5d0) - (y * 0.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 <= 7e-213) {
tmp = (x * 1.5) - (y * 0.5);
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 7e-213: tmp = (x * 1.5) - (y * 0.5) else: tmp = 0.5 * (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= 7e-213) tmp = Float64(Float64(x * 1.5) - Float64(y * 0.5)); else tmp = Float64(0.5 * Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 7e-213) tmp = (x * 1.5) - (y * 0.5); else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 7e-213], N[(N[(x * 1.5), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7 \cdot 10^{-213}:\\
\;\;\;\;x \cdot 1.5 - y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < 7.00000000000000034e-213Initial program 99.8%
*-un-lft-identity99.8%
fma-define99.8%
add-sqr-sqrt25.3%
fabs-sqr25.3%
add-sqr-sqrt31.6%
frac-2neg31.6%
distribute-frac-neg31.6%
fmm-undef31.6%
*-un-lft-identity31.6%
metadata-eval31.6%
Applied egg-rr31.6%
*-un-lft-identity31.6%
div-inv31.6%
add-sqr-sqrt25.3%
fabs-sqr25.3%
add-sqr-sqrt99.8%
fabs-sub99.8%
add-sqr-sqrt73.9%
fabs-sqr73.9%
add-sqr-sqrt78.7%
metadata-eval78.7%
Applied egg-rr78.7%
*-lft-identity78.7%
Simplified78.7%
Taylor expanded in x around 0 78.7%
if 7.00000000000000034e-213 < y Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt79.3%
fabs-sqr79.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-out83.4%
Simplified83.4%
Final simplification80.9%
(FPCore (x y) :precision binary64 (if (<= y 7e-213) (+ x (* -0.5 (- y x))) (* 0.5 (+ x y))))
double code(double x, double y) {
double tmp;
if (y <= 7e-213) {
tmp = x + (-0.5 * (y - x));
} 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 <= 7d-213) then
tmp = x + ((-0.5d0) * (y - x))
else
tmp = 0.5d0 * (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 7e-213) {
tmp = x + (-0.5 * (y - x));
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 7e-213: tmp = x + (-0.5 * (y - x)) else: tmp = 0.5 * (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= 7e-213) tmp = Float64(x + Float64(-0.5 * Float64(y - x))); else tmp = Float64(0.5 * Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 7e-213) tmp = x + (-0.5 * (y - x)); else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 7e-213], N[(x + N[(-0.5 * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7 \cdot 10^{-213}:\\
\;\;\;\;x + -0.5 \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < 7.00000000000000034e-213Initial program 99.8%
*-un-lft-identity99.8%
fma-define99.8%
add-sqr-sqrt25.3%
fabs-sqr25.3%
add-sqr-sqrt31.6%
frac-2neg31.6%
distribute-frac-neg31.6%
fmm-undef31.6%
*-un-lft-identity31.6%
metadata-eval31.6%
Applied egg-rr31.6%
*-un-lft-identity31.6%
div-inv31.6%
add-sqr-sqrt25.3%
fabs-sqr25.3%
add-sqr-sqrt99.8%
fabs-sub99.8%
add-sqr-sqrt73.9%
fabs-sqr73.9%
add-sqr-sqrt78.7%
metadata-eval78.7%
Applied egg-rr78.7%
*-lft-identity78.7%
Simplified78.7%
if 7.00000000000000034e-213 < y Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt79.3%
fabs-sqr79.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-out83.4%
Simplified83.4%
Final simplification80.9%
(FPCore (x y) :precision binary64 (if (<= y 9.2e-63) (* x 0.5) (* y 0.5)))
double code(double x, double y) {
double tmp;
if (y <= 9.2e-63) {
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 <= 9.2d-63) 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 <= 9.2e-63) {
tmp = x * 0.5;
} else {
tmp = y * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 9.2e-63: tmp = x * 0.5 else: tmp = y * 0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= 9.2e-63) 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 <= 9.2e-63) tmp = x * 0.5; else tmp = y * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 9.2e-63], N[(x * 0.5), $MachinePrecision], N[(y * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.2 \cdot 10^{-63}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < 9.2e-63Initial program 99.8%
*-un-lft-identity99.8%
fma-define99.8%
add-sqr-sqrt30.9%
fabs-sqr30.9%
add-sqr-sqrt37.5%
frac-2neg37.5%
distribute-frac-neg37.5%
fmm-undef37.5%
*-un-lft-identity37.5%
metadata-eval37.5%
Applied egg-rr37.5%
Taylor expanded in x around inf 35.1%
if 9.2e-63 < y Initial program 99.9%
*-un-lft-identity99.9%
fma-define99.9%
add-sqr-sqrt87.0%
fabs-sqr87.0%
add-sqr-sqrt89.8%
frac-2neg89.8%
distribute-frac-neg89.8%
fmm-undef89.8%
*-un-lft-identity89.8%
metadata-eval89.8%
Applied egg-rr89.8%
Taylor expanded in x around 0 78.4%
Final simplification50.2%
(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.4%
fabs-sqr50.4%
add-sqr-sqrt55.7%
frac-2neg55.7%
distribute-frac-neg55.7%
fmm-undef55.7%
*-un-lft-identity55.7%
metadata-eval55.7%
Applied egg-rr55.7%
Taylor expanded in x around inf 27.5%
Final simplification27.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.0%
herbie shell --seed 2024172
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
:precision binary64
(+ x (/ (fabs (- y x)) 2.0)))