Scientific numbers in any base built on Fin
.
Scientific b
is actually isomorphic to the numbers representable as a finite sum of powers of the base b
.
One should note that the arithmetic built on Fin
is quite slow, but still might be useful, since it has arbitrary precision.
x, y : Scientific 10
x = 42069
y = -1337
Data.Scientific> prettyShowScientific $ x + y
"4.0732e4"
I would appreciate some help with this:
- can't have implementation
Num (Scientific (S (S b)))
, since the methods need access tob
There is still some stuff I want to do:
toInteger
,toNat
,toFin
fromDouble
,toDouble
- multiplication
*
- switching base from
b
ton * b
withn : Nat
- parsing with
Text.Token
,Text.Lexer
andText.Parser
- use in a JSON library
And some things should be possible but are a little far fetched at the moment:
- division by factors of the base
b