Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted
##

erling_andersen

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-03-2018
05:00 AM

26 Views

-O3 and exp() and ln()

We have some C code that employs exp() and ln() a lot for some test data. Now if we switch the optimization level from O2 to O3, then the code does not work in some cases. It is like the ln() and exp() is less accurate.

In cases where exp() and ln() are not used it works with O3. Is that to be expected?

Erling

2 Replies

Highlighted
##

jimdempseyatthecove

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-03-2018
06:43 AM

26 Views

Try adding the floating point options that favor precision over speed

Look at /fp:<name> as well as selecting NOT fast transcendentals /Qfast-transcendentals-

/Qimf-absolute-error:value[:funclist]

define the maximum allowable absolute error for math library

function results

value - a positive, floating-point number conforming to the

format [digits][.digits][{e|E}[sign]digits]

funclist - optional comma separated list of one or more math

library functions to which the attribute should be

applied

[press RETURN to continue]

/Qimf-accuracy-bits:bits[:funclist]

define the relative error, measured by the number of correct bits,

for math library function results

bits - a positive, floating-point number

funclist - optional comma separated list of one or more math

library functions to which the attribute should be

applied

/Qimf-arch-consistency:value[:funclist]

ensures that the math library functions produce consistent results

across different implementations of the same architecture

value - true or false

funclist - optional comma separated list of one or more math

library functions to which the attribute should be

applied

/Qimf-max-error:ulps[:funclist]

defines the maximum allowable relative error, measured in ulps, for

math library function results

ulps - a positive, floating-point number conforming to the

format [digits][.digits][{e|E}[sign]digits]

funclist - optional comma separated list of one or more math

library functions to which the attribute should be

[press RETURN to continue]

applied

/Qimf-precision:value[:funclist]

defines the accuracy (precision) for math library functions

value - defined as one of the following values

high - equivalent to max-error = 0.6

medium - equivalent to max-error = 4 (DEFAULT)

low - equivalent to accuracy-bits = 11 (single

precision); accuracy-bits = 26 (double

precision)

funclist - optional comma separated list of one or more math

library functions to which the attribute should be

Jim Dempsey

Highlighted
##

erling_andersen

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-03-2018
07:38 AM

26 Views

I tried adding

/Qfast-transcendentals-

but it did not change anything. Does O3 choose fast transdendentals and O2 not? I mean was does O3 actually do with floating points?

Is that documented?

Changing the other parameters is bit like a needle in the haystack approach. I guess I will stick with /O2 then.

For more complete information about compiler optimizations, see our Optimization Notice.