Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Base.big(obj::GapObj) #763

Merged
merged 1 commit into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changes in GAP.jl

## Version 0.8.0 (released 2022-03-DD)

- Upgrade to newer GAP snapshot
- Remove `Base.big(obj::GapObj)`: nothing was using it and it does not really
fit conceptually into this package.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This depends on what GAP.jl means. If it is a service package for Oscar then big is not interesting, if it is a low level interface between GAP and Julia then the situation is perhaps different.
(I am not arguing against removing the big method.)


## Version 0.7.7 (released 2022-02-14)

- Add `quiet` argument to `Packages.load`
Expand Down
1 change: 0 additions & 1 deletion docs/src/conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ Int128
BigInt
Rational
Float64
big
Char
Cuchar
String
Expand Down
40 changes: 0 additions & 40 deletions src/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,46 +77,6 @@ julia> Int128(val)
```
""" Int128


"""
big(obj::GapObj)

Return the big integer converted from
the [GAP integer](GAP_ref(ref:Integers)) `obj`,
or the big rational converted from
the [GAP rational](GAP_ref(ref:Rationals)) `obj`,
or the big float converted from
the [GAP float](GAP_ref(ref:Floats)) `obj`.

# Examples
```jldoctest
julia> val = GAP.evalstr("2^64")
GAP: 18446744073709551616

julia> big(val)
18446744073709551616

julia> val = GAP.evalstr("1/3")
GAP: 1/3

julia> big(val)
1//3

julia> val = GAP.evalstr("1.1")
GAP: 1.1

julia> big(val)
1.100000000000000088817841970012523233890533447265625

```
"""
function Base.big(obj::GapObj)
GAP_IS_INT(obj) && return BigInt(obj)
GAP_IS_RAT(obj) && return Rational{BigInt}(obj)
GAP_IS_MACFLOAT(obj) && return BigFloat(obj)
throw(ConversionError(obj, "a type supported by big"))
end

"""
Rational{T}(obj::GapObj) where {T<:Integer}

Expand Down
11 changes: 0 additions & 11 deletions test/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@
@test_throws GAP.ConversionError Float64(x)
end

@testset "big (is not a constructor but fits here)" begin
x = GAP.evalstr("2^100")
@test big(x) == BigInt(2)^100
x = GAP.evalstr("2^100/3")
@test big(x) == BigInt(2)^100 // 3
x = GAP.evalstr("2.")
@test big(x) == BigFloat(2.0)
x = GAP.evalstr("[]")
@test_throws GAP.ConversionError big(x)
end

@testset "Chars" begin
x = GAP.evalstr("'x'")
@test (@inferred Cuchar(x)) == Cuchar('x')
Expand Down