floating point representation

Discussion in 'Cadence' started by noreply, Jun 29, 2009.

  1. noreply

    noreply Guest

    Dear all,
    I have the following problem with the floating point representation.
    (of course, i viewed the previous posts on the related subject and got
    lot of info).
    In my skill program, i manipulate the numbers(arithmetic calculations)
    and pass it on as a parameter to the instance(in my case, the width of
    the mosfet was the parameter).unfortunately most of the time, the
    number turns out to be a floating point and i get the width of the
    transistor to be like "0.8333333333333334" and this is really weird
    when i pass it as a parameter to the mosfet.
    I would prefer it to be looking like "0.83"(i prefer two digits after
    the decimal point).How to go about this?
    thanks and regards,
    lokesh rajendran.
     
    noreply, Jun 29, 2009
    #1
  2. noreply

    I-F AB Guest

    Hi,
    At the moment I can only recall:
    atof( sprintf(nil "%5.2f" ggg) )
    Which basically means 'convert to string format of certain decimal
    places & convert string back to floating-point number.
    I'm sure there's a more efficient way but can't remember it at the
    moment.

    Best regards,
    I-FAB
     
    I-F AB, Jun 29, 2009
    #2
  3. noreply

    noreply Guest

    Cool I-fab,
    Its working....
    If at all, you get the more efficient way,please do post.
    Thanks and regards,
    Lokesh rajendran
     
    noreply, Jun 29, 2009
    #3
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.