
(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 10 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 100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (<= y -1.1e-198) (+ (* y -0.5) (* x 1.5)) (if (<= y 1.25e-99) (+ x (/ (fabs x) 2.0)) (* 0.5 (+ x y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.1e-198) {
tmp = (y * -0.5) + (x * 1.5);
} else if (y <= 1.25e-99) {
tmp = x + (fabs(x) / 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 <= (-1.1d-198)) then
tmp = (y * (-0.5d0)) + (x * 1.5d0)
else if (y <= 1.25d-99) then
tmp = x + (abs(x) / 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 <= -1.1e-198) {
tmp = (y * -0.5) + (x * 1.5);
} else if (y <= 1.25e-99) {
tmp = x + (Math.abs(x) / 2.0);
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.1e-198: tmp = (y * -0.5) + (x * 1.5) elif y <= 1.25e-99: tmp = x + (math.fabs(x) / 2.0) else: tmp = 0.5 * (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.1e-198) tmp = Float64(Float64(y * -0.5) + Float64(x * 1.5)); elseif (y <= 1.25e-99) tmp = Float64(x + Float64(abs(x) / 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 <= -1.1e-198) tmp = (y * -0.5) + (x * 1.5); elseif (y <= 1.25e-99) tmp = x + (abs(x) / 2.0); else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.1e-198], N[(N[(y * -0.5), $MachinePrecision] + N[(x * 1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e-99], 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 -1.1 \cdot 10^{-198}:\\
\;\;\;\;y \cdot -0.5 + x \cdot 1.5\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{-99}:\\
\;\;\;\;x + \frac{\left|x\right|}{2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -1.1e-198Initial program 99.9%
Taylor expanded in y around inf 90.8%
mul-1-neg90.8%
unsub-neg90.8%
Simplified90.8%
add-sqr-sqrt14.2%
fabs-sqr14.2%
add-sqr-sqrt18.0%
div-inv17.9%
cancel-sign-sub-inv17.9%
add-sqr-sqrt14.4%
sqrt-unprod18.0%
sqr-neg18.0%
sqrt-unprod17.9%
add-sqr-sqrt21.0%
div-inv21.0%
flip-+14.2%
associate-*r/11.4%
Applied egg-rr11.5%
distribute-lft-in11.5%
*-rgt-identity11.5%
unpow211.5%
associate-*r*13.7%
*-commutative13.7%
associate-*l/11.7%
associate-/l*13.7%
*-inverses13.7%
*-rgt-identity13.7%
Simplified13.7%
Taylor expanded in y around 0 85.1%
+-commutative85.1%
*-commutative85.1%
associate-+l+85.1%
*-commutative85.1%
*-commutative85.1%
distribute-lft1-in85.1%
metadata-eval85.1%
*-commutative85.1%
Simplified85.1%
if -1.1e-198 < y < 1.24999999999999992e-99Initial program 100.0%
Taylor expanded in y around 0 89.5%
neg-mul-189.5%
Simplified89.5%
if 1.24999999999999992e-99 < y Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt78.9%
fabs-sqr78.9%
rem-square-sqrt83.1%
Simplified83.1%
Taylor expanded in x around 0 83.1%
+-commutative83.1%
distribute-lft-in83.1%
Simplified83.1%
Final simplification85.7%
(FPCore (x y) :precision binary64 (if (<= x -2.4e+59) (* 0.5 (+ x y)) (if (<= x 5.8e-87) (+ x (/ (fabs y) 2.0)) (+ (* y -0.5) (* x 1.5)))))
double code(double x, double y) {
double tmp;
if (x <= -2.4e+59) {
tmp = 0.5 * (x + y);
} else if (x <= 5.8e-87) {
tmp = x + (fabs(y) / 2.0);
} else {
tmp = (y * -0.5) + (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.4d+59)) then
tmp = 0.5d0 * (x + y)
else if (x <= 5.8d-87) then
tmp = x + (abs(y) / 2.0d0)
else
tmp = (y * (-0.5d0)) + (x * 1.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -2.4e+59) {
tmp = 0.5 * (x + y);
} else if (x <= 5.8e-87) {
tmp = x + (Math.abs(y) / 2.0);
} else {
tmp = (y * -0.5) + (x * 1.5);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -2.4e+59: tmp = 0.5 * (x + y) elif x <= 5.8e-87: tmp = x + (math.fabs(y) / 2.0) else: tmp = (y * -0.5) + (x * 1.5) return tmp
function code(x, y) tmp = 0.0 if (x <= -2.4e+59) tmp = Float64(0.5 * Float64(x + y)); elseif (x <= 5.8e-87) tmp = Float64(x + Float64(abs(y) / 2.0)); else tmp = Float64(Float64(y * -0.5) + Float64(x * 1.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -2.4e+59) tmp = 0.5 * (x + y); elseif (x <= 5.8e-87) tmp = x + (abs(y) / 2.0); else tmp = (y * -0.5) + (x * 1.5); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -2.4e+59], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.8e-87], N[(x + N[(N[Abs[y], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y * -0.5), $MachinePrecision] + N[(x * 1.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+59}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-87}:\\
\;\;\;\;x + \frac{\left|y\right|}{2}\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5 + x \cdot 1.5\\
\end{array}
\end{array}
if x < -2.4000000000000002e59Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt91.8%
fabs-sqr91.8%
rem-square-sqrt92.6%
Simplified92.6%
Taylor expanded in x around 0 92.6%
+-commutative92.6%
distribute-lft-in92.6%
Simplified92.6%
if -2.4000000000000002e59 < x < 5.7999999999999998e-87Initial program 100.0%
Taylor expanded in y around inf 79.5%
if 5.7999999999999998e-87 < x Initial program 99.9%
Taylor expanded in y around inf 78.5%
mul-1-neg78.5%
unsub-neg78.5%
Simplified78.5%
add-sqr-sqrt16.0%
fabs-sqr16.0%
add-sqr-sqrt24.6%
div-inv24.6%
cancel-sign-sub-inv24.6%
add-sqr-sqrt0.0%
sqrt-unprod39.5%
sqr-neg39.5%
sqrt-unprod64.0%
add-sqr-sqrt64.1%
div-inv64.1%
flip-+41.8%
associate-*r/32.2%
Applied egg-rr32.5%
distribute-lft-in32.5%
*-rgt-identity32.5%
unpow232.5%
associate-*r*39.2%
*-commutative39.2%
associate-*l/27.7%
associate-/l*39.2%
*-inverses39.2%
*-rgt-identity39.2%
Simplified39.2%
Taylor expanded in y around 0 83.9%
+-commutative83.9%
*-commutative83.9%
associate-+l+83.9%
*-commutative83.9%
*-commutative83.9%
distribute-lft1-in83.9%
metadata-eval83.9%
*-commutative83.9%
Simplified83.9%
Final simplification83.8%
(FPCore (x y) :precision binary64 (if (<= x -4.8e-201) (* x 0.5) (if (<= x 1.75e-84) (* y 0.5) (* x 1.5))))
double code(double x, double y) {
double tmp;
if (x <= -4.8e-201) {
tmp = x * 0.5;
} else if (x <= 1.75e-84) {
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 <= (-4.8d-201)) then
tmp = x * 0.5d0
else if (x <= 1.75d-84) 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 <= -4.8e-201) {
tmp = x * 0.5;
} else if (x <= 1.75e-84) {
tmp = y * 0.5;
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.8e-201: tmp = x * 0.5 elif x <= 1.75e-84: tmp = y * 0.5 else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= -4.8e-201) tmp = Float64(x * 0.5); elseif (x <= 1.75e-84) 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 <= -4.8e-201) tmp = x * 0.5; elseif (x <= 1.75e-84) tmp = y * 0.5; else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.8e-201], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 1.75e-84], N[(y * 0.5), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-201}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-84}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -4.80000000000000018e-201Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt76.8%
fabs-sqr76.8%
rem-square-sqrt77.6%
Simplified77.6%
Taylor expanded in x around inf 63.6%
if -4.80000000000000018e-201 < x < 1.7500000000000001e-84Initial program 99.9%
Taylor expanded in y around -inf 99.9%
fabs-neg99.9%
mul-1-neg99.9%
sub-neg99.9%
fabs-sub99.9%
rem-square-sqrt47.1%
fabs-sqr47.1%
rem-square-sqrt50.4%
Simplified50.4%
Taylor expanded in x around 0 46.0%
if 1.7500000000000001e-84 < x Initial program 99.9%
Taylor expanded in y around 0 71.1%
neg-mul-171.1%
Simplified71.1%
Taylor expanded in x around 0 71.1%
+-commutative71.1%
fma-define71.1%
fabs-neg71.1%
rem-square-sqrt71.0%
fabs-sqr71.0%
rem-square-sqrt71.1%
fma-define71.1%
*-lft-identity71.1%
distribute-rgt-out71.1%
metadata-eval71.1%
Simplified71.1%
Final simplification60.9%
(FPCore (x y) :precision binary64 (if (<= y -3.7e-227) (+ (* y -0.5) (* x 1.5)) (* 0.5 (+ x y))))
double code(double x, double y) {
double tmp;
if (y <= -3.7e-227) {
tmp = (y * -0.5) + (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.7d-227)) then
tmp = (y * (-0.5d0)) + (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.7e-227) {
tmp = (y * -0.5) + (x * 1.5);
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.7e-227: tmp = (y * -0.5) + (x * 1.5) else: tmp = 0.5 * (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= -3.7e-227) tmp = Float64(Float64(y * -0.5) + 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.7e-227) tmp = (y * -0.5) + (x * 1.5); else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.7e-227], N[(N[(y * -0.5), $MachinePrecision] + N[(x * 1.5), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{-227}:\\
\;\;\;\;y \cdot -0.5 + x \cdot 1.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -3.69999999999999978e-227Initial program 99.9%
Taylor expanded in y around inf 86.9%
mul-1-neg86.9%
unsub-neg86.9%
Simplified86.9%
add-sqr-sqrt14.3%
fabs-sqr14.3%
add-sqr-sqrt18.4%
div-inv18.4%
cancel-sign-sub-inv18.4%
add-sqr-sqrt14.5%
sqrt-unprod20.2%
sqr-neg20.2%
sqrt-unprod20.3%
add-sqr-sqrt23.5%
div-inv23.5%
flip-+14.7%
associate-*r/12.3%
Applied egg-rr12.3%
distribute-lft-in12.3%
*-rgt-identity12.3%
unpow212.3%
associate-*r*15.9%
*-commutative15.9%
associate-*l/12.7%
associate-/l*15.9%
*-inverses15.9%
*-rgt-identity15.9%
Simplified15.9%
Taylor expanded in y around 0 83.9%
+-commutative83.9%
*-commutative83.9%
associate-+l+83.9%
*-commutative83.9%
*-commutative83.9%
distribute-lft1-in83.9%
metadata-eval83.9%
*-commutative83.9%
Simplified83.9%
if -3.69999999999999978e-227 < y Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt71.2%
fabs-sqr71.2%
rem-square-sqrt76.7%
Simplified76.7%
Taylor expanded in x around 0 76.7%
+-commutative76.7%
distribute-lft-in76.7%
Simplified76.7%
Final simplification80.0%
(FPCore (x y) :precision binary64 (if (<= y -3.7e-227) (+ x (/ (- x y) 2.0)) (* 0.5 (+ x y))))
double code(double x, double y) {
double tmp;
if (y <= -3.7e-227) {
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 <= (-3.7d-227)) 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 <= -3.7e-227) {
tmp = x + ((x - y) / 2.0);
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.7e-227: tmp = x + ((x - y) / 2.0) else: tmp = 0.5 * (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= -3.7e-227) 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 <= -3.7e-227) tmp = x + ((x - y) / 2.0); else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.7e-227], 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 -3.7 \cdot 10^{-227}:\\
\;\;\;\;x + \frac{x - y}{2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -3.69999999999999978e-227Initial program 99.9%
Taylor expanded in y around inf 86.9%
mul-1-neg86.9%
unsub-neg86.9%
Simplified86.9%
add-sqr-sqrt14.3%
fabs-sqr14.3%
add-sqr-sqrt18.4%
div-inv18.4%
cancel-sign-sub-inv18.4%
add-sqr-sqrt14.5%
sqrt-unprod20.2%
sqr-neg20.2%
sqrt-unprod20.3%
add-sqr-sqrt23.5%
div-inv23.5%
flip-+14.7%
associate-*r/12.3%
Applied egg-rr12.3%
distribute-lft-in12.3%
*-rgt-identity12.3%
unpow212.3%
associate-*r*15.9%
*-commutative15.9%
associate-*l/12.7%
associate-/l*15.9%
*-inverses15.9%
*-rgt-identity15.9%
Simplified15.9%
Taylor expanded in y around 0 83.9%
neg-mul-183.9%
unsub-neg83.9%
Simplified83.9%
if -3.69999999999999978e-227 < y Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt71.2%
fabs-sqr71.2%
rem-square-sqrt76.7%
Simplified76.7%
Taylor expanded in x around 0 76.7%
+-commutative76.7%
distribute-lft-in76.7%
Simplified76.7%
Final simplification80.0%
(FPCore (x y) :precision binary64 (if (<= x 7.2e-81) (* 0.5 (+ x y)) (* x 1.5)))
double code(double x, double y) {
double tmp;
if (x <= 7.2e-81) {
tmp = 0.5 * (x + y);
} 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 <= 7.2d-81) then
tmp = 0.5d0 * (x + y)
else
tmp = x * 1.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 7.2e-81) {
tmp = 0.5 * (x + y);
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 7.2e-81: tmp = 0.5 * (x + y) else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= 7.2e-81) tmp = Float64(0.5 * Float64(x + y)); else tmp = Float64(x * 1.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 7.2e-81) tmp = 0.5 * (x + y); else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 7.2e-81], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.2 \cdot 10^{-81}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < 7.1999999999999997e-81Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt63.4%
fabs-sqr63.4%
rem-square-sqrt65.4%
Simplified65.4%
Taylor expanded in x around 0 65.4%
+-commutative65.4%
distribute-lft-in65.4%
Simplified65.4%
if 7.1999999999999997e-81 < x Initial program 99.9%
Taylor expanded in y around 0 71.1%
neg-mul-171.1%
Simplified71.1%
Taylor expanded in x around 0 71.1%
+-commutative71.1%
fma-define71.1%
fabs-neg71.1%
rem-square-sqrt71.0%
fabs-sqr71.0%
rem-square-sqrt71.1%
fma-define71.1%
*-lft-identity71.1%
distribute-rgt-out71.1%
metadata-eval71.1%
Simplified71.1%
Final simplification67.3%
(FPCore (x y) :precision binary64 (if (<= y 8.5e-98) (* x 0.5) (* y 0.5)))
double code(double x, double y) {
double tmp;
if (y <= 8.5e-98) {
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 <= 8.5d-98) 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 <= 8.5e-98) {
tmp = x * 0.5;
} else {
tmp = y * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 8.5e-98: tmp = x * 0.5 else: tmp = y * 0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= 8.5e-98) 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 <= 8.5e-98) tmp = x * 0.5; else tmp = y * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 8.5e-98], N[(x * 0.5), $MachinePrecision], N[(y * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.5 \cdot 10^{-98}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < 8.4999999999999997e-98Initial program 99.9%
Taylor expanded in y around -inf 99.9%
fabs-neg99.9%
mul-1-neg99.9%
sub-neg99.9%
fabs-sub99.9%
rem-square-sqrt33.8%
fabs-sqr33.8%
rem-square-sqrt40.0%
Simplified40.0%
Taylor expanded in x around inf 36.4%
if 8.4999999999999997e-98 < y Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt78.6%
fabs-sqr78.6%
rem-square-sqrt82.9%
Simplified82.9%
Taylor expanded in x around 0 68.7%
Final simplification46.1%
(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 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt47.3%
fabs-sqr47.3%
rem-square-sqrt52.9%
Simplified52.9%
Taylor expanded in x around inf 30.4%
Final simplification30.4%
(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 100.0%
Taylor expanded in x around inf 11.9%
herbie shell --seed 2024145
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
:precision binary64
(+ x (/ (fabs (- y x)) 2.0)))