# Re: [PEDA] What's wrong with my query language program

On 02:47 AM 12/02/2004, Mr. Zhang Yangtian said:
I had write one line of query language in ProtelDXP as the following:

IsTrack and ((ABS(X1-X2)-ABS(Y1-Y2))=0)

Its target is to find out all the tracks with their lean at 45-degree or 135-degree. After the execution of the program, some tracks are found while some tracks satisfied with the constrain are leaked. I guess that the reason is the precision of floating point number calculation. So I change it to the following format:

IsTrack and ((ABS(X1-X2)-ABS(Y1-Y2)) between -1 and 1).

But this time, strange things happen: the queried tracks are nearlly all the tracks with 0 degree, not 45-degree or 135-degree. Who can tell me why. Is it a bug of DXP?

Are they short tracks? Your query will pick up all short tracks regardless of angle - lets say you have the PCB units set to metric. Lets say you have a line from (10mm,10mm) to (10.5mm,10mm). ABS(X1-X2)=0.5mm and ABS(Y1-Y2)=0mm. So ((ABS(X1-X2)-ABS(Y1-Y2)) is 0.5mm which satisfies your query. Bevan's suggestion to find the angle is much more robust and will not be fooled by short lines.

As for the problems reported in other emails with the ROUND function - there does seem to be a problem with it. If this was being discussed on the DXP forum you would get the programmers passing comment and logging the bug - but many insist that this is the place to discuss DXP and so miss the chance of liaising with the programmers - so be it. If you think there is a bug in the ROUND routine I suggest you raise it on the dxp forum - it may get logged and fixed then.

```You can make a ROUND function using a TRUNC (or INT) function:
TRUNC(value+0.5)
is equivalent to a round.

```

```IsTrack and not (IsVertical or IsHorizontal)
will get all tracks that are neither vertical or horizontal.```

```IsTrack and IsOblique
will get only the 45 degree tracks```

IsTrack and IsElectrical and not (IsVertical or IsHorizontal or IsOblique)
will get all tracks that are neither 45deg or horizontal or vertical that are on a signal or multi-layer layer and have a net other than "No Net". Quite useful if you want want to make sure all you tracks are neat and tidy.

```Bye for now,
Ian```

```* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* To post a message: mailto:[EMAIL PROTECTED]
*
* To leave this list visit:
* http://www.techservinc.com/protelusers/leave.html
*
* Contact the list manager:
* mailto:[EMAIL PROTECTED]
*
* Forum Guidelines Rules:
* http://www.techservinc.com/protelusers/forumrules.html
*
* Browse or Search previous postings:
* http://www.mail-archive.com/[EMAIL PROTECTED]
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
```