Question on using FP numbers in python 2
On Friday 14 February 2014 23:47:26 Steven D'Aprano did opine:
> On Fri, 14 Feb 2014 22:25:59 -0500, Gene Heskett wrote:
> > Greetings;
> > Is there something I can search for and fix in some python code that
> > is giving me bogus answers that get good only when there is a valid
> > digit to the left of the decimal point?
> Er, yes? Anything which involves floating point maths?
> Your question is to vague to really answer. You are basically saying
> "I'm doing some calculations [what sort of calculations?] with floats
> [how many floats? of what values?], and they're wrong [wrong in what
> way? how badly wrong?] unless there is a valid digit [which digits
> count as valid and which as invalid?] to the left of the decimal point
> in some number."
> Can you extract the float calculations and show us, together with some
> sample data, expected result, and actual result?
Not extract, but let you get & look at the code, its the top entry on this
Assume no bolt size is clicked on, but a wanted diameter is entered in the
lower left pair of boxes, and its to carve .700" deep in the other box.
The cutting tool is .250 in diameter, its to do a stepover of 25% of the
tool diameter, while carving an additional .015" out of the .850" hole with
the tool bit turning 2000 rpm as it spirals down.
But the hole it will cut will only be .650" in diameter, And the backplot,
shown in the axis interface, shows no spiral, its doing what it thinks is
full diameter in one circular plunge cut. That would leave a big post of
steel in the center, so I will have to drill it to perhaps a half an inch
just to keep from pinching & breaking a $20 bit. But that is a separate
So, I added a .2" offset to the hole diameter, making that entry 1.05".
Then I do get the spiral outward feed, but to make a hole 1.05" in
As for me fixing it, that 30+ kilobytes of python may as well be Navajo.
IOW, help please?
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>