Variable sized floating points

A lot of selfrespecting programming languages have got Integer classes which theoraticly can have an unlimited size by using a dynamic array underneath it.
Python got it, and lots of others too.
But still, they haven’t got a variable sized floating point, which I find odd for it shouldn’t be a big problem to create:

  • Wrap one existing variable sized Integer
  • Add an integer which points to the place where the point will be
  • Add operator overrides to get it working
  • Add an integer which specifies how much numbers after the dot there will be

The later one is quite important to have got. We wouldn’t want 1 /3 causing an infinite loop.

You even could do it a second way:

  • Wrap two existing variable sized Integers.
  • Add overriden operators to get it working

These 2 integers would represent a fraction: a / b.

By storing the fraction in stead of the result you are actually very precise, although some numbers cannot be represented in this way, but can be approached.