https://github.com/reactivebayes/tinyhugenumbers.jl
The package exports context dependent tiny and huge numbers.
https://github.com/reactivebayes/tinyhugenumbers.jl
Last synced: 4 months ago
JSON representation
The package exports context dependent tiny and huge numbers.
- Host: GitHub
- URL: https://github.com/reactivebayes/tinyhugenumbers.jl
- Owner: ReactiveBayes
- License: mit
- Created: 2022-09-29T10:29:45.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-07-24T12:34:10.000Z (11 months ago)
- Last Synced: 2025-09-20T08:50:12.396Z (9 months ago)
- Language: Julia
- Size: 120 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TinyHugeNumbers
[](https://reactivebayes.github.io/TinyHugeNumbers.jl/stable/)
[](https://reactivebayes.github.io/TinyHugeNumbers.jl/dev/)
[](https://github.com/reactivebayes/TinyHugeNumbers.jl/actions/workflows/CI.yml?query=branch%3Amain)
[](https://codecov.io/gh/reactivebayes/TinyHugeNumbers.jl)
[](https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/report.html)
The `TinyHugeNumbers` package exports `tiny` and `huge` objects to represent tiny and huge numbers. These objects aren't really numbers and behave differently depending on the context. They do support any operation that is defined for Real numbers. For more info see Julia's documentation about promotion.
`tiny` represents a (wow!) tiny number that can be used in a various computations without unnecessary type promotions.
`tiny` is defined as:
- `1.0f-6` for `Float32`
- `1e-12` for `Float64`
- `big"1e-24"` for `BigFloat`
- `10 * eps(F)` for an arbitrary type `F <: AbstractFloat`
```julia
julia> tiny
tiny
julia> 1 + tiny
1.000000000001
julia> tiny + 1
1.000000000001
julia> 1f0 + tiny
1.000001f0
julia> big"1.0" + tiny
1.000000000000000000000001
julia> big"1" + tiny
1.000000000000000000000001
```
`huge` represents a (wow!) huge number that can be used in a various computations without unnecessary type promotions.
`huge` is defined as:
- `1.0f+6` for `Float32`
- `1e+12` for `Float64`
- `big"1e+24"` for `BigFloat`
- `inv(tiny(F))` for an arbitrary type `F <: AbstractFloat`
```julia
julia> huge
huge
julia> 1 + huge
1.000000000001e12
julia> huge + 1
1.000000000001e12
julia> 1f0 + huge
1.000001f6
julia> big"1.0" + huge
1.000000000000000000000001e+24
julia> big"1" + huge
1.000000000000000000000001e+24
```