Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 2.02 KB

README.md

File metadata and controls

46 lines (33 loc) · 2.02 KB

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.