JuliaMath / JuliaMath/Decimals.jl

non-integer powers don't work

Open
#118 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
62
Forks
24
PR merge metrics
No merged PRs in 30d

Description

```jl
julia> (dec"1.2345")^0.5
ERROR: ^ not defined for Decimal
Stacktrace:
[1] error(::String, ::String, ::Type)
@ Base ./error.jl:54
[2] no_op_err(name::String, T::Type)
@ Base ./promotion.jl:622
[3] ^(x::Decimal, y::Decimal)
@ Base ./promotion.jl:627
[4] ^(x::Decimal, y::Float64)
@ Base ./promotion.jl:482
[5] top-level scope
@ REPL[45]:1
```
Maybe define:
```jl
Base.:^(x::Decimal, p::Decimal) = exp(p * log(x))
```
(See also #117.)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.