Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thetardigrade/golang-ordersofmagnitude
This Go package determines the order of magnitude of a number.
https://github.com/thetardigrade/golang-ordersofmagnitude
go golang order-of-magnitude string-algorithms
Last synced: 5 days ago
JSON representation
This Go package determines the order of magnitude of a number.
- Host: GitHub
- URL: https://github.com/thetardigrade/golang-ordersofmagnitude
- Owner: theTardigrade
- License: gpl-3.0
- Created: 2023-01-10T10:03:14.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-15T12:10:56.000Z (over 1 year ago)
- Last Synced: 2024-06-21T13:56:15.821Z (5 months ago)
- Topics: go, golang, order-of-magnitude, string-algorithms
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# golang-ordersOfMagnitude
This package exposes a single function, ```Name```, which describes the order of magnitude of a number.
[![Go Report Card](https://goreportcard.com/badge/github.com/theTardigrade/golang-ordersOfMagnitude)](https://goreportcard.com/report/github.com/theTardigrade/golang-ordersOfMagnitude)
## Example
```golang
package mainimport (
"fmt"ordersOfMagnitude "github.com/theTardigrade/golang-ordersOfMagnitude"
)func main() {
const exampleNumber = 12_345_678_912fmt.Printf(
"The number %d has an order of magnitude in the %s.\n",
exampleNumber,
ordersOfMagnitude.Name(exampleNumber),
)
}
```Running the example code above should produce the following output:
```
The number 12345678912 has an order of magnitude in the tens of billions.
```