Performances test

Hi all,
I would like to know if it is possible to replace all the __fdividef() fonction in my code by an usual division by adding an option in the compiler.

In fact I would like to know the gain obtained by using __fdividef(a,b) instead of a/b. Or maybe there are better ways to do.

I tried to use the flag --prec-div=true but the results are the same, so I guess that the flag --prec-div=false replaces a/b with __fdividef(a,b) but it is not reciprocal. Am I right?

Thanks all.

Hi,

what about something like that at the beginning of your code (possibly within a header file that you include in last position within your source files)

#ifdef PREC_DIV

#define __fdividef(a,b) (a)/(b)

#endif

Then by compiling with “-DPREC_DIV”, you would use the normal division.

It seems to work! Thanks a lot

So with your change, if I have in my code

__fdividef(1 + 4*a, 2*b - a )

it will be compiled as

(1 + 4*a)/(2*b - a)

?

So your a and b are automatically replaced?

Yes.
You can see exactly how the pre-processor transforms your code by using the “-E” compiler switch, which will stop right after this phase, and display the ready-to-compile code.

Ok, thanks a lot!
I didn’t know that and it is very usefull.

BTW -E doesn’t work, but I will live without it and I will trust you.