Er, thanks but I forgot about very big and very small values and a few other things. So while that code looks right there are bugs. The good news is that I've fixed it.
just found and fixed another bug. I think that's it now but I'm not sure.
another change, removed a bit that wasn't needed.
last edit, fixes a rounding error and adds a cheat if less than 1.
Edit: see below.
just found and fixed another bug. I think that's it now but I'm not sure.
another change, removed a bit that wasn't needed.
last edit, fixes a rounding error and adds a cheat if less than 1.
Edit: see below.