| Alternative 1 | |
|---|---|
| Error | 1.4 |
| Cost | 25920 |
\[{\left({\left(\sqrt[3]{x \cdot \sqrt{2}}\right)}^{2}\right)}^{1.5}
\]
(FPCore (x) :precision binary64 (sqrt (* 2.0 (pow x 2.0))))
(FPCore (x) :precision binary64 (if (<= x -4.578923636489754e-309) (* x (- (sqrt 2.0))) (* (sqrt (* x 2.0)) (sqrt x))))
double code(double x) {
return sqrt((2.0 * pow(x, 2.0)));
}
double code(double x) {
double tmp;
if (x <= -4.578923636489754e-309) {
tmp = x * -sqrt(2.0);
} else {
tmp = sqrt((x * 2.0)) * sqrt(x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
code = sqrt((2.0d0 * (x ** 2.0d0)))
end function
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-4.578923636489754d-309)) then
tmp = x * -sqrt(2.0d0)
else
tmp = sqrt((x * 2.0d0)) * sqrt(x)
end if
code = tmp
end function
public static double code(double x) {
return Math.sqrt((2.0 * Math.pow(x, 2.0)));
}
public static double code(double x) {
double tmp;
if (x <= -4.578923636489754e-309) {
tmp = x * -Math.sqrt(2.0);
} else {
tmp = Math.sqrt((x * 2.0)) * Math.sqrt(x);
}
return tmp;
}
def code(x): return math.sqrt((2.0 * math.pow(x, 2.0)))
def code(x): tmp = 0 if x <= -4.578923636489754e-309: tmp = x * -math.sqrt(2.0) else: tmp = math.sqrt((x * 2.0)) * math.sqrt(x) return tmp
function code(x) return sqrt(Float64(2.0 * (x ^ 2.0))) end
function code(x) tmp = 0.0 if (x <= -4.578923636489754e-309) tmp = Float64(x * Float64(-sqrt(2.0))); else tmp = Float64(sqrt(Float64(x * 2.0)) * sqrt(x)); end return tmp end
function tmp = code(x) tmp = sqrt((2.0 * (x ^ 2.0))); end
function tmp_2 = code(x) tmp = 0.0; if (x <= -4.578923636489754e-309) tmp = x * -sqrt(2.0); else tmp = sqrt((x * 2.0)) * sqrt(x); end tmp_2 = tmp; end
code[x_] := N[Sqrt[N[(2.0 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := If[LessEqual[x, -4.578923636489754e-309], N[(x * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\sqrt{2 \cdot {x}^{2}}
\begin{array}{l}
\mathbf{if}\;x \leq -4.578923636489754 \cdot 10^{-309}:\\
\;\;\;\;x \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x \cdot 2} \cdot \sqrt{x}\\
\end{array}
Results
if x < -4.5789236364897536e-309Initial program 30.6
Simplified30.6
Taylor expanded in x around -inf 0.4
Simplified0.4
if -4.5789236364897536e-309 < x Initial program 31.3
Simplified31.3
Applied egg-rr0.4
Final simplification0.4
| Alternative 1 | |
|---|---|
| Error | 1.4 |
| Cost | 25920 |
| Alternative 2 | |
|---|---|
| Error | 1.3 |
| Cost | 19584 |
| Alternative 3 | |
|---|---|
| Error | 0.4 |
| Cost | 6788 |
| Alternative 4 | |
|---|---|
| Error | 31.2 |
| Cost | 6592 |

herbie shell --seed 2022291
(FPCore (x)
:name "sqrt D"
:precision binary64
(sqrt (* 2.0 (pow x 2.0))))