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

double value = 0;

Ipp32f pValD;

Ipp8u Buf[]="19970501";

value = atof((const char*)Buf);

pValD = (Ipp32f )value;

From debugger:

value19970501.000000000double

pValD19970500.float

the result in pValD=19970500 , not 19970501

this error occurs when converting from double to Ipp32f.

Do you have any explanation?

Link Copied

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

double value = 0;

Ipp32f pValD;

Ipp8u Buf[]="19970501";

value = atof((const char*)Buf);

pValD = (Ipp32f )value;

From debugger:

value19970501.000000000double

pValD19970500.float

the result in pValD=19970500 , not 19970501

this error occurs when converting from double to Ipp32f.

Do you have any explanation?

Ipp32f is a 32bit floating point, double are generally 64 bits thus have more precision and can represent bigger numbers.

Not all natural numbers can be represented by floating points. In your case there is probably no representation for 19970501 in 32 bits but there is in 64 bits (I didn't do the math but you can convinced yourself if you look online for the internal representation of floating point).

Hope this help,

Emmanuel

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

Ipp32f is a 32bit floating point, double are generally 64 bits thus have more precision and can represent bigger numbers.

Not all natural numbers can be represented by floating points. In your case there is probably no representation for 19970501 in 32 bits but there is in 64 bits (I didn't do the math but you can convinced yourself if you look online for the internal representation of floating point).

Hope this help,

Emmanuel

Yes you are right - flat has significant max 7 digits. The problem

is actually I need a fast conversion between string and Intel types.

In this case I have to use Microsoft's _atodbl. I am using vectors

and this would be a performance problem. Does Intel has a vector

string to Intel types conversion function?

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

typedef double Ipp64f;

Vladimir

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

*Hello,
'Intel types' is nothing more than just typedefs (see ippdefs.h file)
typedef float Ipp32f;*

typedef double Ipp64f;

We do not have string to typeconversion functions in IPP.
Regards,

Vladimir

typedef double Ipp64f;

Vladimir

If they are just typedefs, how they are 32 bit aligned?

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

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

*What do you mean? How typedef is related to memory alignment?
*

I just want to use 32 bit memory alignment when for example create an array

and read from a disk file for example.

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

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