• 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. Simple counting with number 0.07 ?

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 143
  • Views 7286
  • 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

Simple counting with number 0.07 ?

Bertas
Bertas over 2 years ago

Hi guys, I have one question, maybe I do something wrong or I don't wake up properly today :) but I can't find an answer why this happen.

I will make it simple .... its just counting in CIW

for number 0.07

x=(0.07/(2*0.005))  => 7.0 

y=truncate(x) => 7 (integer number)

z=x-y =>  I would expect 0 but system give me 8.881784e-16

When I put any other number like like 0.09 or 0.08  .... 2.0 atc always get expected result 0

Why is that ?

Robert

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

    Robert,

    This problem has come up countless times on these forums, and on the internet in general - for any programming language that uses IEEE floating point representation (so C, Pascal, Python, SKILL, etc, etc). For example:

    • Round-off error (Wikipedia)
    • Why you should never compare two floating point numbers with equals (==) in SKILL?
    • Numerical dynamic range (precision) in SKILL (this one was written by me)

    Andrew

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

    Robert,

    This problem has come up countless times on these forums, and on the internet in general - for any programming language that uses IEEE floating point representation (so C, Pascal, Python, SKILL, etc, etc). For example:

    • Round-off error (Wikipedia)
    • Why you should never compare two floating point numbers with equals (==) in SKILL?
    • Numerical dynamic range (precision) in SKILL (this one was written by me)

    Andrew

    • 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