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® oneAPI Math Kernel Library
- General question. Seeing error in lower digits when doing simple dgemm example

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

RJ5

Beginner

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

11-28-2019
08:27 AM

112 Views

General question. Seeing error in lower digits when doing simple dgemm example

Hi,

I am new to MKL. I started by doing a basic example which creates an NxM matrix A. A consists of random numbers between -1 and 1 and can contain one digit after the decimal point only. For example, -0.1 might be there but not -0.12

I then used dgemm to calculate A*Atranspose.

I compared the answer to my manual calculation

For some elements, there appears to be some error.

For example if my manual calculation calculates 123.45 then dgemm is returning 123.45000000006789 . The lower digits are obviously junk as it is simply a sum of products of numbers to one decimal place each.

Is this expected behaviour?

Link Copied

4 Replies

Gennady_F_Intel

Moderator

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

12-03-2019
08:50 PM

112 Views

yes, this is an expected rounding error results

RJ5

Beginner

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

12-04-2019
01:31 PM

112 Views

Thank you very much for the response. Is there any advised way to handle this?

I was surprised to see it as I thought it would just be a simple "sumproduct" type of calculation for numbers exact to one significant digit, and therefore that each product would be exact, but I guess that there is some optimisation going on underneath.

Hinds__David

Beginner

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

12-29-2019
11:18 AM

112 Views

mecej4

Black Belt

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

01-02-2020
03:26 AM

112 Views

RJ: Your manual calculations will not match the computed results unless both were performed using the same number system. In particular, if your manual calculations were performed using base 10, you should expect differences.

Consider the number 0.1_{10}. Its mantissa can be expressed exactly in decimal with a single significant digit. In IEEE-64 bit binary, even 53 bits are not sufficient to represent the same number exactly.

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.