8.10.2011

It's an exceptionally awesome feeling if you can define number systems based on random sequential character values. Now I can successfully decode and write string number formats for any base with all characters I want! Though I had to drop thousands seperators due to necessary format complexity (I preffered the small, waitable code over a plethora of special case ifs), it's very comftable. You can trigger sign fraction and integer on/off and optional, set a minimum/maximum digit count, etc, etc... The resulting format is a struct for storing the integer part, fraction, whether it's negative or not as well as the fraction part's divider value based on the given base when parsing (also made up of sub structs). It surely requires more memory, but the benefit of converting to any possible in/out format is unbeatable. Really lovely, now I only have to write additional functions for converting to standard types, rounding and guessing the length necessary to convert back to string. I'm quite proud of this I have to say... I love when things work fine and for all possible cases - something I've definitely reached here. But hm, guessing the resulting print length will be a bit more tricky this time. Especially because I'd need to number format iself to temporarily store it, which's digit count depends very much on the chosen base, hm... Or I cut out the digit count and measure this by the resulting pointer delta... Maybe I should also write an additional function for reading digit grouping like using zthe thousands operator. Step by step, function by function.

No comments: