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

Re: gEDA-user: pcb crooked traces



Andrew:
> On Sat, Oct 09, 2010 at 12:22:52PM +0200, Karl Hammar wrote:
> > You cannot dissmiss floating point on the ground of rounding error
> > when in fact the rounding error of integers (aliasing, truncation)
> > are in fact greater.
> > 
> > You cannot dissmiss floating point on the ground of a "non exact"
> > equality operator, boot integers and floats, when 1 == 1nm, suffers
> > from beeing too fine grained. You will not see any difference for
> > +/- 100 basic units when looking at the board, even with a microscope.
> 
> My concern is not with "ordinary" numbers and their rounding error,
> but with extremely large ones.
> 
> Once you get past the 52 digits in an IEEE-754 double (about 4500km in
> nanometers, so maybe I am being silly), you lose precision. You will
> no longer be able to place things with nanometer precision, which means
> that your 254-nm mils will no longer be accurate.

Ok, if you really want that great precision, you could either use
a "long double" or some for of arbitrary-precision arithmetic, see
http://en.wikipedia.org/wiki/Bigint or e.g http://gmplib.org/.
But I would consider that clearly out of scope for pcb.

> Then, you've got rounding error and you're in the same place we are
> now.

Regarding the rounding error claim.

The error is there and it is easy to prove it. But I think you should
not overestimate it. Take a look at:

$ cat testc.c
#include <stdio.h>

int main(int argc, char *argv[]) {
  double ui = 1e6 * 25.4; // um per inch
  int ix;

  double inch = 0;
  int um = 0;

  int umpitch = argc > 1 ? atoi(argv[1]) : 800; // pitch in um
  double inpitch = umpitch/ui; // dito but in inches

  for (ix = 0; ix < 1000; ix++) {
    inch += inpitch;
    um   += umpitch;
  }

  printf("%g %g %i\n", inch, inch*ui, um);
  printf("%g\n", inch*ui - um);

  return 0;
}
$ ./testc
0.0314961 800000 800000
-2.04558e-08
$ ./testc 300000
11.811 3e+08 300000000
6.77645e-06
$ ./testc 300   
0.011811 300000 300000
3.38861e-09
$

This test shows that if we have inches as our basic unit, and using
a hypotetical 1000pin connector, the error we get is clearly below 
the um range for 0.8mm, 0.3m, and 0.3mm pitch.

I consider thoose errors insignificant.

Regards,
/Karl Hammar

---------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57




_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user