← Back to team overview

kicad-developers team mailing list archive

bug: MM_PER_IU definition

 

Current definition:

convert_from_iu.h:        #define MM_PER_IU   1.0 / 1e5         // Gerbview uses 10 micrometer.
convert_from_iu.h:        #define MM_PER_IU   1.0 / 1e6         // Pcbnew in nanometers.

The current definition should be enclosed in () to ensure correct interpretation when dividing.

X / MM_PER_IU  = X / 1.0 / 1e6 = X / 1e6 (wrong - user wants X * 1e6)

Forms for acceptable definitions:

#define MM_PER_IU 1e-5
#define MM_PER_IU ( 1.0 / 1e5 )


I didn't look into usage throughout the code - correcting the definition might break some things which currently work by accident.

- Cirilo