<commit_before># intmath
Migrated from code.google.com/p/intmath

##About
This library extends the Go math library with math packages for the int, uint, int32, uint32, int64 and uint64 types. The standard Go math library uses float64 for everything. This often requires casting both input and result, resulting in more verbose and (possibly) slower code.

Note that the dedicated FPU in your computer can be so fast that casting to and from float64 would be faster than using integer math for certain operations (most notably calculating the square root).

## Installing
    go get github.com/thomaso-mirodin/intmath/

## Usage

[![GoDoc](https://godoc.org/ggithub.com/thomaso-mirodin/intmath?status.svg)](https://godoc.org/github.com/thomaso-mirodin/intmath)

The root intmath package is only used for godoc documentation, and testing and benchmarking. Import the relevant sub-package to use math functions tailored to the type of choice:

    package main

    import (
        "github.com/thomaso-mirodin/intmath"
    )

    func main() {
        a := 3
        b := 4
        c := intgr.Sqrt(a*a + b*b)
        println(c)
    }

Functions take and return types matching the type of the package (with some obvious exceptions). Think of it as the good bits of function overloading without the bad: the functions have the same name in every library, but the package name determines the type. Compare the code examples using the standard math library, a hypothetical library throwing all types in the same library, and this library:

    c := int(math.Pow(float64(a), float64(b)))
    k := uint32(Math.Pow(float64(i), float64(j)))<commit_msg>Fix import in the example in README.md<commit_after># intmath
Migrated from code.google.com/p/intmath

##About
This library extends the Go math library with math packages for the int, uint, int32, uint32, int64 and uint64 types. The standard Go math library uses float64 for everything. This often requires casting both input and result, resulting in more verbose and (possibly) slower code.

Note that the dedicated FPU in your computer can be so fast that casting to and from float64 would be faster than using integer math for certain operations (most notably calculating the square root).

## Installing
    go get github.com/thomaso-mirodin/intmath/

## Usage

[![GoDoc](https://godoc.org/ggithub.com/thomaso-mirodin/intmath?status.svg)](https://godoc.org/github.com/thomaso-mirodin/intmath)

The root intmath package is only used for godoc documentation, and testing and benchmarking. Import the relevant sub-package to use math functions tailored to the type of choice:

    package main

    import (
        "github.com/thomaso-mirodin/intmath/intgr"
    )

    func main() {
        a := 3
        b := 4
        c := intgr.Sqrt(a*a + b*b)
        println(c)
    }

Functions take and return types matching the type of the package (with some obvious exceptions). Think of it as the good bits of function overloading without the bad: the functions have the same name in every library, but the package name determines the type. Compare the code examples using the standard math library, a hypothetical library throwing all types in the same library, and this library:

    c := int(math.Pow(float64(a), float64(b)))
    k := uint32(Math.Pow(float64(i), float64(j)))
{'fraction_non_alphanumeric': 0.07541478129713423, 'fraction_numerical': 0.014479638009049774, 'mean_word_length': 3.8127721335268503, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1808388', 'n_tokens_mistral': 965, 'n_tokens_neox': 898, 'n_words': 415}