diff options
| author | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2023-09-04 19:53:20 -0500 |
|---|---|---|
| committer | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2023-09-04 19:53:20 -0500 |
| commit | d034179fde42c4fc633b98fef6e84c2e0d1c2834 (patch) | |
| tree | a9969a5ab054d4db50d6eb18f9710af5855c60fa /factor_info.go | |
| parent | a663fa77cde6ad48f29abd6973211c179ff32464 (diff) | |
Add ability to show full digit maps
Full digit maps will show every digit from 0 to 35, regardless of the
radix. This allows you to see extra fractions for small radices and to
get a digit map for radices above 36.
This isn't enabled by default because the extra "digits" added for small
radices aren't actually digits - so it may be unintuitive. There are
also some situations where only a radix's actual digits matter, such as
multiplication tables.
Diffstat (limited to 'factor_info.go')
| -rw-r--r-- | factor_info.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/factor_info.go b/factor_info.go index b6a4a3d..f908b9b 100644 --- a/factor_info.go +++ b/factor_info.go @@ -49,7 +49,7 @@ type FactorInfo struct { DigitMap []factors.DigitType } -func GetFactorInfo(radix uint) *FactorInfo { +func GetFactorInfo(radix uint, fullMap bool) *FactorInfo { r_factors := factors.Factors(radix) slices.Sort(r_factors) @@ -66,7 +66,12 @@ func GetFactorInfo(radix uint) *FactorInfo { } var digitMap []factors.DigitType - if radix <= maxSmallRadix { + if fullMap { + digitMap = make([]factors.DigitType, maxSmallRadix) + for d := 0; d < maxSmallRadix; d++ { + digitMap[d] = factors.GetDigitType(uint(d), radix) + } + } else if radix <= maxSmallRadix { digitMap = factors.DigitMap(radix) } else { digitMap = []factors.DigitType{} |
