Programming vlog 0x01 - Figuring out fixed point maths

Programming vlog 0x01 - Figuring out fixed point maths

If you've ever wrestled with fixed-point math, scaling, and rounding, this blog post is for you!
I go deeper into binary arithmetic, division tricks, rounding, and what it really takes to build fixed-point systems that work.
As always, I appreciate all of your feedback and corrections.
https://shafq.at/fixed-point-tutorial-2.html
#EmbeddedSystems #DSP #FixedPoint #CProgramming #SignalProcessing #Microcontrollers #C #programming
Introduction I've received a lot of feedback on my blog posts over the past few months. I'm humbled and grateful for the suggestions, and I always look forward to hearing from readers. You'll often see that I leave my mistakes in the posts along with the corrections, giving credit where …
Числа с фиксированной запятой для NES/DENDY
Консоль Dendy в первую очередь ассоциируется с относительно простыми играми (Super Mario Bros, Duck Hunt, Battle City и т. д.), которые обычно не требуют сложных расчётов и обходятся целочисленной математикой. Но как только нужно сделать трёхмерную графику или сложную физику, сразу появляется потребность в точных вычислениях и дробных числах. Самым простым и быстрым способом программного представления дробей являются числа с фиксированной запятой (Fixed‑point числа). О реализации такой арифметики для NES/Dendy мы и поговорим.
https://habr.com/ru/companies/sberbank/articles/850348/
#c #assembler #python #разработка_игр #nes #dendy #gamedev #ретроконсоли #математика #fixedpoint
Имплементация чисел с фиксированной точкой (часть 2)
Итак, в прошлый раз я представил базовую идею как можно реализовать Fixed-point arithmetic , а так же набросок кода на C++, в котором в комментариях нашли довольно много проблем (а я сам нашёл ещё больше). В этот раз хочется представить улучшенную реализацию, разбор тонких моментов в коде и провести более детальный анализ получаемых результатов.
#Journal, Day 1452
Sunday, 10 March 2024
Ukraine War: Day 747
Hamas-Israel War: Day 155
Mass shootings in the USA in 2024: 73
#OscarSunday #Timechange #rescuebird #budgie #birthdays #familyandfriends #fixedpoint
I wrote a chunk of #bitshifting and #bitmask-ing #code today that turned out to be utterly useless, but I had so much fun writing it! Plus, getting to #grok #iee754 was neat-o.
Need to use #fixedpoint numbers on your #embedded target because it lacks a #FPU
Don't like using clunky C libraries to chain function calls if you just want to do some basic math?
Care about #performance?
Then this might be for you:
<https://github.com/thacks42/fixed_point_math>
Supports #floatingpoint literals,
all basic arithmetic operations,
boolean expressions,
and more!
try it out on godbolt:
<https://godbolt.org/z/1qr631MKe>