
(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 99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= x -7.4e-94)
(* 0.5 (+ x y))
(if (<= x 2.7e-35)
(+ x (/ (fabs y) 2.0))
(if (<= x 1.25e+88)
(+ x (/ (* y (+ (/ x y) 1.0)) 2.0))
(+ x (/ (fabs x) 2.0))))))
double code(double x, double y) {
double tmp;
if (x <= -7.4e-94) {
tmp = 0.5 * (x + y);
} else if (x <= 2.7e-35) {
tmp = x + (fabs(y) / 2.0);
} else if (x <= 1.25e+88) {
tmp = x + ((y * ((x / y) + 1.0)) / 2.0);
} else {
tmp = x + (fabs(x) / 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 <= (-7.4d-94)) then
tmp = 0.5d0 * (x + y)
else if (x <= 2.7d-35) then
tmp = x + (abs(y) / 2.0d0)
else if (x <= 1.25d+88) then
tmp = x + ((y * ((x / y) + 1.0d0)) / 2.0d0)
else
tmp = x + (abs(x) / 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -7.4e-94) {
tmp = 0.5 * (x + y);
} else if (x <= 2.7e-35) {
tmp = x + (Math.abs(y) / 2.0);
} else if (x <= 1.25e+88) {
tmp = x + ((y * ((x / y) + 1.0)) / 2.0);
} else {
tmp = x + (Math.abs(x) / 2.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -7.4e-94: tmp = 0.5 * (x + y) elif x <= 2.7e-35: tmp = x + (math.fabs(y) / 2.0) elif x <= 1.25e+88: tmp = x + ((y * ((x / y) + 1.0)) / 2.0) else: tmp = x + (math.fabs(x) / 2.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -7.4e-94) tmp = Float64(0.5 * Float64(x + y)); elseif (x <= 2.7e-35) tmp = Float64(x + Float64(abs(y) / 2.0)); elseif (x <= 1.25e+88) tmp = Float64(x + Float64(Float64(y * Float64(Float64(x / y) + 1.0)) / 2.0)); else tmp = Float64(x + Float64(abs(x) / 2.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -7.4e-94) tmp = 0.5 * (x + y); elseif (x <= 2.7e-35) tmp = x + (abs(y) / 2.0); elseif (x <= 1.25e+88) tmp = x + ((y * ((x / y) + 1.0)) / 2.0); else tmp = x + (abs(x) / 2.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -7.4e-94], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.7e-35], N[(x + N[(N[Abs[y], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.25e+88], N[(x + N[(N[(y * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Abs[x], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.4 \cdot 10^{-94}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-35}:\\
\;\;\;\;x + \frac{\left|y\right|}{2}\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+88}:\\
\;\;\;\;x + \frac{y \cdot \left(\frac{x}{y} + 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left|x\right|}{2}\\
\end{array}
\end{array}
if x < -7.3999999999999996e-94Initial 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-sqrt94.7%
fabs-sqr94.7%
rem-square-sqrt95.7%
Simplified95.7%
Taylor expanded in x around 0 95.7%
distribute-lft-out95.7%
Simplified95.7%
if -7.3999999999999996e-94 < x < 2.6999999999999997e-35Initial program 100.0%
Taylor expanded in y around inf 82.3%
if 2.6999999999999997e-35 < x < 1.24999999999999999e88Initial program 99.8%
Taylor expanded in y around inf 99.8%
mul-1-neg99.8%
unsub-neg99.8%
Simplified99.8%
add-sqr-sqrt23.0%
fabs-sqr23.0%
add-sqr-sqrt34.1%
*-commutative34.1%
div-inv34.1%
cancel-sign-sub-inv34.1%
add-sqr-sqrt0.0%
sqrt-unprod83.4%
sqr-neg83.4%
sqrt-unprod83.3%
add-sqr-sqrt83.4%
div-inv83.4%
Applied egg-rr83.4%
if 1.24999999999999999e88 < x Initial program 99.9%
Taylor expanded in y around 0 86.0%
neg-mul-186.0%
Simplified86.0%
Final simplification86.9%
(FPCore (x y)
:precision binary64
(if (<= x -1.1e-94)
(* 0.5 (+ x y))
(if (<= x 6.2e-36)
(+ x (/ (fabs y) 2.0))
(if (<= x 1.55e+85) (+ x (/ (* y (+ (/ x y) 1.0)) 2.0)) (* x 1.5)))))
double code(double x, double y) {
double tmp;
if (x <= -1.1e-94) {
tmp = 0.5 * (x + y);
} else if (x <= 6.2e-36) {
tmp = x + (fabs(y) / 2.0);
} else if (x <= 1.55e+85) {
tmp = x + ((y * ((x / y) + 1.0)) / 2.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) :: tmp
if (x <= (-1.1d-94)) then
tmp = 0.5d0 * (x + y)
else if (x <= 6.2d-36) then
tmp = x + (abs(y) / 2.0d0)
else if (x <= 1.55d+85) then
tmp = x + ((y * ((x / y) + 1.0d0)) / 2.0d0)
else
tmp = x * 1.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.1e-94) {
tmp = 0.5 * (x + y);
} else if (x <= 6.2e-36) {
tmp = x + (Math.abs(y) / 2.0);
} else if (x <= 1.55e+85) {
tmp = x + ((y * ((x / y) + 1.0)) / 2.0);
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.1e-94: tmp = 0.5 * (x + y) elif x <= 6.2e-36: tmp = x + (math.fabs(y) / 2.0) elif x <= 1.55e+85: tmp = x + ((y * ((x / y) + 1.0)) / 2.0) else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= -1.1e-94) tmp = Float64(0.5 * Float64(x + y)); elseif (x <= 6.2e-36) tmp = Float64(x + Float64(abs(y) / 2.0)); elseif (x <= 1.55e+85) tmp = Float64(x + Float64(Float64(y * Float64(Float64(x / y) + 1.0)) / 2.0)); else tmp = Float64(x * 1.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.1e-94) tmp = 0.5 * (x + y); elseif (x <= 6.2e-36) tmp = x + (abs(y) / 2.0); elseif (x <= 1.55e+85) tmp = x + ((y * ((x / y) + 1.0)) / 2.0); else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.1e-94], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.2e-36], N[(x + N[(N[Abs[y], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.55e+85], N[(x + N[(N[(y * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-94}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-36}:\\
\;\;\;\;x + \frac{\left|y\right|}{2}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+85}:\\
\;\;\;\;x + \frac{y \cdot \left(\frac{x}{y} + 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -1.10000000000000001e-94Initial 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-sqrt94.7%
fabs-sqr94.7%
rem-square-sqrt95.7%
Simplified95.7%
Taylor expanded in x around 0 95.7%
distribute-lft-out95.7%
Simplified95.7%
if -1.10000000000000001e-94 < x < 6.1999999999999997e-36Initial program 100.0%
Taylor expanded in y around inf 82.3%
if 6.1999999999999997e-36 < x < 1.55000000000000006e85Initial program 99.8%
Taylor expanded in y around inf 99.8%
mul-1-neg99.8%
unsub-neg99.8%
Simplified99.8%
add-sqr-sqrt23.0%
fabs-sqr23.0%
add-sqr-sqrt34.1%
*-commutative34.1%
div-inv34.1%
cancel-sign-sub-inv34.1%
add-sqr-sqrt0.0%
sqrt-unprod83.4%
sqr-neg83.4%
sqrt-unprod83.3%
add-sqr-sqrt83.4%
div-inv83.4%
Applied egg-rr83.4%
if 1.55000000000000006e85 < x Initial program 99.9%
Taylor expanded in y around 0 86.0%
neg-mul-186.0%
Simplified86.0%
fabs-neg86.0%
add-sqr-sqrt85.8%
fabs-sqr85.8%
add-sqr-sqrt86.0%
add-cube-cbrt85.3%
associate-/l*85.3%
pow285.3%
Applied egg-rr85.3%
associate-*r/85.3%
unpow285.3%
rem-3cbrt-lft86.0%
Simplified86.0%
Taylor expanded in x around 0 86.0%
*-commutative86.0%
Simplified86.0%
Final simplification86.9%
(FPCore (x y) :precision binary64 (if (<= x -5e-281) (* 0.5 (+ x y)) (if (<= x 6.5e+86) (+ x (/ (* y (+ (/ x y) 1.0)) 2.0)) (* x 1.5))))
double code(double x, double y) {
double tmp;
if (x <= -5e-281) {
tmp = 0.5 * (x + y);
} else if (x <= 6.5e+86) {
tmp = x + ((y * ((x / y) + 1.0)) / 2.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) :: tmp
if (x <= (-5d-281)) then
tmp = 0.5d0 * (x + y)
else if (x <= 6.5d+86) then
tmp = x + ((y * ((x / y) + 1.0d0)) / 2.0d0)
else
tmp = x * 1.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -5e-281) {
tmp = 0.5 * (x + y);
} else if (x <= 6.5e+86) {
tmp = x + ((y * ((x / y) + 1.0)) / 2.0);
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -5e-281: tmp = 0.5 * (x + y) elif x <= 6.5e+86: tmp = x + ((y * ((x / y) + 1.0)) / 2.0) else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= -5e-281) tmp = Float64(0.5 * Float64(x + y)); elseif (x <= 6.5e+86) tmp = Float64(x + Float64(Float64(y * Float64(Float64(x / y) + 1.0)) / 2.0)); else tmp = Float64(x * 1.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -5e-281) tmp = 0.5 * (x + y); elseif (x <= 6.5e+86) tmp = x + ((y * ((x / y) + 1.0)) / 2.0); else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -5e-281], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.5e+86], N[(x + N[(N[(y * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-281}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+86}:\\
\;\;\;\;x + \frac{y \cdot \left(\frac{x}{y} + 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -4.9999999999999998e-281Initial 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-sqrt77.0%
fabs-sqr77.0%
rem-square-sqrt78.0%
Simplified78.0%
Taylor expanded in x around 0 78.0%
distribute-lft-out78.0%
Simplified78.0%
if -4.9999999999999998e-281 < x < 6.49999999999999996e86Initial program 99.9%
Taylor expanded in y around inf 99.9%
mul-1-neg99.9%
unsub-neg99.9%
Simplified99.9%
add-sqr-sqrt33.4%
fabs-sqr33.4%
add-sqr-sqrt40.1%
*-commutative40.1%
div-inv40.1%
cancel-sign-sub-inv40.1%
add-sqr-sqrt2.4%
sqrt-unprod62.3%
sqr-neg62.3%
sqrt-unprod63.9%
add-sqr-sqrt66.3%
div-inv66.3%
Applied egg-rr66.3%
if 6.49999999999999996e86 < x Initial program 99.9%
Taylor expanded in y around 0 86.0%
neg-mul-186.0%
Simplified86.0%
fabs-neg86.0%
add-sqr-sqrt85.8%
fabs-sqr85.8%
add-sqr-sqrt86.0%
add-cube-cbrt85.3%
associate-/l*85.3%
pow285.3%
Applied egg-rr85.3%
associate-*r/85.3%
unpow285.3%
rem-3cbrt-lft86.0%
Simplified86.0%
Taylor expanded in x around 0 86.0%
*-commutative86.0%
Simplified86.0%
Final simplification75.7%
(FPCore (x y) :precision binary64 (if (<= x -2e-283) (* 0.5 (+ x y)) (if (<= x 2e+85) (* y (+ 0.5 (* (/ x y) 1.5))) (* x 1.5))))
double code(double x, double y) {
double tmp;
if (x <= -2e-283) {
tmp = 0.5 * (x + y);
} else if (x <= 2e+85) {
tmp = y * (0.5 + ((x / y) * 1.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 <= (-2d-283)) then
tmp = 0.5d0 * (x + y)
else if (x <= 2d+85) then
tmp = y * (0.5d0 + ((x / y) * 1.5d0))
else
tmp = x * 1.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -2e-283) {
tmp = 0.5 * (x + y);
} else if (x <= 2e+85) {
tmp = y * (0.5 + ((x / y) * 1.5));
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -2e-283: tmp = 0.5 * (x + y) elif x <= 2e+85: tmp = y * (0.5 + ((x / y) * 1.5)) else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= -2e-283) tmp = Float64(0.5 * Float64(x + y)); elseif (x <= 2e+85) tmp = Float64(y * Float64(0.5 + Float64(Float64(x / y) * 1.5))); else tmp = Float64(x * 1.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -2e-283) tmp = 0.5 * (x + y); elseif (x <= 2e+85) tmp = y * (0.5 + ((x / y) * 1.5)); else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -2e-283], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e+85], N[(y * N[(0.5 + N[(N[(x / y), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-283}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+85}:\\
\;\;\;\;y \cdot \left(0.5 + \frac{x}{y} \cdot 1.5\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -1.99999999999999989e-283Initial 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-sqrt77.0%
fabs-sqr77.0%
rem-square-sqrt78.0%
Simplified78.0%
Taylor expanded in x around 0 78.0%
distribute-lft-out78.0%
Simplified78.0%
if -1.99999999999999989e-283 < x < 2e85Initial program 99.9%
Taylor expanded in y around inf 99.9%
mul-1-neg99.9%
unsub-neg99.9%
Simplified99.9%
clear-num99.5%
inv-pow99.5%
add-sqr-sqrt33.4%
fabs-sqr33.4%
add-sqr-sqrt39.9%
associate-/r*39.9%
div-inv39.9%
cancel-sign-sub-inv39.9%
add-sqr-sqrt2.4%
sqrt-unprod62.1%
sqr-neg62.1%
sqrt-unprod63.7%
add-sqr-sqrt66.1%
div-inv66.1%
Applied egg-rr66.1%
unpow-166.1%
Simplified66.1%
Taylor expanded in y around inf 66.1%
distribute-lft1-in66.1%
metadata-eval66.1%
Simplified66.1%
if 2e85 < x Initial program 99.9%
Taylor expanded in y around 0 86.0%
neg-mul-186.0%
Simplified86.0%
fabs-neg86.0%
add-sqr-sqrt85.8%
fabs-sqr85.8%
add-sqr-sqrt86.0%
add-cube-cbrt85.3%
associate-/l*85.3%
pow285.3%
Applied egg-rr85.3%
associate-*r/85.3%
unpow285.3%
rem-3cbrt-lft86.0%
Simplified86.0%
Taylor expanded in x around 0 86.0%
*-commutative86.0%
Simplified86.0%
Final simplification75.7%
(FPCore (x y) :precision binary64 (if (<= x -1.55e-51) (* x 0.5) (if (<= x 8.2e-184) (* y 0.5) (* x 1.5))))
double code(double x, double y) {
double tmp;
if (x <= -1.55e-51) {
tmp = x * 0.5;
} else if (x <= 8.2e-184) {
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.55d-51)) then
tmp = x * 0.5d0
else if (x <= 8.2d-184) 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.55e-51) {
tmp = x * 0.5;
} else if (x <= 8.2e-184) {
tmp = y * 0.5;
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.55e-51: tmp = x * 0.5 elif x <= 8.2e-184: tmp = y * 0.5 else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= -1.55e-51) tmp = Float64(x * 0.5); elseif (x <= 8.2e-184) 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.55e-51) tmp = x * 0.5; elseif (x <= 8.2e-184) tmp = y * 0.5; else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.55e-51], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 8.2e-184], N[(y * 0.5), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-51}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-184}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -1.5499999999999999e-51Initial 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-sqrt94.2%
fabs-sqr94.2%
rem-square-sqrt95.2%
Simplified95.2%
Taylor expanded in x around inf 75.4%
*-commutative75.4%
Simplified75.4%
if -1.5499999999999999e-51 < x < 8.2e-184Initial 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-sqrt55.9%
fabs-sqr55.9%
rem-square-sqrt57.4%
Simplified57.4%
Taylor expanded in x around 0 41.8%
*-commutative41.8%
Simplified41.8%
if 8.2e-184 < x Initial program 99.9%
Taylor expanded in y around 0 63.9%
neg-mul-163.9%
Simplified63.9%
fabs-neg63.9%
add-sqr-sqrt63.8%
fabs-sqr63.8%
add-sqr-sqrt63.9%
add-cube-cbrt63.4%
associate-/l*63.4%
pow263.4%
Applied egg-rr63.4%
associate-*r/63.4%
unpow263.4%
rem-3cbrt-lft63.9%
Simplified63.9%
Taylor expanded in x around 0 63.9%
*-commutative63.9%
Simplified63.9%
(FPCore (x y) :precision binary64 (if (<= x 2.1e-45) (* 0.5 (+ x y)) (* x 1.5)))
double code(double x, double y) {
double tmp;
if (x <= 2.1e-45) {
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 <= 2.1d-45) 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 <= 2.1e-45) {
tmp = 0.5 * (x + y);
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 2.1e-45: tmp = 0.5 * (x + y) else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= 2.1e-45) 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 <= 2.1e-45) tmp = 0.5 * (x + y); else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 2.1e-45], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.1 \cdot 10^{-45}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < 2.09999999999999995e-45Initial 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-sqrt64.5%
fabs-sqr64.5%
rem-square-sqrt66.8%
Simplified66.8%
Taylor expanded in x around 0 66.8%
distribute-lft-out66.8%
Simplified66.8%
if 2.09999999999999995e-45 < x Initial program 99.8%
Taylor expanded in y around 0 76.4%
neg-mul-176.4%
Simplified76.4%
fabs-neg76.4%
add-sqr-sqrt76.3%
fabs-sqr76.3%
add-sqr-sqrt76.4%
add-cube-cbrt75.9%
associate-/l*75.9%
pow275.9%
Applied egg-rr75.9%
associate-*r/75.9%
unpow275.9%
rem-3cbrt-lft76.4%
Simplified76.4%
Taylor expanded in x around 0 76.4%
*-commutative76.4%
Simplified76.4%
(FPCore (x y) :precision binary64 (if (<= x -1e-309) (* x 0.5) (* x 1.5)))
double code(double x, double y) {
double tmp;
if (x <= -1e-309) {
tmp = x * 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 <= (-1d-309)) then
tmp = x * 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 <= -1e-309) {
tmp = x * 0.5;
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1e-309: tmp = x * 0.5 else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= -1e-309) tmp = Float64(x * 0.5); else tmp = Float64(x * 1.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1e-309) tmp = x * 0.5; else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1e-309], N[(x * 0.5), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-309}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -1.000000000000002e-309Initial 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-sqrt74.9%
fabs-sqr74.9%
rem-square-sqrt75.9%
Simplified75.9%
Taylor expanded in x around inf 48.0%
*-commutative48.0%
Simplified48.0%
if -1.000000000000002e-309 < x Initial program 99.9%
Taylor expanded in y around 0 57.3%
neg-mul-157.3%
Simplified57.3%
fabs-neg57.3%
add-sqr-sqrt57.3%
fabs-sqr57.3%
add-sqr-sqrt57.3%
add-cube-cbrt56.9%
associate-/l*56.9%
pow256.9%
Applied egg-rr56.9%
associate-*r/56.9%
unpow256.9%
rem-3cbrt-lft57.3%
Simplified57.3%
Taylor expanded in x around 0 57.3%
*-commutative57.3%
Simplified57.3%
(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%
Taylor expanded in y around -inf 99.9%
fabs-neg99.9%
mul-1-neg99.9%
sub-neg99.9%
fabs-sub99.9%
rem-square-sqrt47.6%
fabs-sqr47.6%
rem-square-sqrt53.5%
Simplified53.5%
Taylor expanded in x around inf 29.5%
*-commutative29.5%
Simplified29.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.9%
herbie shell --seed 2024110
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
:precision binary64
(+ x (/ (fabs (- y x)) 2.0)))