• 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. Displaying all the decimal digits of a floating point n...

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 143
  • Views 16626
  • 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

Displaying all the decimal digits of a floating point number

Mallikarjun032
Mallikarjun032 over 6 years ago

Hi,

I would like to know if it's possible to display all the decimal digits of a floating point number.

For example, if I set "a=1.23456789", and when I use the expression "a", only 6 decimal digits are displayed, like "1.234567".

Is it possible to display all the decimal digits of a floating point number?

Thanks,

Mallikarjun

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 6 years ago

    Hi Mallikarjun,

    If you use:

    sstatus(fullPrecision t)

    Then the default print representation of floating point numbers extends to 16 significant digits rather than 7 by default. Note that double precision floating point numbers have just under 16 significant digits (stored as a 53 bit mantissa) so there is no more accuracy than that. You can also use the precision controls with printf (e.g printf("%.16g\n" num) or printf("%8.3f\n" num) - with %g it is the number of significant digits, with %f it's the number of decimal places to the right of the point)

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 6 years ago

    Hi Mallikarjun,

    If you use:

    sstatus(fullPrecision t)

    Then the default print representation of floating point numbers extends to 16 significant digits rather than 7 by default. Note that double precision floating point numbers have just under 16 significant digits (stored as a 53 bit mantissa) so there is no more accuracy than that. You can also use the precision controls with printf (e.g printf("%.16g\n" num) or printf("%8.3f\n" num) - with %g it is the number of significant digits, with %f it's the number of decimal places to the right of the point)

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Mallikarjun032
    Mallikarjun032 over 6 years ago in reply to Andrew Beckett

    Thanks a lot Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

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