[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: 23.99mil instead of 24mil in PCB



> I set via size in GTK PCB 20060321 in signal style to 25, OK, then
> opened again and set to 24. Then I made a via and Object Report says
> it has 23.99mil.

This seems to be a bug in the GTK units conversion (it works in
lesstif HID but fails in gtk HID).  Try changing src/hid/gtk/gui.h
(src/gui.h in the old pcb) to use this definition of TO_PCB_UNITS:

#define TO_PCB_UNITS(v)         (Settings.grid_units_mm ? \
                                ((v) / 0.000254 + 0.5) : ((v) * 100.0 + 0.5))

Adding 0.5 after the conversion turns the "truncate" double->int
conversion into a "round" conversion.  Since we're expecting whole
numbers anyway, this has the effect of dealing with any off-by-epsilon
bugs, which this appears to be.

Also, by multiplying by 100 instead of dividing by 0.01, we may avoid
other espilon bugs.