[Tutor] greater precision?
john at netcore.com.au
Mon Oct 29 12:39:59 CET 2012
Thanks, more insights!
> I was only concerned that there was some correction in one of the
> messages. And since there was only 3 minutes between them, i didn't
> know which might be the corrected one. They showed up here out of
> order. I responded to the one with the later timestamp.
No, mia culpa.
> Just post one of them. Otherwise, things can get very confusing.
> Actually, it's 64 bits. 32 bit fp wouldn't get you anywhere near 18 digits.
Darn, of course, you're right! Senior moment for me!
> Since the inputs to that function are ints, then the output will be IEEE
> floats. that also means that the == comparisons in the crosspoint()
> function are precise.
THAT is a very valuable insight Dave, thanks!
> Actually, the base change is already happening. Using Decimal would
> probably reduce the number of base changes. And if you create the
> numbers as Decimal objects, then they'll propagate through the
> crosspoint() function correctly. However, even though the decimal
> module supports log and sqrt, I don't know how to do trig with it.
Well, as trig is *core essential* to polyhedra maths, I *have* to
use *lots* of it!
> Incidentally, I didn't suggest the fractions module, since you're
> presumably going to be doing trig on the results, so I don't see the
Yes. Core maths is +,-,*,/,sin,cos,tan (and their inverses), sqrt,
^2,^3, (ie, exponentials), etc off hand.
> BTW, I misspoke earlier. The module name is decimal. The class name
> within that module is Decimal.
A minor thing to me, a non programmer, but I do understand that being
very precise is very important to programmers, so thank you!
More information about the Tutor