[![Actions Status](https://github.com/tbrowder/Math-FractionalPart/workflows/test/badge.svg)](https://github.com/tbrowder/Math-FractionalPart/actions) NAME ==== Math::FractionalPart provides several routines to operate with the fractional parts of a number. All routines also operate on complex numbers. SYNOPSIS ======== ```raku use Math::FractionalPart :afrac; say (afrac -3.2); # Output <<0.2>> say (frac -3.2); # Output <<-0.2>> ``` DESCRIPTION =========== There are three different algebraic functions that operate on numbers and return their fractional parts. They all return the same result when operating on non-negative numbers, but all three return different results when operating on negative numbers. See the [References](#References) for more details. Note that Ref. 2 shows *frac* operating in the *complex plane* as `frac(x + i y) = frac(x) + i frac(y)`. The following table shows the routines that have been implemented in this module.
Name | Raku formula | Example | Notes |
---|---|---|---|
frac | x - floor(x) | frac(-1.3): 0.7 | 1 |
afrac | abs(x) - floor(abs(x)) | afrac(-1.3): 0.3 | 2 |
ofrac | x - floor(abs(x)) * sign(x) | ofrac(-1.3): -0.3 | 3 |