Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

How does Mastercam round numbers?


randymcdermott
 Share

Recommended Posts

That's why it is important to use only 25.4 when doing metric conversions. Converting from a metric number to inches you must divide the metric number by 25.4 and when converting from an inch number to metric you must multiply the inch number by 25.4. Using 25.4 eliminates roundoff from the calculation and lets you round off only the answer if needed.

Link to comment
Share on other sites

I stand corrected with tail between my legs:

 

Hi, Randy.

 

As Randy wrote to Dr. Math

On 03/08/2005 at 09:15:11 (Eastern Time),

>[Question]

>I'm a 53 year old CAD/CAM programmer who uses Mastercam software to

>program CNC milling machines. Periodically an NC program will cause a

>"Circle End Position Incorrect" error when we run it on the machine.

>

>I am told that Mastercam uses 8 place decimal numbers for

calculations

>then rounds the results to 4 places concidering only the 5'th decimal

>as to whether the 4'th is incremented or not. My web search tells me

>that this is the accepted method. ex: 1.54534652 = 1.5453

>

>Math was never my forte and it was a long time since I was in school

>but I think (and my boss (Mech. Engineer) agrees) the method I

learned

>was to consider all the dicimals to the right of the required number of

>decimal places resulting in:

>

>1.54534652

>1.5453465

>1.545347

>1.54535

>1.5454 (subtract 1.5453 = .0001 differance)

>

>When I alter the value in the program to my result and run it again, we

>get no error.

>

>Has the accepted method of rounding changed since I was a kid or has

>memmory failed me and the problem lies elseware?

>

>Randy McDermott

 

There is an alternate method of rounding that some people learned in

school and write up about, but it is not the method you describe.

Your method gives clearly incorrect results.

 

When you round a number to the nearest 0.0001, you are finding the

multiple of 0.0001 that is closest to your number. In your example,

the two closest multiples of 0.0001 are 1.5453 and 1.5454. Which is

closer to 1.54534652?

 

1.54534652 - 1.5453 = 0.00004652

1.5454 - 1.54534652 = 0.00005348

 

This shows that 1.5453 is closer, and therefore is the correct answer.

 

There is no reason to consider digits to the right of the fifth

decimal place, as long as you are using the rule that you round down

if the fifth decimal place is LESS THAN 5, and round up if the fifth

decimal place is 5 OR GREATER.

 

The alternate method has to do with what you do when the fifth

decimal place (in your example) is EXACTLY 5, and there are NO digits

to the right of it. This does not appear to be relevant to your

situation.

 

I have no idea why rounding your way results in the program reporting

no error. I'd need to know more about the situation to even make a

guess.

 

- Doctor Rick, The Math Forum

Link to comment
Share on other sites

Hey Laszlok,

 

You're right re: 25.4 I was trying to be funny when I said:

 

My calculator seems to work the same as your's (12.4537 rounded to 2 places = 12.45) but if that's true, knowing that 1mm/25.4 = .039370079", one could round the result to 5 places (.03937) and multiply that by 25.4 and get 1mm when in fact you get .999998000 (is there a smiley for "tongue in cheek?)

 

Thanks for the input.

 

Randy

Link to comment
Share on other sites

One thing I forgot to mention earlier regarding rounding of numbers. I run across a lot of "custom" posts (generally older posts) where individuals have changed the values for the first format statement (fs 1 or fs2 1). In our modern posts (which use fs2) this is set to 7 places (inch) and 6 places (metric):

 

fs2 1 0.7 0.6 #Decimal, absolute, 7 place, default for initialize

 

This format is applied to all initialized variables and internal variables that do not get explicitly formatted to another format. So, the raw x, y, z, etc... are all formatted using this format unless they are changed using a FMT statement. The problem is that I often see this changed to 4 or 3 places. Doing this is going to have a negative impact on internal calculations (in fact, Roger had a problem with helix's due to fs 1 being set to 4 places just this week). I highly recommend leaving it set to 7 or 6 places and defining a new format statement if you need one.

Link to comment
Share on other sites
  • 1 year later...

I found this thread when I did a search for 5 decimal points post output.

Paul Decelles said "Starting with MP 9.18 internal calculations are performed using a new tolerance setting in the post called 'mtol'."

I don't see "mtol' on my post. I assume this is new to Mastercam X. How can I output 5 decimal points with MC 9?

Link to comment
Share on other sites

Look for this in your post. You should change the fs2 and fs3 first value if you use Imperial numbers, and the second value if you use metric. I am a post weakling here so save a backup and check your output, before you run anything. This is what I ran on a makino with 5 deciaml place readouts.

 

#Default english/metric position format statements

fs2 1 0.7 0.6 #Decimal, absolute, 7 place, default for initialize ( smile.gif

fs2 2 0.5 0.3 #Decimal, absolute, 5/3 place

fs2 3 0.5 0.3d #Decimal, delta, 5/3 place

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...