October 09, 2008Re: Units of Measure in F#
Posted in reply to Denis Koroskin
Reply to Denis, > On Thu, 09 Oct 2008 23:35:58 +0400, BCS <email@example.com> wrote: > >> Reply to Walter, >> >>> This has been done in D already: >>> >> It has some interesting features :) (I might have to steal a few for >> my version) >> > I still think my version is superior (it handled floating point > powers, Re: FP, I would count that as worse than basic integers because it runs the risk of FP rounding errors. Mine will handle rational powers (1/2, 23/43, etc) and won't suffer from the loss of precision. The only places I have ever seen non rational exponents in use are in data fitting applications and just switching to a close enough rational is as good as anything there. Also, the non rational cases where mine might suffer little are the cases where FP problem are /most/ likely to crop up. > supports an arbitrary number of basic units (given that they > are orthogonal) and allows adding them with no original code > modification) :p > You may have me on for that point, but extensibility also has it's down side; different people add the same dimension independently and then someone wants to mix them. The 5 dimensions I picked will cover almost all that cases for just about anyone. I think we each picked a different set of design choices and created a solution for them. I do think that mine is better than yours by the criteria I'm using. I can see legitimate criteria where yours is better.