Keno / SIUnits.jl

Efficient unit-checked computation
Other
70 stars 26 forks source link

Using power with units seem to hang Julia #10

Closed jtveiten closed 10 years ago

jtveiten commented 10 years ago

julia> a=1m 1 m

julia> b=1m 1 m

julia> c=sqrt(a*b) 1.0 m

julia> c=(a*b)^(1/2) # this is where Julia seems to hang

ivarne commented 10 years ago

You will have to use a rational number in the exponent instead of a float

julia> c=(a*b)^(1//2)

Exponentiation is not defined for floating point exponents, so it causes a dispatch loop. It would be nice if floating point numbers would be automatically converted to rational, raising InexactError if the resulting exponent is not exact integer.