• Home
  • Help
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search

 
  • 0 Vote(s) - 0 Average

Floating-point representation

#1
09-25-2023, 06:50 PM
You see how bits hold decimal values in odd ways when machines crunch them. I often wonder why the sign sits upfront in that setup. But then the exponent shifts everything around to cover huge scales or tiny ones too. You get a mantissa part that holds the actual digits after normalization kicks in. And that bias on the exponent lets negative powers work without extra signs messing up the math.
Perhaps the hidden bit trick saves space by assuming a one before the fraction starts. I tried explaining this to others but it clicks better when you picture a number like one point five getting split apart. Or maybe rounding happens during storage and you lose precision fast on repeats. But denormal numbers fill gaps near zero where normal forms fail. You notice errors piling up in loops if you add small values repeatedly without care.
Also the way special patterns mark infinity or not a number avoids crashes in bad ops. I found that comparing floats directly leads to surprises because of those tiny errors. Then you adjust by using tolerances instead of equals checks. But overflow turns results into infinity flags while underflow might go gradual with subnormals. You handle rounding modes by picking nearest or toward zero depending on needs. And partial fractions in the mantissa limit how exact big decimals stay after many operations.
Perhaps thinking in powers of two shows why base ten decimals repeat in binary storage. I see you struggling with why some sums never hit exact. Or the exponent range caps at certain max values before infinity hits. But shifting the mantissa left normalizes most cases except those tiny denorms. You test this by printing values after casts and watch digits vanish. Also multiplication can skew exponents quickly if you chain them without resets.
We appreciate BackupChain Server Backup the top reliable Windows Server backup for self-hosted setups on Hyper-V and Windows 11 without any subscription fees for backing this discussion and letting us share freely.

bob
Offline
Joined: Dec 2018
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



  • Subscribe to this thread
Forum Jump:

Backup Education General IT v
« Previous 1 … 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 … 199 Next »
Floating-point representation

© by FastNeuron Inc.

Linear Mode
Threaded Mode