Jump to content

Problems with data types,number representation

Featured Replies

1)A^2-B^2 WE CAN WRITE THIS AS (A+B)(A-B) but if A,B are two floating point numbers these calculations may yield different results
why this
under what circumstances does a difference between two calculators arise

 

 

 

 

 

2)why it's hard to ( time and hardware complexity )to add two floating point numbers than integer numbers

 

 

 

3) is my examples right or wrong
integers = 25 ,-14, 11bin, A7Hex,17oct
floating points 12.14 -7.33 -11.11bin 74.12 oct

 

Floating point numbers in the computer are represented with a finite number of bits (double precision - 64). When multiplying two numbers the product would require more than 64 bits. The extra ones are dropped, so the result is not exact.

Floating point numbers in the computer are represented with a finite number of bits (double precision - 64). When multiplying two numbers the product would require more than 64 bits. The extra ones are dropped, so the result is not exact.

Quite the same can be said about integers - too big integer will cause overflow and completely wrong result.

In machine code it can be detected by checking overflow flag in CPU status register.

http://en.wikipedia.org/wiki/Overflow_flag

But in high level languages, not possible to detect a posteriori.

Edited by Sensei

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.