Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialects and floating-point precision #25

Open
bwllc opened this issue Mar 3, 2020 · 1 comment
Open

Dialects and floating-point precision #25

bwllc opened this issue Mar 3, 2020 · 1 comment

Comments

@bwllc
Copy link

bwllc commented Mar 3, 2020

Thanks for this useful project!

I am working with GCode files which specify measurements in inches to 6 decimal places (and yes, this level of precision can matter on professional tools). The default linuxcnc dialect in pygcode appears to be parsing my files without difficulty. However, I noticed that all numbers were being rounded to 3 decimal places. The rounding is performed on line 33 of https://github.com/fragmuffin/pygcode/blob/master/src/pygcode/dialects/linuxcnc.py:

CLEAN_FLOAT = lambda v: "{0:g}".format(round(v, 3))

To proceed with my current project, I will simply modify my local copy of pygcode to round to 6 decimal places. However, I wonder whether I should register another dialect instead, perhaps I could call it "precise". The dialects section of pygcode appears to be incomplete. I'd like to start a discussion about what the author's intentions are for pygcode dialects, and how best to use them.

@petaflot
Copy link

petaflot commented Mar 8, 2024

see https://github.com/petaflot/pygcode ; you are welcome to make a pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants