I've switched the tempo editor over to HSpinBox, which fixed the problem of
entering 120.123 and spitting out 120.0, but there's still something screwy
going on here.
entered: event list: ruler:
120.1 120.0 120
120.2 120.19 120.20 <--!!
120.3 120.30 120.30
120.4 120.40 120.40
120.5 120.50 120.50
120.6 120.59 120.60 <--!!
120.7 120.69 120.70 <--!!
120.8 120 120 <--!!!!
120.9 120 120 <--!!!!
120.123456 120 120 <--!!!!
867.5309 867 867 <--!!!!
100.9876 100.98 100.98 <--!
867.54321 865.54 867.54 <--!
Also, when re-editing the tempo, the box is set with
HSpinBox::setValuef(tempo) where tempo is
double tempo = comp.getTempoAt(m_tempoTime);
It invariably sets without the decimal places, so the dialog comes up
with .000000 no matter what.
HSpinBox::valuef() is a float, while tempo is a double. I'm wondering if
something is going awry with float -> double -> float conversion.
I have to admit I've never actually had any occasion to use floating point
variables for any but the most obscenely trivial tasks (currency
calculations, for example) and I really don't even fully appreciate what the
difference between a float and a double is. Six digits of precision vs. 10.
So that's six digits, no matter where the decimal is? I guess? This book
doesn't really explain anything.
If the limit on the left of the decimal is 1000, that means we can't really
have six digits after then. Not if this thing returns floats. It's
currently using six decimal places, as the original kludged up version did.
Am I missing the point? The reason I didn't major in CS is because I flunked
the math achievement test, and couldn't get admitted as a CS major. I
understand bits and bytes, but I don't have much of an idea how floating
point math works on computers. Sorry I'm such a retard.
Anyway, maybe the pattern above will say something to someone. I haven't
looked at where else the tempo might be getting munged either.
Michael McIntyre ---- Silvan <dmmcintyr@...>
Linux fanatic, and certified Geek; registered Linux user #243621
Get latest updates about Open Source Projects, Conferences and News.