
(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 (- 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%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= x -2.2e-91)
(* 0.5 (+ x y))
(if (<= x 5.5e-112)
(* (fabs (- y x)) 0.5)
(- (* x 1.5) (* 0.5 (- (* y 3.0) (* 2.0 (+ (* y -0.5) (* y 1.5)))))))))
double code(double x, double y) {
double tmp;
if (x <= -2.2e-91) {
tmp = 0.5 * (x + y);
} else if (x <= 5.5e-112) {
tmp = fabs((y - x)) * 0.5;
} else {
tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 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-91)) then
tmp = 0.5d0 * (x + y)
else if (x <= 5.5d-112) then
tmp = abs((y - x)) * 0.5d0
else
tmp = (x * 1.5d0) - (0.5d0 * ((y * 3.0d0) - (2.0d0 * ((y * (-0.5d0)) + (y * 1.5d0)))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -2.2e-91) {
tmp = 0.5 * (x + y);
} else if (x <= 5.5e-112) {
tmp = Math.abs((y - x)) * 0.5;
} else {
tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5)))));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -2.2e-91: tmp = 0.5 * (x + y) elif x <= 5.5e-112: tmp = math.fabs((y - x)) * 0.5 else: tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5))))) return tmp
function code(x, y) tmp = 0.0 if (x <= -2.2e-91) tmp = Float64(0.5 * Float64(x + y)); elseif (x <= 5.5e-112) tmp = Float64(abs(Float64(y - x)) * 0.5); else tmp = Float64(Float64(x * 1.5) - Float64(0.5 * Float64(Float64(y * 3.0) - Float64(2.0 * Float64(Float64(y * -0.5) + Float64(y * 1.5)))))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -2.2e-91) tmp = 0.5 * (x + y); elseif (x <= 5.5e-112) tmp = abs((y - x)) * 0.5; else tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5))))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -2.2e-91], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.5e-112], N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(x * 1.5), $MachinePrecision] - N[(0.5 * N[(N[(y * 3.0), $MachinePrecision] - N[(2.0 * N[(N[(y * -0.5), $MachinePrecision] + N[(y * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-91}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-112}:\\
\;\;\;\;\left|y - x\right| \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5 - 0.5 \cdot \left(y \cdot 3 - 2 \cdot \left(y \cdot -0.5 + y \cdot 1.5\right)\right)\\
\end{array}
\end{array}
if x < -2.2000000000000001e-91Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-define100.0%
add-sqr-sqrt91.5%
fabs-sqr91.5%
add-sqr-sqrt92.1%
metadata-eval92.1%
Applied egg-rr92.1%
Taylor expanded in y around 0 92.1%
associate-+r+92.2%
distribute-rgt1-in92.2%
metadata-eval92.2%
distribute-lft-out92.2%
Simplified92.2%
if -2.2000000000000001e-91 < x < 5.5e-112Initial program 100.0%
Taylor expanded in x around 0 88.8%
if 5.5e-112 < x Initial program 99.7%
flip-+56.9%
clear-num56.8%
div-inv56.8%
add-sqr-sqrt4.1%
fabs-sqr4.1%
add-sqr-sqrt11.9%
metadata-eval11.9%
pow211.9%
add-sqr-sqrt4.1%
fabs-sqr4.1%
add-sqr-sqrt23.1%
div-inv23.1%
Applied egg-rr11.8%
unpow211.8%
unpow211.8%
metadata-eval11.8%
swap-sqr11.9%
difference-of-squares13.8%
+-commutative13.8%
fma-undefine13.8%
sub-neg13.8%
distribute-rgt-neg-in13.8%
metadata-eval13.8%
Applied egg-rr13.8%
fma-define13.8%
*-commutative13.8%
sub-neg13.8%
mul-1-neg13.8%
distribute-lft-in13.8%
mul-1-neg13.8%
distribute-rgt-neg-in13.8%
distribute-lft-neg-in13.8%
metadata-eval13.8%
associate-+r+13.8%
distribute-lft1-in13.8%
metadata-eval13.8%
+-commutative13.8%
distribute-lft-out13.8%
*-commutative13.8%
Simplified13.8%
add-sqr-sqrt4.1%
sqrt-unprod55.5%
swap-sqr55.4%
metadata-eval55.4%
metadata-eval55.4%
swap-sqr55.5%
*-commutative55.5%
*-commutative55.5%
sqrt-unprod54.3%
add-sqr-sqrt54.6%
cancel-sign-sub-inv54.6%
metadata-eval54.6%
*-commutative54.6%
+-commutative54.6%
Applied egg-rr54.6%
Taylor expanded in x around inf 83.6%
Final simplification87.9%
(FPCore (x y)
:precision binary64
(let* ((t_0
(- (* x 1.5) (* 0.5 (- (* y 3.0) (* 2.0 (+ (* y -0.5) (* y 1.5))))))))
(if (<= y -5.5e-241)
t_0
(if (<= y -2e-278) (* x 0.5) (if (<= y 2e-169) t_0 (* 0.5 (+ x y)))))))
double code(double x, double y) {
double t_0 = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5)))));
double tmp;
if (y <= -5.5e-241) {
tmp = t_0;
} else if (y <= -2e-278) {
tmp = x * 0.5;
} else if (y <= 2e-169) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = (x * 1.5d0) - (0.5d0 * ((y * 3.0d0) - (2.0d0 * ((y * (-0.5d0)) + (y * 1.5d0)))))
if (y <= (-5.5d-241)) then
tmp = t_0
else if (y <= (-2d-278)) then
tmp = x * 0.5d0
else if (y <= 2d-169) then
tmp = t_0
else
tmp = 0.5d0 * (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5)))));
double tmp;
if (y <= -5.5e-241) {
tmp = t_0;
} else if (y <= -2e-278) {
tmp = x * 0.5;
} else if (y <= 2e-169) {
tmp = t_0;
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): t_0 = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5))))) tmp = 0 if y <= -5.5e-241: tmp = t_0 elif y <= -2e-278: tmp = x * 0.5 elif y <= 2e-169: tmp = t_0 else: tmp = 0.5 * (x + y) return tmp
function code(x, y) t_0 = Float64(Float64(x * 1.5) - Float64(0.5 * Float64(Float64(y * 3.0) - Float64(2.0 * Float64(Float64(y * -0.5) + Float64(y * 1.5)))))) tmp = 0.0 if (y <= -5.5e-241) tmp = t_0; elseif (y <= -2e-278) tmp = Float64(x * 0.5); elseif (y <= 2e-169) tmp = t_0; else tmp = Float64(0.5 * Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) t_0 = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5))))); tmp = 0.0; if (y <= -5.5e-241) tmp = t_0; elseif (y <= -2e-278) tmp = x * 0.5; elseif (y <= 2e-169) tmp = t_0; else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * 1.5), $MachinePrecision] - N[(0.5 * N[(N[(y * 3.0), $MachinePrecision] - N[(2.0 * N[(N[(y * -0.5), $MachinePrecision] + N[(y * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.5e-241], t$95$0, If[LessEqual[y, -2e-278], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 2e-169], t$95$0, N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot 1.5 - 0.5 \cdot \left(y \cdot 3 - 2 \cdot \left(y \cdot -0.5 + y \cdot 1.5\right)\right)\\
\mathbf{if}\;y \leq -5.5 \cdot 10^{-241}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -2 \cdot 10^{-278}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-169}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -5.4999999999999998e-241 or -1.99999999999999988e-278 < y < 2.00000000000000004e-169Initial program 99.9%
flip-+56.7%
clear-num56.6%
div-inv56.6%
add-sqr-sqrt12.1%
fabs-sqr12.1%
add-sqr-sqrt16.4%
metadata-eval16.4%
pow216.4%
add-sqr-sqrt12.1%
fabs-sqr12.1%
add-sqr-sqrt40.4%
div-inv40.4%
Applied egg-rr16.4%
unpow216.4%
unpow216.4%
metadata-eval16.4%
swap-sqr16.4%
difference-of-squares18.2%
+-commutative18.2%
fma-undefine18.2%
sub-neg18.2%
distribute-rgt-neg-in18.2%
metadata-eval18.2%
Applied egg-rr18.2%
fma-define18.2%
*-commutative18.2%
sub-neg18.2%
mul-1-neg18.2%
distribute-lft-in18.2%
mul-1-neg18.2%
distribute-rgt-neg-in18.2%
distribute-lft-neg-in18.2%
metadata-eval18.2%
associate-+r+18.2%
distribute-lft1-in18.2%
metadata-eval18.2%
+-commutative18.2%
distribute-lft-out18.2%
*-commutative18.2%
Simplified18.2%
add-sqr-sqrt13.0%
sqrt-unprod55.8%
swap-sqr55.7%
metadata-eval55.7%
metadata-eval55.7%
swap-sqr55.8%
*-commutative55.8%
*-commutative55.8%
sqrt-unprod45.4%
add-sqr-sqrt48.6%
cancel-sign-sub-inv48.6%
metadata-eval48.6%
*-commutative48.6%
+-commutative48.6%
Applied egg-rr48.6%
Taylor expanded in x around inf 79.1%
if -5.4999999999999998e-241 < y < -1.99999999999999988e-278Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-define100.0%
add-sqr-sqrt81.3%
fabs-sqr81.3%
add-sqr-sqrt85.0%
metadata-eval85.0%
Applied egg-rr85.0%
Taylor expanded in y around 0 85.0%
distribute-rgt1-in85.0%
metadata-eval85.0%
*-commutative85.0%
Simplified85.0%
if 2.00000000000000004e-169 < y Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-define99.9%
add-sqr-sqrt83.1%
fabs-sqr83.1%
add-sqr-sqrt86.6%
metadata-eval86.6%
Applied egg-rr86.6%
Taylor expanded in y around 0 86.6%
associate-+r+86.7%
distribute-rgt1-in86.7%
metadata-eval86.7%
distribute-lft-out86.7%
Simplified86.7%
Final simplification82.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (* y -0.5) (* y 1.5))))
(if (<= y -4.8e-241)
(- (* y -0.5) (* 0.5 (* x (- -1.0 (* 2.0 (/ t_0 y))))))
(if (<= y -3.1e-278)
(* x 0.5)
(if (<= y 2e-169)
(- (* x 1.5) (* 0.5 (- (* y 3.0) (* 2.0 t_0))))
(* 0.5 (+ x y)))))))
double code(double x, double y) {
double t_0 = (y * -0.5) + (y * 1.5);
double tmp;
if (y <= -4.8e-241) {
tmp = (y * -0.5) - (0.5 * (x * (-1.0 - (2.0 * (t_0 / y)))));
} else if (y <= -3.1e-278) {
tmp = x * 0.5;
} else if (y <= 2e-169) {
tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * t_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) :: t_0
real(8) :: tmp
t_0 = (y * (-0.5d0)) + (y * 1.5d0)
if (y <= (-4.8d-241)) then
tmp = (y * (-0.5d0)) - (0.5d0 * (x * ((-1.0d0) - (2.0d0 * (t_0 / y)))))
else if (y <= (-3.1d-278)) then
tmp = x * 0.5d0
else if (y <= 2d-169) then
tmp = (x * 1.5d0) - (0.5d0 * ((y * 3.0d0) - (2.0d0 * t_0)))
else
tmp = 0.5d0 * (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y * -0.5) + (y * 1.5);
double tmp;
if (y <= -4.8e-241) {
tmp = (y * -0.5) - (0.5 * (x * (-1.0 - (2.0 * (t_0 / y)))));
} else if (y <= -3.1e-278) {
tmp = x * 0.5;
} else if (y <= 2e-169) {
tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * t_0)));
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): t_0 = (y * -0.5) + (y * 1.5) tmp = 0 if y <= -4.8e-241: tmp = (y * -0.5) - (0.5 * (x * (-1.0 - (2.0 * (t_0 / y))))) elif y <= -3.1e-278: tmp = x * 0.5 elif y <= 2e-169: tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * t_0))) else: tmp = 0.5 * (x + y) return tmp
function code(x, y) t_0 = Float64(Float64(y * -0.5) + Float64(y * 1.5)) tmp = 0.0 if (y <= -4.8e-241) tmp = Float64(Float64(y * -0.5) - Float64(0.5 * Float64(x * Float64(-1.0 - Float64(2.0 * Float64(t_0 / y)))))); elseif (y <= -3.1e-278) tmp = Float64(x * 0.5); elseif (y <= 2e-169) tmp = Float64(Float64(x * 1.5) - Float64(0.5 * Float64(Float64(y * 3.0) - Float64(2.0 * t_0)))); else tmp = Float64(0.5 * Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) t_0 = (y * -0.5) + (y * 1.5); tmp = 0.0; if (y <= -4.8e-241) tmp = (y * -0.5) - (0.5 * (x * (-1.0 - (2.0 * (t_0 / y))))); elseif (y <= -3.1e-278) tmp = x * 0.5; elseif (y <= 2e-169) tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * t_0))); else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * -0.5), $MachinePrecision] + N[(y * 1.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.8e-241], N[(N[(y * -0.5), $MachinePrecision] - N[(0.5 * N[(x * N[(-1.0 - N[(2.0 * N[(t$95$0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3.1e-278], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 2e-169], N[(N[(x * 1.5), $MachinePrecision] - N[(0.5 * N[(N[(y * 3.0), $MachinePrecision] - N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot -0.5 + y \cdot 1.5\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{-241}:\\
\;\;\;\;y \cdot -0.5 - 0.5 \cdot \left(x \cdot \left(-1 - 2 \cdot \frac{t\_0}{y}\right)\right)\\
\mathbf{elif}\;y \leq -3.1 \cdot 10^{-278}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-169}:\\
\;\;\;\;x \cdot 1.5 - 0.5 \cdot \left(y \cdot 3 - 2 \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -4.8e-241Initial program 99.9%
flip-+57.9%
clear-num57.7%
div-inv57.7%
add-sqr-sqrt10.7%
fabs-sqr10.7%
add-sqr-sqrt13.9%
metadata-eval13.9%
pow213.9%
add-sqr-sqrt10.7%
fabs-sqr10.7%
add-sqr-sqrt45.9%
div-inv45.9%
Applied egg-rr13.8%
unpow213.8%
unpow213.8%
metadata-eval13.8%
swap-sqr13.9%
difference-of-squares15.3%
+-commutative15.3%
fma-undefine15.3%
sub-neg15.3%
distribute-rgt-neg-in15.3%
metadata-eval15.3%
Applied egg-rr15.3%
fma-define15.3%
*-commutative15.3%
sub-neg15.3%
mul-1-neg15.3%
distribute-lft-in15.3%
mul-1-neg15.3%
distribute-rgt-neg-in15.3%
distribute-lft-neg-in15.3%
metadata-eval15.3%
associate-+r+15.3%
distribute-lft1-in15.3%
metadata-eval15.3%
+-commutative15.3%
distribute-lft-out15.3%
*-commutative15.3%
Simplified15.3%
add-sqr-sqrt11.4%
sqrt-unprod56.7%
swap-sqr56.6%
metadata-eval56.6%
metadata-eval56.6%
swap-sqr56.7%
*-commutative56.7%
*-commutative56.7%
sqrt-unprod47.9%
add-sqr-sqrt50.6%
cancel-sign-sub-inv50.6%
metadata-eval50.6%
*-commutative50.6%
+-commutative50.6%
Applied egg-rr50.6%
Taylor expanded in x around 0 82.1%
if -4.8e-241 < y < -3.09999999999999992e-278Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-define100.0%
add-sqr-sqrt81.3%
fabs-sqr81.3%
add-sqr-sqrt85.0%
metadata-eval85.0%
Applied egg-rr85.0%
Taylor expanded in y around 0 85.0%
distribute-rgt1-in85.0%
metadata-eval85.0%
*-commutative85.0%
Simplified85.0%
if -3.09999999999999992e-278 < y < 2.00000000000000004e-169Initial program 99.8%
flip-+53.5%
clear-num53.5%
div-inv53.5%
add-sqr-sqrt16.0%
fabs-sqr16.0%
add-sqr-sqrt23.3%
metadata-eval23.3%
pow223.3%
add-sqr-sqrt16.0%
fabs-sqr16.0%
add-sqr-sqrt25.6%
div-inv25.6%
Applied egg-rr23.3%
unpow223.3%
unpow223.3%
metadata-eval23.3%
swap-sqr23.3%
difference-of-squares26.0%
+-commutative26.0%
fma-undefine26.0%
sub-neg26.0%
distribute-rgt-neg-in26.0%
metadata-eval26.0%
Applied egg-rr26.0%
fma-define26.0%
*-commutative26.0%
sub-neg26.0%
mul-1-neg26.0%
distribute-lft-in26.0%
mul-1-neg26.0%
distribute-rgt-neg-in26.0%
distribute-lft-neg-in26.0%
metadata-eval26.0%
associate-+r+26.0%
distribute-lft1-in26.0%
metadata-eval26.0%
+-commutative26.0%
distribute-lft-out26.0%
*-commutative26.0%
Simplified26.0%
add-sqr-sqrt17.0%
sqrt-unprod53.4%
swap-sqr53.4%
metadata-eval53.4%
metadata-eval53.4%
swap-sqr53.4%
*-commutative53.4%
*-commutative53.4%
sqrt-unprod38.9%
add-sqr-sqrt43.2%
cancel-sign-sub-inv43.2%
metadata-eval43.2%
*-commutative43.2%
+-commutative43.2%
Applied egg-rr43.2%
Taylor expanded in x around inf 71.7%
if 2.00000000000000004e-169 < y Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-define99.9%
add-sqr-sqrt83.1%
fabs-sqr83.1%
add-sqr-sqrt86.6%
metadata-eval86.6%
Applied egg-rr86.6%
Taylor expanded in y around 0 86.6%
associate-+r+86.7%
distribute-rgt1-in86.7%
metadata-eval86.7%
distribute-lft-out86.7%
Simplified86.7%
Final simplification82.6%
(FPCore (x y)
:precision binary64
(if (<= x -2.7e-35)
(* x 0.5)
(if (<= x -9.2e-51)
(* y 0.5)
(if (<= x -1.55e-106)
(* x 0.5)
(if (<= x 1.8e-111) (* y 0.5) (* x 1.5))))))
double code(double x, double y) {
double tmp;
if (x <= -2.7e-35) {
tmp = x * 0.5;
} else if (x <= -9.2e-51) {
tmp = y * 0.5;
} else if (x <= -1.55e-106) {
tmp = x * 0.5;
} else if (x <= 1.8e-111) {
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.7d-35)) then
tmp = x * 0.5d0
else if (x <= (-9.2d-51)) then
tmp = y * 0.5d0
else if (x <= (-1.55d-106)) then
tmp = x * 0.5d0
else if (x <= 1.8d-111) 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.7e-35) {
tmp = x * 0.5;
} else if (x <= -9.2e-51) {
tmp = y * 0.5;
} else if (x <= -1.55e-106) {
tmp = x * 0.5;
} else if (x <= 1.8e-111) {
tmp = y * 0.5;
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -2.7e-35: tmp = x * 0.5 elif x <= -9.2e-51: tmp = y * 0.5 elif x <= -1.55e-106: tmp = x * 0.5 elif x <= 1.8e-111: tmp = y * 0.5 else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= -2.7e-35) tmp = Float64(x * 0.5); elseif (x <= -9.2e-51) tmp = Float64(y * 0.5); elseif (x <= -1.55e-106) tmp = Float64(x * 0.5); elseif (x <= 1.8e-111) 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.7e-35) tmp = x * 0.5; elseif (x <= -9.2e-51) tmp = y * 0.5; elseif (x <= -1.55e-106) tmp = x * 0.5; elseif (x <= 1.8e-111) tmp = y * 0.5; else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -2.7e-35], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, -9.2e-51], N[(y * 0.5), $MachinePrecision], If[LessEqual[x, -1.55e-106], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 1.8e-111], N[(y * 0.5), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-35}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{-51}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{-106}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-111}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -2.6999999999999997e-35 or -9.20000000000000007e-51 < x < -1.54999999999999993e-106Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-define100.0%
add-sqr-sqrt87.3%
fabs-sqr87.3%
add-sqr-sqrt87.9%
metadata-eval87.9%
Applied egg-rr87.9%
Taylor expanded in y around 0 79.9%
distribute-rgt1-in79.9%
metadata-eval79.9%
*-commutative79.9%
Simplified79.9%
if -2.6999999999999997e-35 < x < -9.20000000000000007e-51 or -1.54999999999999993e-106 < x < 1.80000000000000005e-111Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-define100.0%
add-sqr-sqrt57.9%
fabs-sqr57.9%
add-sqr-sqrt59.9%
metadata-eval59.9%
Applied egg-rr59.9%
Taylor expanded in y around inf 54.0%
if 1.80000000000000005e-111 < x Initial program 99.7%
flip-+56.9%
clear-num56.8%
div-inv56.8%
add-sqr-sqrt4.1%
fabs-sqr4.1%
add-sqr-sqrt11.9%
metadata-eval11.9%
pow211.9%
add-sqr-sqrt4.1%
fabs-sqr4.1%
add-sqr-sqrt23.1%
div-inv23.1%
Applied egg-rr11.8%
unpow211.8%
unpow211.8%
metadata-eval11.8%
swap-sqr11.9%
difference-of-squares13.8%
+-commutative13.8%
fma-undefine13.8%
sub-neg13.8%
distribute-rgt-neg-in13.8%
metadata-eval13.8%
Applied egg-rr13.8%
fma-define13.8%
*-commutative13.8%
sub-neg13.8%
mul-1-neg13.8%
distribute-lft-in13.8%
mul-1-neg13.8%
distribute-rgt-neg-in13.8%
distribute-lft-neg-in13.8%
metadata-eval13.8%
associate-+r+13.8%
distribute-lft1-in13.8%
metadata-eval13.8%
+-commutative13.8%
distribute-lft-out13.8%
*-commutative13.8%
Simplified13.8%
add-sqr-sqrt4.1%
sqrt-unprod55.5%
swap-sqr55.4%
metadata-eval55.4%
metadata-eval55.4%
swap-sqr55.5%
*-commutative55.5%
*-commutative55.5%
sqrt-unprod54.3%
add-sqr-sqrt54.6%
cancel-sign-sub-inv54.6%
metadata-eval54.6%
*-commutative54.6%
+-commutative54.6%
Applied egg-rr54.6%
Taylor expanded in x around inf 69.2%
*-commutative69.2%
Simplified69.2%
Final simplification67.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.5 (+ x y))))
(if (<= x -3.3e-255)
t_0
(if (<= x -1.72e-307) (* y -0.5) (if (<= x 1.15e-111) t_0 (* x 1.5))))))
double code(double x, double y) {
double t_0 = 0.5 * (x + y);
double tmp;
if (x <= -3.3e-255) {
tmp = t_0;
} else if (x <= -1.72e-307) {
tmp = y * -0.5;
} else if (x <= 1.15e-111) {
tmp = t_0;
} 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 <= (-3.3d-255)) then
tmp = t_0
else if (x <= (-1.72d-307)) then
tmp = y * (-0.5d0)
else if (x <= 1.15d-111) then
tmp = t_0
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 <= -3.3e-255) {
tmp = t_0;
} else if (x <= -1.72e-307) {
tmp = y * -0.5;
} else if (x <= 1.15e-111) {
tmp = t_0;
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): t_0 = 0.5 * (x + y) tmp = 0 if x <= -3.3e-255: tmp = t_0 elif x <= -1.72e-307: tmp = y * -0.5 elif x <= 1.15e-111: tmp = t_0 else: tmp = x * 1.5 return tmp
function code(x, y) t_0 = Float64(0.5 * Float64(x + y)) tmp = 0.0 if (x <= -3.3e-255) tmp = t_0; elseif (x <= -1.72e-307) tmp = Float64(y * -0.5); elseif (x <= 1.15e-111) tmp = t_0; 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 <= -3.3e-255) tmp = t_0; elseif (x <= -1.72e-307) tmp = y * -0.5; elseif (x <= 1.15e-111) tmp = t_0; 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, -3.3e-255], t$95$0, If[LessEqual[x, -1.72e-307], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 1.15e-111], t$95$0, N[(x * 1.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(x + y\right)\\
\mathbf{if}\;x \leq -3.3 \cdot 10^{-255}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.72 \cdot 10^{-307}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-111}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -3.29999999999999988e-255 or -1.72000000000000008e-307 < x < 1.15e-111Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-define100.0%
add-sqr-sqrt73.8%
fabs-sqr73.8%
add-sqr-sqrt75.2%
metadata-eval75.2%
Applied egg-rr75.2%
Taylor expanded in y around 0 75.2%
associate-+r+75.2%
distribute-rgt1-in75.2%
metadata-eval75.2%
distribute-lft-out75.2%
Simplified75.2%
if -3.29999999999999988e-255 < x < -1.72000000000000008e-307Initial program 100.0%
flip-+86.9%
clear-num86.7%
div-inv86.7%
add-sqr-sqrt14.1%
fabs-sqr14.1%
add-sqr-sqrt15.4%
metadata-eval15.4%
pow215.4%
add-sqr-sqrt14.1%
fabs-sqr14.1%
add-sqr-sqrt86.7%
div-inv86.7%
Applied egg-rr15.4%
unpow215.4%
unpow215.4%
metadata-eval15.4%
swap-sqr15.4%
difference-of-squares15.4%
+-commutative15.4%
fma-undefine15.4%
sub-neg15.4%
distribute-rgt-neg-in15.4%
metadata-eval15.4%
Applied egg-rr15.4%
fma-define15.4%
*-commutative15.4%
sub-neg15.4%
mul-1-neg15.4%
distribute-lft-in15.4%
mul-1-neg15.4%
distribute-rgt-neg-in15.4%
distribute-lft-neg-in15.4%
metadata-eval15.4%
associate-+r+15.4%
distribute-lft1-in15.4%
metadata-eval15.4%
+-commutative15.4%
distribute-lft-out15.4%
*-commutative15.4%
Simplified15.4%
add-sqr-sqrt14.1%
sqrt-unprod85.5%
swap-sqr85.5%
metadata-eval85.5%
metadata-eval85.5%
swap-sqr85.5%
*-commutative85.5%
*-commutative85.5%
sqrt-unprod71.9%
add-sqr-sqrt72.6%
cancel-sign-sub-inv72.6%
metadata-eval72.6%
*-commutative72.6%
+-commutative72.6%
Applied egg-rr72.6%
Taylor expanded in y around inf 85.9%
if 1.15e-111 < x Initial program 99.7%
flip-+56.9%
clear-num56.8%
div-inv56.8%
add-sqr-sqrt4.1%
fabs-sqr4.1%
add-sqr-sqrt11.9%
metadata-eval11.9%
pow211.9%
add-sqr-sqrt4.1%
fabs-sqr4.1%
add-sqr-sqrt23.1%
div-inv23.1%
Applied egg-rr11.8%
unpow211.8%
unpow211.8%
metadata-eval11.8%
swap-sqr11.9%
difference-of-squares13.8%
+-commutative13.8%
fma-undefine13.8%
sub-neg13.8%
distribute-rgt-neg-in13.8%
metadata-eval13.8%
Applied egg-rr13.8%
fma-define13.8%
*-commutative13.8%
sub-neg13.8%
mul-1-neg13.8%
distribute-lft-in13.8%
mul-1-neg13.8%
distribute-rgt-neg-in13.8%
distribute-lft-neg-in13.8%
metadata-eval13.8%
associate-+r+13.8%
distribute-lft1-in13.8%
metadata-eval13.8%
+-commutative13.8%
distribute-lft-out13.8%
*-commutative13.8%
Simplified13.8%
add-sqr-sqrt4.1%
sqrt-unprod55.5%
swap-sqr55.4%
metadata-eval55.4%
metadata-eval55.4%
swap-sqr55.5%
*-commutative55.5%
*-commutative55.5%
sqrt-unprod54.3%
add-sqr-sqrt54.6%
cancel-sign-sub-inv54.6%
metadata-eval54.6%
*-commutative54.6%
+-commutative54.6%
Applied egg-rr54.6%
Taylor expanded in x around inf 69.2%
*-commutative69.2%
Simplified69.2%
Final simplification73.3%
(FPCore (x y) :precision binary64 (if (<= y -4.8e-183) (* y -0.5) (if (<= y 8e-116) x (* y 0.5))))
double code(double x, double y) {
double tmp;
if (y <= -4.8e-183) {
tmp = y * -0.5;
} else if (y <= 8e-116) {
tmp = x;
} 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 <= (-4.8d-183)) then
tmp = y * (-0.5d0)
else if (y <= 8d-116) then
tmp = x
else
tmp = y * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4.8e-183) {
tmp = y * -0.5;
} else if (y <= 8e-116) {
tmp = x;
} else {
tmp = y * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.8e-183: tmp = y * -0.5 elif y <= 8e-116: tmp = x else: tmp = y * 0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -4.8e-183) tmp = Float64(y * -0.5); elseif (y <= 8e-116) tmp = x; else tmp = Float64(y * 0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.8e-183) tmp = y * -0.5; elseif (y <= 8e-116) tmp = x; else tmp = y * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.8e-183], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 8e-116], x, N[(y * 0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-183}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-116}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < -4.79999999999999986e-183Initial program 99.9%
flip-+54.6%
clear-num54.4%
div-inv54.4%
add-sqr-sqrt7.8%
fabs-sqr7.8%
add-sqr-sqrt10.2%
metadata-eval10.2%
pow210.2%
add-sqr-sqrt7.7%
fabs-sqr7.7%
add-sqr-sqrt46.3%
div-inv46.3%
Applied egg-rr10.1%
unpow210.1%
unpow210.1%
metadata-eval10.1%
swap-sqr10.2%
difference-of-squares11.6%
+-commutative11.6%
fma-undefine11.6%
sub-neg11.6%
distribute-rgt-neg-in11.6%
metadata-eval11.6%
Applied egg-rr11.6%
fma-define11.6%
*-commutative11.6%
sub-neg11.6%
mul-1-neg11.6%
distribute-lft-in11.6%
mul-1-neg11.6%
distribute-rgt-neg-in11.6%
distribute-lft-neg-in11.6%
metadata-eval11.6%
associate-+r+11.6%
distribute-lft1-in11.6%
metadata-eval11.6%
+-commutative11.6%
distribute-lft-out11.6%
*-commutative11.6%
Simplified11.6%
add-sqr-sqrt8.6%
sqrt-unprod53.2%
swap-sqr53.1%
metadata-eval53.1%
metadata-eval53.1%
swap-sqr53.2%
*-commutative53.2%
*-commutative53.2%
sqrt-unprod47.5%
add-sqr-sqrt49.9%
cancel-sign-sub-inv49.9%
metadata-eval49.9%
*-commutative49.9%
+-commutative49.9%
Applied egg-rr49.9%
Taylor expanded in y around inf 59.6%
if -4.79999999999999986e-183 < y < 8e-116Initial program 99.9%
Taylor expanded in x around inf 19.3%
if 8e-116 < y Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-define99.9%
add-sqr-sqrt82.5%
fabs-sqr82.5%
add-sqr-sqrt86.1%
metadata-eval86.1%
Applied egg-rr86.1%
Taylor expanded in y around inf 71.8%
Final simplification53.0%
(FPCore (x y) :precision binary64 (if (<= y -2.5e-32) (* y -0.5) (if (<= y 8.2e-113) (* x 0.5) (* y 0.5))))
double code(double x, double y) {
double tmp;
if (y <= -2.5e-32) {
tmp = y * -0.5;
} else if (y <= 8.2e-113) {
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 <= (-2.5d-32)) then
tmp = y * (-0.5d0)
else if (y <= 8.2d-113) 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 <= -2.5e-32) {
tmp = y * -0.5;
} else if (y <= 8.2e-113) {
tmp = x * 0.5;
} else {
tmp = y * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.5e-32: tmp = y * -0.5 elif y <= 8.2e-113: tmp = x * 0.5 else: tmp = y * 0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -2.5e-32) tmp = Float64(y * -0.5); elseif (y <= 8.2e-113) 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 <= -2.5e-32) tmp = y * -0.5; elseif (y <= 8.2e-113) tmp = x * 0.5; else tmp = y * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.5e-32], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 8.2e-113], N[(x * 0.5), $MachinePrecision], N[(y * 0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{-32}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-113}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < -2.5e-32Initial program 99.9%
flip-+51.7%
clear-num51.6%
div-inv51.6%
add-sqr-sqrt3.1%
fabs-sqr3.1%
add-sqr-sqrt5.3%
metadata-eval5.3%
pow25.3%
add-sqr-sqrt3.1%
fabs-sqr3.1%
add-sqr-sqrt44.3%
div-inv44.3%
Applied egg-rr5.2%
unpow25.2%
unpow25.2%
metadata-eval5.2%
swap-sqr5.3%
difference-of-squares6.4%
+-commutative6.4%
fma-undefine6.4%
sub-neg6.4%
distribute-rgt-neg-in6.4%
metadata-eval6.4%
Applied egg-rr6.4%
fma-define6.4%
*-commutative6.4%
sub-neg6.4%
mul-1-neg6.4%
distribute-lft-in6.4%
mul-1-neg6.4%
distribute-rgt-neg-in6.4%
distribute-lft-neg-in6.4%
metadata-eval6.4%
associate-+r+6.4%
distribute-lft1-in6.4%
metadata-eval6.4%
+-commutative6.4%
distribute-lft-out6.4%
*-commutative6.4%
Simplified6.4%
add-sqr-sqrt3.8%
sqrt-unprod49.9%
swap-sqr49.8%
metadata-eval49.8%
metadata-eval49.8%
swap-sqr49.9%
*-commutative49.9%
*-commutative49.9%
sqrt-unprod49.2%
add-sqr-sqrt50.6%
cancel-sign-sub-inv50.6%
metadata-eval50.6%
*-commutative50.6%
+-commutative50.6%
Applied egg-rr50.6%
Taylor expanded in y around inf 70.0%
if -2.5e-32 < y < 8.1999999999999999e-113Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-define99.9%
add-sqr-sqrt46.1%
fabs-sqr46.1%
add-sqr-sqrt54.4%
metadata-eval54.4%
Applied egg-rr54.4%
Taylor expanded in y around 0 53.5%
distribute-rgt1-in53.5%
metadata-eval53.5%
*-commutative53.5%
Simplified53.5%
if 8.1999999999999999e-113 < y Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-define99.9%
add-sqr-sqrt82.5%
fabs-sqr82.5%
add-sqr-sqrt86.1%
metadata-eval86.1%
Applied egg-rr86.1%
Taylor expanded in y around inf 71.8%
Final simplification64.4%
(FPCore (x y) :precision binary64 (if (<= y -1.9e-182) (* y -0.5) x))
double code(double x, double y) {
double tmp;
if (y <= -1.9e-182) {
tmp = y * -0.5;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.9d-182)) then
tmp = y * (-0.5d0)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.9e-182) {
tmp = y * -0.5;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.9e-182: tmp = y * -0.5 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.9e-182) tmp = Float64(y * -0.5); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.9e-182) tmp = y * -0.5; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.9e-182], N[(y * -0.5), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-182}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.9000000000000002e-182Initial program 99.9%
flip-+54.6%
clear-num54.4%
div-inv54.4%
add-sqr-sqrt7.8%
fabs-sqr7.8%
add-sqr-sqrt10.2%
metadata-eval10.2%
pow210.2%
add-sqr-sqrt7.7%
fabs-sqr7.7%
add-sqr-sqrt46.3%
div-inv46.3%
Applied egg-rr10.1%
unpow210.1%
unpow210.1%
metadata-eval10.1%
swap-sqr10.2%
difference-of-squares11.6%
+-commutative11.6%
fma-undefine11.6%
sub-neg11.6%
distribute-rgt-neg-in11.6%
metadata-eval11.6%
Applied egg-rr11.6%
fma-define11.6%
*-commutative11.6%
sub-neg11.6%
mul-1-neg11.6%
distribute-lft-in11.6%
mul-1-neg11.6%
distribute-rgt-neg-in11.6%
distribute-lft-neg-in11.6%
metadata-eval11.6%
associate-+r+11.6%
distribute-lft1-in11.6%
metadata-eval11.6%
+-commutative11.6%
distribute-lft-out11.6%
*-commutative11.6%
Simplified11.6%
add-sqr-sqrt8.6%
sqrt-unprod53.2%
swap-sqr53.1%
metadata-eval53.1%
metadata-eval53.1%
swap-sqr53.2%
*-commutative53.2%
*-commutative53.2%
sqrt-unprod47.5%
add-sqr-sqrt49.9%
cancel-sign-sub-inv49.9%
metadata-eval49.9%
*-commutative49.9%
+-commutative49.9%
Applied egg-rr49.9%
Taylor expanded in y around inf 59.6%
if -1.9000000000000002e-182 < y Initial program 99.9%
Taylor expanded in x around inf 12.7%
Final simplification29.2%
(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.7%
Final simplification11.7%
herbie shell --seed 2024046
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
:precision binary64
(+ x (/ (fabs (- y x)) 2.0)))