How Computer deal with Floating point numbers

  • Mantissa –0 represents a positive,1 represents a negative
  • The Biased exponent –A bias is added to the actual exponent in order to get the stored exponent.
  • The Normalized Mantissa –The part of a number in scientific notation or a floating-point number, consisting of its significant digits. Either 0 or1. So a normalized mantissa is one with only one 1 to the left of the decimal.
32-bit-IEEE-754-Floating-Point-Number

BigDecimal in Java

We can solve this problem using the java BigDecimal class. Java BidDecimal class provides operations for arithmetic, comparison, hashing, rounding, manipulation, and format conversion.
for the arithmetic operation, it provide add(), substract(), divide(), and multiply() methods.

  1. https://www.youtube.com/watch?v=2VM028vpguU
  2. https://ideone.com/mEourC
  3. https://abcstudyguide.com/wp-content/uploads/2017/05/32-bit-IEEE-754-Floating-Point-Number.png

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Upulie Handalage

Upulie Handalage

Everything in my point of view. Here for you to read on....