Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How much slower is multiplication than addition in C language, and how much slower is floating-point number operation than integer operation?
How much slower is multiplication than addition in C language, and how much slower is floating-point number operation than integer operation?
This has little to do with C language.

Because it is executed by CPU.

So it really depends on the hardware instruction set.

Generally speaking, int type addition needs to be done once.

Multiplication is about 5 times that of addition, depending on the kernel instruction implementation.

The fastest may be 2 times and the slowest may be 40 times.

Floating-point operation mainly depends on whether there is a special hard floating-point operation unit. If there is, it is similar to addition, a little slower.

If not, it will be much slower.