← Back to team overview

kicad-developers team mailing list archive

Re: Question about gerber job file numeric format


Safest would be (b).

We could probably do something pretty dumb (ie: set a single value in the JSON printer which it uses for precision).

> On 24 Dec 2019, at 15:22, Jon Evans <jon@xxxxxxxxxxxxx> wrote:
> Hi all,
> The Gerber job file specification[1] says that the format follows the JSON standard, and doesn't say much else about numeric value storage.
> But, in the examples in that spec, decimal (floating-point) values are all truncated with only a few digits after the decimal point.
> The manual JSON generation code that exists today follows along these examples, truncating floating-point numbers using formatting like %.3f and so on.  Now I'm working on switching us over to using a library for this JSON generation, but it will output floating-point values as doubles without any such truncation.
> For computer software reading these job files, I would guess this has no impact.  But for humans opening up the file, they may find that the numbers stored don't match their expectations.
> What should we do about this?
> (a) nothing, storing doubles in the file is fine
> (b) find some way to manually truncate/round values to some precision, but still write them to the file as "decimals" -- if so, what should the spec be for this rounding / truncation?
> (c) something else?
> Best,
> Jon
> [1] https://www.ucamco.com/files/downloads/file/209/the_gerber_job_format_specification.pdf <https://www.ucamco.com/files/downloads/file/209/the_gerber_job_format_specification.pdf>_______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

Follow ups