Alternative 1 | |
---|---|
Error | 0.3 |
Cost | 13056 |
\[\frac{{x}^{-0.5}}{\sqrt{y}}
\]
(FPCore (x y) :precision binary64 (/ 1.0 (* (sqrt x) (sqrt y))))
(FPCore (x y) :precision binary64 (* (pow y -0.5) (pow x -0.5)))
double code(double x, double y) { return 1.0 / (sqrt(x) * sqrt(y)); }
double code(double x, double y) { return pow(y, -0.5) * pow(x, -0.5); }
real(8) function code(x, y) real(8), intent (in) :: x real(8), intent (in) :: y code = 1.0d0 / (sqrt(x) * sqrt(y)) end function
real(8) function code(x, y) real(8), intent (in) :: x real(8), intent (in) :: y code = (y ** (-0.5d0)) * (x ** (-0.5d0)) end function
public static double code(double x, double y) { return 1.0 / (Math.sqrt(x) * Math.sqrt(y)); }
public static double code(double x, double y) { return Math.pow(y, -0.5) * Math.pow(x, -0.5); }
def code(x, y): return 1.0 / (math.sqrt(x) * math.sqrt(y))
def code(x, y): return math.pow(y, -0.5) * math.pow(x, -0.5)
function code(x, y) return Float64(1.0 / Float64(sqrt(x) * sqrt(y))) end
function code(x, y) return Float64((y ^ -0.5) * (x ^ -0.5)) end
function tmp = code(x, y) tmp = 1.0 / (sqrt(x) * sqrt(y)); end
function tmp = code(x, y) tmp = (y ^ -0.5) * (x ^ -0.5); end
code[x_, y_] := N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] * N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[Power[y, -0.5], $MachinePrecision] * N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]
\frac{1}{\sqrt{x} \cdot \sqrt{y}}
{y}^{-0.5} \cdot {x}^{-0.5}
Results
Initial program 0.4
Applied egg-rr0.4
Simplified0.3
[Start]0.4 | \[ {x}^{-0.5} \cdot \frac{1}{\sqrt{y}}
\] |
---|---|
associate-*r/ [=>]0.3 | \[ \color{blue}{\frac{{x}^{-0.5} \cdot 1}{\sqrt{y}}}
\] |
*-rgt-identity [=>]0.3 | \[ \frac{\color{blue}{{x}^{-0.5}}}{\sqrt{y}}
\] |
Applied egg-rr0.4
Final simplification0.4
Alternative 1 | |
---|---|
Error | 0.3 |
Cost | 13056 |
Alternative 2 | |
---|---|
Error | 14.8 |
Cost | 6656 |
herbie shell --seed 1
(FPCore (x y)
:name "1/(sqrt(x)*sqrt(y))"
:precision binary64
:pre (and (and (<= 0.0 x) (<= x 1.79e+308)) (and (<= 0.0 y) (<= y 1.0)))
(/ 1.0 (* (sqrt x) (sqrt y))))