Skip to content

Rational of Base.hastypemax(BigInt) (not exported) vs typemax(BigInt) = Inf #39344

@o314

Description

@o314

BigInt is unbounded by construction, but is not reachable via the classical typemax/typemin public api
https://github.com/JuliaLang/julia/blob/v1.6.0-beta1/base/exports.jl#L348

Instead of that, one has to deal with the Base.hastypemax function that is not exported,

  • it is unnecessary
  • if my comprehension is correct, code could go broken at any new version, not only major
    a contrario of typemax/typemin
  • if involves writing wrapper at the consumer side

Can we, instead of

hastypemax(::Type{BigInt}) = false

@ https://github.com/JuliaLang/julia/blob/v1.6.0-beta1/base/gmp.jl#L263

define those lines :

typemax(::Type{BigInt}) = Inf
typemin(::Type{BigInt}) = -Inf # may be too

BTW hastypemax seems to be barely used (3 times) https://github.com/JuliaLang/julia/search?q=hastypemax
pace of change / risk of break seems not to be a hurdle

or is there any good motive to not do it ?

Metadata

Metadata

Assignees

Labels

bignumsBigInt and BigFloat

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions