Skip to content

Dialects and floating-point precision #25

@bwllc

Description

@bwllc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions