The functionalities that are implemented here are mostly just for the purpose of 'building it myself'. It was a fun challenge to build formatters for base-3, base-5 and base-7 number representations, which are also p-adic numbers due to the base being a prime number. Speaking of prime numbers, there is also a generator for prime numbers in this library, just in case one is needed.
Upon looking at the signatures of the classes their capabilities should be clear at a glance. They are also documented, so there should be little confusion as to how they are used. A little side node for the PrimeInteger
, since
this struct has an implicit conversion, it can throw runtime exceptions for wrong parameters while also providing a clear signature of was a method expects. For example public void Foobar(PrimeInteger prime)
clearly conveys the intent and what the
method expects as parameter.
- Prime Stuff
static class PrimeGenerator
struct PrimeEnumerator
readonly struct PrimeInteger
- Formatters
interface IIntegerFormatter<TInteger>
interface IFloatingPointFormatter<TFloatingPoint>
sealed class RomanIntegerFormatter
sealed class ThreeAdicIntegerFormatter
sealed class ThreeAdicFloatingPointFormatter
sealed class FiveAdicIntegerFormatter
sealed class FiveAdicFloatingPointFormatter
sealed class SevenAdicIntegerFormatter
sealed class SevenAdicFloatingPointFormatter