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."

Author

Message

Level: 10k+ Postman

Joined: Fri. Jul 1, 2005

Posts: 20711 View posts

Location: Basingstoke, Hampshire, UK

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."

Last Edited: Mon. Jul 6, 2020 - 02:53 PM

And another posted on The Embedded Muse today:

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

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.

Level: 10k+ Postman

Joined: Fri. Jul 1, 2005

Posts: 20711 View posts

Location: Basingstoke, Hampshire, UK

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 ...

EDIT

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

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

Last Edited: Fri. Jul 17, 2020 - 07:10 AM

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

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!

Level: 10k+ Postman

Joined: Fri. Jul 1, 2005

Posts: 20711 View posts

Location: Basingstoke, Hampshire, UK

*(oops - wrong thread)*