lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Numerics


From: Vadim Zeitlin
Subject: Re: [lmi] Numerics
Date: Sat, 7 May 2016 20:16:51 +0200

On Mon, 2 May 2016 15:16:29 +0000 Greg Chicares <address@hidden> wrote:

GC> > so apart a unit test class
GC> > for this class itself (which I'll write, but it will be pretty trivial), I
GC> > don't see what could I test.
GC> 
GC> ...if you'll write the unit test. I'm hoping that a unit test will prove the
GC> lack of any runtime penalty. Other lmi unit tests use a high-precision timer
GC> that might be useful here.

 I haven't yet done the performance measurement part as it turned out that
writing this class was not as trivial as I thought, notably the constructor
from dollars and cents (politically correctly called "units" and "subunits"
in my code) was problematic as I wasn't sure if it should be allowed to
create negative objects or even if it should be provided at all. Finally
I've chosen to only allow positive amounts in this ctor to avoid confusion
but I'm not sure at all if you agree with this decision, so I'd like you to
have a look at it here:

        https://github.com/vadz/lmi/blob/currency-class/currency.hpp

The full commit, including changes to the makefiles and the unit test is at

        
https://github.com/vadz/lmi/commit/4b3acfb7544541d40f302dc824f1b423088f7fe4

and I've tested that the test passes both when cross-compiling and when
using the native build system.

 Clearly, more things could be added to the class itself and the test (in
addition to the performance tests mentioned above, I'd also like to add
more extensive checks for other methods using random values), but I think
this initial version could already profit from your review, so I'd be
grateful if you could please let me know what do you think of it.

 Thanks in advance!
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]