Skip to content
/ digit Public

The module contains functions that return the number of digits.

License

Notifications You must be signed in to change notification settings

7R35C0/digit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

The module contains functions that return the number of digits for a number, using various algorithms.

The code is based on following sources:

📌 Implementation

All functions return the number of digits for a supported number, otherwise null.

Supported number types and ranges:

  • .ComptimeInt, .Int: ∓340282366920938463463374607431768211455
    • min(i129) = -340282366920938463463374607431768211456 it is accepted to cover the type
  • .ComptimeFloat, .Float:
    • comptime_float: ∓10384593717069655257060992658440193
    • f16: ∓2049
    • f32: ∓16777217
    • f64: ∓9007199254740993
    • f80: ∓36893488147419103234
    • f128: ∓10384593717069655257060992658440193

Note that for float numbers the type is important, for example:

  • 2050 as f16: returns null
  • 2050 as f32: returns 4, same as for any type greater than f16

Negative numbers are converted to their absolute value.

📌 Final note

More information about digit counting algorithms can be found in the sources, links above. Also, some usage examples are in the demo files.

About

The module contains functions that return the number of digits.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages