Jump to content

an algorithm to determine the accuracy of a mantissa

- - - - -

  • Please log in to reply
2 replies to this topic

#1
ljl22

ljl22

    Newbie

  • Members
  • PipPip
  • 20 posts
Ok, so I've been working through some various problems in order to improve at my programming and I've had this question a couple of times and have no idea how to go about it:

'Give a simple algorithm to calculate the accuracy with which the mantissa of a floating point number can be represented'

Basically as I understand it, it wants me to get the computer to test it's own accuracy, which feels a bit paradoxical.

Can anyone help?

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Well, you could change the last bit in the binary representation, and then subtract that from the original.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
The significand (or mantissa) can be thought of as the fraction in a scientific notation, in a binary fraction form.

The level of proximity compared to that of a true value can be considered accuracy, so you may compute a value and compare to a reference value, or assume a result (such as Winged Panther's suggestion) and compare the actual computed value to that.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users