pcb-rnd knowledge pool


Large boards, 64 bit coordinates

large_board by Tibor 'Igor2' Palinkas on 2018-04-20

Tags: insight, large, board, size, coordinate, 64, 32, bit

node source



Abstract: As of version 2.0.0 (starting from svn r16618), pcb-rnd supports large boards. Large means up to many 10 meters. This node deals with what had to be fixed and what sizes/precisions are to be expected.


What is 32 vs. 64 bit boards

This is a rarely used feature, but for some users and some exotic use cases it is very useful: if you configure pcb-rnd with --coord=64 , the code is able to handle real large numbers in coords. The default is using 32 bit coords to save on memory usage and CPU cycles on 32 bit systems. Our internal resolution is still nanometers.

We had multiple bugs regarding to large board handling: some HID API did not pass pcb_coord_t but int, some GUI HID internals made the same mistake, some event handling took int instead of pcb_coord_t too. As long as we were on 32 or 64 bit system with coords configured to 32 bit these bugs were transparent as sizeof(int) matched sizeof(pcb_coord_t).

The largest board we can handle in 32 bit mode is about 2.1 meters. This should be good enough for majority of the use cases. Thus I do not plan to change the defaults, but it's good if you remember we have an option for larger boards in case you need them (not necessary for producing PCBs).

64 bit limits

The largest board we can handle in 64 bit mode is in theory 9223372 kilometer wide - that is about 24 times the distance between Earth and Moon.

In practice even with 64 bit coords we do a lot of double precision floating point calculations, so it's more likely that the code breaks above 4503 kilometers. (Such a board could cover most of Australia and still reach the shore of New Zeland.)

I haven't tested this, but knowing how some calculations are done, true nanometer precision, without rounding error is guaranteed only on boards smaller than 67x67 mm (coord size does not matter). Going above this size will introduce precision loss: boards up to 134*134 mm may have roudning errors of +-1 nm, boards up to 268*268 mm may have +-2 nm errors, boards up to 536*536 mm may have +-4 nm errors. According to this speculation, to get a +-1 micrometer error, the board size would need to be above 68 meters. So even with the floating point rounding errors, it is reasonable to assume we can design even few 10 meters large boards without noticable error when exported to e.g. gerber.

Note: the above error values are estimated, but not tested.