I’ve been programming for a while in C++, but suddenly had a doubt and wanted to clarify with the Stackoverflow community.
When an integer is divided by another integer, we all know the result is an integer and like wise, a float divided by float is also a float.
But who is responsible for providing this result? Is it the compiler or DIV instruction?
The compiler will decide at compile time what form of division is required based on the types of the variables being used – at the end of the day a DIV (or FDIV) instruction of one form or another will get involved.