• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Cadence Skill - Totally Buggy?

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 144
  • Views 2310
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Cadence Skill - Totally Buggy?

cado
cado over 15 years ago

skill evaluates 0.142-0.142 as follows 

||(0.142 - 0.142)
||difference --> -5.273559e-16
 
and 

if(0.142==0.142) as 

||(0.142 == 0.142)
||equal --> nil
 

Is SKILL mad? 
 
min(1,2,3) gives you 1 

but make a list list1='(1,2,3) 

then min(list1) gives you => 

(1,2,3)! 

in SKILL -5.273559e-16 & 0 are the SAME!!! 

and 0.142 is not equal to 0.142!!! 
 
Could anyone try the following script and tell me about the problem?
 
cv=geGetEditCellView()
cell=cv~>cellName
wlist=list()
foreach(x cv~>shapes if(x~>lpp==list("M4" "drawing") then if(x~>width!=nil then wlist=cons(x~>width wlist) nwidth=mapw(x~>width)  
        printf("%s %f\n" "path width= " nwidth)          
        else
 bbx=x~>bBox
 ll=lowerLeft(bbx)
 ur=upperRight(bbx)
 lly=yCoord(ll)
 ury=yCoord(ur)
 llx=xCoord(ll)
 urx=xCoord(ur)
 lx=urx-llx
 ly=ury-lly
 width=min(lx,ly)
 wlist=cons(width wlist)
 nwidth=mapw(width)
 printf("%s %f\n" "Rectangle width= " nwidth)
) ;if x~>width!=nil
) ;if M4
) ; foreach shape
printf( "%s %s\n" "cell: " cell)

procedure(mapw(w)
mapwlist='(0.052,0.066,0.072,0.09,0.1,0.142,0.23)
prog(()
if(w>=0.7 then
 return(w)
 else
 match=0
 foreach(mpl mapwlist
  if(w==mpl then match++)
  )
  if(match>0 then return(w)
     else
     dlist=list()
     foreach(mpl mapwlist
      diff=abs(w-mpl)
      dlist=cons(diff dlist)
      )
       mindiff=()
       dls=0.0
       for(i 0 length(dlist)-1  dls=nth(i dlist)
      if(i!=0 then dlspre=nth(i-1 dlist)
         if(dls>dlspre then  mindiff=dlspre else mindiff=dls) else mindiff=dls)
         )    
     
      foreach(mpl mapwlist
       if(abs(w-mpl)==mindiff then
           return(mpl)
          )
            
      ) ;foreach mpl
      ) ;if match>0
      ) ;if w>0.7
      ) ;prog

)
  • Cancel
Parents
  • Riad KACED
    Riad KACED over 15 years ago

    Hi,

    1. Generally speaking, you NEVER EVER match floating numbers as you did. Use booleans, integers but not floating numbers. This is true in all the languages. Andrew has explained the reasons why. BTW, there was a little tiny typo in Andrew's. The sstatus command is: 

     sstatus(fullPrecision t)

    i.e. with no tick '

    2. What's wrong with your Skill ? What is the problem you want us to check for you ? You could have put some comments in your code for people to get some clues. Well, I have tried your Skill and don't see any errors, it ran well. Have you had any errors at all ? If yes please post the message.

    Cheers,

    Riad.

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Riad KACED
    Riad KACED over 15 years ago

    Hi,

    1. Generally speaking, you NEVER EVER match floating numbers as you did. Use booleans, integers but not floating numbers. This is true in all the languages. Andrew has explained the reasons why. BTW, there was a little tiny typo in Andrew's. The sstatus command is: 

     sstatus(fullPrecision t)

    i.e. with no tick '

    2. What's wrong with your Skill ? What is the problem you want us to check for you ? You could have put some comments in your code for people to get some clues. Well, I have tried your Skill and don't see any errors, it ran well. Have you had any errors at all ? If yes please post the message.

    Cheers,

    Riad.

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information