skill small question BUG or Specification ?

Discussion in 'Cadence' started by rubicam88, Jul 20, 2005.

  1. rubicam88

    rubicam88 Guest

    I using skill language on IC5.0.33_USR3.16.35

    The evalstring function is used to convert the character string into
    the
    numerical value.

    There is a thing with a not correct return value.

    110

    What is this?
     
    rubicam88, Jul 20, 2005
    #1
  2. This is one of the two common surprises that a new comer would see in SKILL.
    The thing is when the numerical value in the string is preceded by zero
    it is evaluated as octal code.

    The other surprise you may see in future is with the internal
    representation of floating point numbers and their print values.
    Search the older forums for this topic also to save your precise time.

    regards,
    Suresh
     
    Suresh Jeevanandam, Jul 20, 2005
    #2
  3. This is one of the two common surprises that a new comer would see in SKILL.
    The thing is when the number in the string starts with a zero
    it is evaluated as octal code. [This is documented in Skill Users Guide.
    0x is used for Hexadecimal]

    The other surprise you may see in future is with the internal
    representation of floating point numbers and their print values.
    Search the older forums for this topic also to save your precious time.

    regards,
     
    Suresh Jeevanandam, Jul 20, 2005
    #3
  4. This is not unusual either - other languages (Tcl for example) do the same
    sort of thing. It's something that always used to come up when I was actively reading the
    tcl newsgroup.

    I would generally advise against using evalstring to convert numbers. What happens if the string
    you're converting contains the value "(exit)", for example...

    You can use atoi() to convert strings to integers, and this always works in base 10.

    Regards,

    Andrew.
     
    Andrew Beckett, Jul 20, 2005
    #4
  5. Absolutely. Preceding an integer with a zero is a pretty standard way of
    indicating that it is octal, not decimal (although whether it is intuitive if
    you're not a programmer is debatable). Same thing as using '0x' for hex, but
    less obvious since there is no visual separator between the prefix and actual
    number (like the 'x' in 0x1234). Perl is exactly the same.

    Graeme.
     
    Graeme Bunyan, Jul 20, 2005
    #5
  6. rubicam88

    rubicam88 Guest

    thanks !

    My doubt was solved.
     
    rubicam88, Jul 20, 2005
    #6
  7. rubicam88

    Guest Guest

    It's correct. The leading zero means Octal (base 8). 010 == 8.

    -Pete Zakel
    ()

    "The right of citizens to bear arms is just one guarantee against arbitrary
    government, one more safeguard against the tyranny which now appears remote
    in America, but which historically has proved to be always possible."

    -Senator Hubert Humphrey
     
    Guest, Jul 20, 2005
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.