I have some experience in Defence & Aerospace industry. I am mostly interested in swarm robotics. I like to write about C++ language features and best practices.
I compared its speed to the default C++ abs from math.h like…
Use floating numbers for division, unless you intentionally want to lose the decimal part.
It is a good idea to write functions and call these functions from main. I understand that you are writing simple programs but writing functions prepares you for the more complex stuff you will face later on.
Don't lose your motivation and try to learn new things everyday. Have a good one!
My name is Ali. An outstanding, self-motivated Software Engineer with 3 plus years of experience in delivering enterprise solutions in domains like e-Commerce, utility e.tc.
Hi Ali,
I have a few comments, hope it helps:
Prefer cmath::abs to writing your own absolute number function. Related question:
What is different about C++ math.h abs() compared to my abs()
I am currently writing some glsl like vector math classes in C++, and I just implemented an
abs()
function like this:I compared its speed to the default C++
abs
frommath.h
like…Use floating numbers for division, unless you intentionally want to lose the decimal part.
It is a good idea to write functions and call these functions from main. I understand that you are writing simple programs but writing functions prepares you for the more complex stuff you will face later on.
Don't lose your motivation and try to learn new things everyday. Have a good one!
Thank you so much. It really helps me a lot. Thanks again for the contributions you are making to the community.