Turn on suggestions

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

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® Integrated Performance Primitives
- ippsVectorSlope_32f gives bad results

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

jeffc111

Beginner

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

09-28-2011
09:51 AM

53 Views

ippsVectorSlope_32f gives bad results

ippsVectorSlope_32f(pResult, 8192, 0, 1/48000f)

pResult[6000] contains0.124999493 - That's bad.

ippsVectorSlope_32f(pResult, 8192, 0, 1);

ippsDivC_32f_I(48000f, pResult, 8192);

pResult[6000] contains 0.125 - that's good.

Any ideas?

Link Copied

7 Replies

Gennady_F_Intel

Moderator

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

09-28-2011
10:21 PM

53 Views

This the resultd of rounding float precision. UseippsVectorSlope_64f and you will have 0.125.

jeffc111

Beginner

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

09-29-2011
11:22 AM

53 Views

Perhaps VectorSlope is not computing the value as documented ( result = offset + n*slope), but is avoiding multiplication by iteratively adding the slope value? That would DEFINITELY lead to floating point precision errors.

Further evidence that rounding and floating point precision are not the problem here:

I compute 6000/48000 in floating point, then the value is correct.

float result = 6000/48000

result == .125f

If I replace vectorSlope with the following, the value is correct.

float slope = 1/48000f;

for (int i = 0; i < 8192; i++ )

{

pResult = i * slope;

}

pResult[6000] == .125f;

And, as I said, when performing VectorSlope with integers, THEN dividing by 48000, the value is correct.

In fact, if I perform Vector Slope with integers, then Multiply by 1/48000f, the value is correct.

I've tried this in C with Floating Point Model set to "precise", "strict", and "fast", just for kicks, and they all give 0.125

jeffc111

Beginner

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

10-11-2011
11:14 AM

53 Views

I can imagine that as an optimization VectorSlope might suffer from loss of precision that is maintained when the separate steps of computing VectorSlope then DivC are performed. However, this seems unlikely, or at the least worth noting.

jeffc111

Beginner

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

02-08-2012
10:23 AM

53 Views

SergeyKostrov

Valued Contributor II

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

02-08-2012
06:36 PM

53 Views

Quoting jeffc111

Perhaps VectorSlope is not computing the value as documented ( result = offset + n*slope), but is avoiding multiplication by iteratively **adding the slope value**?

...

...

It looks like in order to achieve as better as possible performance Intel's software developers could do that.

igorastakhov

New Contributor II

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

02-09-2012
12:54 AM

53 Views

Regards,

Igor

SergeyKostrov

Valued Contributor II

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

02-10-2012
10:43 AM

53 Views

Quoting jeffc111

ippsVectorSlope_32f(pResult, 8192, 0, 1/48000f)

pResult[6000] contains**0.124999493 - That's bad**.

ippsVectorSlope_32f(pResult, 8192, 0, 1);

ippsDivC_32f_I(48000f, pResult, 8192);

pResult[6000] contains **0.125 - That's good**.

Any ideas?

Please take a look at results of my investigation:

**1.** This is how these numbers look like in Base10, Base 16 and Base2 ( Binary ):

Sign Exponent Mantissa

0.125000000 (Base10) = 0x3F900000 (Base16) = 0 01111111 00100000000000000000000 (Base2)

0.124999493 (Base10) = 0x3DFFFFBC (Base16) = 0 01111011 11111111111111110111100 (Base2)

**2.** Absolute Error is ( 0.124999493 - 0.125000000 ) = -0.000000507

Epsilon for a Single-Precision FP number is 1.192092890e-07

If I divide |0.000000507| by 1.192092890e-07 it gives ~4.25.

( Exact value is: 4.2530242756501970244952975099113 )

So, the absolute error is greater than Epsilon for aSingle-Precision FP number in ~4.25 times!

I think the case 'ippsVectorSlope_32f(pResult, 8192, 0, 1/48000f) => 0.124999493' has to be investigated

by an Intel software engineer.

**Note:**

More accurate representation for 0.124999493 according to IEEE 754 standard is 1.249994933605194091796875E-1

Topic Options

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

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