Search code examples
automatacomputation-theorycomputation

We used floating point numbers instead of real numbers in NICE programming language. Why?


In The NICE programming language,we use floating point numbers instead of real numbers. why?


Solution

  • This is a discussion that applies to all programming languages, not just NICE. There are books written about this, but in summary:

    Computers store information in binary, and it's hard to store our decimal (base-10) numbers in binary. A long time ago, we made a standard format for dealing with non-integer numbers in a performance-conscious manner: IEEE 754, which has come to be widely recognized.

    We keep using it because it works and it is successful. Our hardware is made around it. Programmers have fine-tuned the way we work with floating point numbers. It's sensible to keep using it.