The trouble with floating point ...

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

 

 

laugh

 

Which reminds me of  Brian Fairchild's signature:

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Mon. Jul 6, 2020 - 02:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


And another posted on The Embedded Muse today:

 

So how much was that fee one had to agree too?

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I much prefer dividing by multiplying integers & tracking the imaginary decimal point.

 

Many years ago a guy asked for some advice...he said he had spent days trying to get some floating point to work (back then it was in asm) & was trying to scale an adc to divide by 7.38 or something.  I told him to scrap it all & he should be multiplying by an integer instead...I thought he was gonna slug me.  Once I explained, he went and tried it & had it running perfectly in a jiffy.  

 

    

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

avrcandies wrote:
I much prefer dividing by multiplying integers & tracking the imaginary decimal point.

Absolutely.

 

I think I may have suggested it here just once or twice ... 

 

wink

 

EDIT

 

Didn't think it'd be long before another came along:

 

https://www.avrfreaks.net/commen...

 

laugh

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Fri. Jul 17, 2020 - 07:10 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That seems a common thread amongst us old ones... it's the realisation that there are no more 'values' available in (e.g) a 32-bit floating point number than there are in a 32-bit fixed point number. Suddenly it's obvious that  if the range is so large, there must be gaps between the numbers.

 

I guess that modern CE teaching doesn't include theory of numbers, just how to find a suitable library and hope that it's bug-free.

 

Neil

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1


 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In that case, you might as well make it a double!

Don't interrupt him--you don't want to be the type to cause an overflow!

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

(oops - wrong thread)

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...