[ANN] InstaRound.jl

I am excited to share one of the Julia packages I worked on during the summer.

InstaRound.jl is a small utility Julia package which extends Base.round with a more human readable rounding style. This is useful for anyone who prefers numerical outputs in a more interpretable format.

using InstaRound

julia> round(IGRound, 1_000_000; names=false)
"1.0M"

julia> round(IGRound, 1_000_000; names=true)
"1.0 Million"

Main Feature

  • Covers all representations up to 10^69 (‘Unvigintillion’ - I never heard of it until this project).

Any form of a feedback will be greatly appreciated.

Special mention to @Skoffer for his brilliant (as always) conversion of the problem into a neat mathematical representation.

16 Likes

Why not use common scientific notation?

1 Like

That could also be an option for users. The focus here was to move to more ‘grammar’ like conventions.

1 Like

This package is doing two separate things. 1) rounding a number. and 2) converting a number to a particular string representation. You might want to consider separating these features, although that would be somewhat more ambitious.

1 Like

And what convention is it using, the long or short scale?

Seems short scale is used otherwise Univigintillion would be much bigger :smiley:

https://integers.info/large-numbers/unvigintillion

According to that, the short scale was adopted for this project.

I second @jlapeyre’s suggestion: rounding to human-readable quantities and converting to String should be separate functionalities.

Eg you could make round return a wrapper defined by your package that subtypes <: Real, and have string convert it to a string.

1 Like