float precise

float precise

imagem de zhangxiuxia

I write a program of assembly and c version both(data used are mainly single float point).
And found the result is a little different in decimal point . I debug and could not find any error.
is sse float instruction is the same as scalar instruction in computing presion ?

6 posts / 0 new
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.
imagem de Maxym Dmytrychenko (Intel)

Without looking at your code - it is possible to give only some general answers,

Float point datatypes has several things which have to be really understood,
like roundings , relative errors etc,
please spend some time in reading of such details, like here: http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
and more

If you have any concern about precision of any instruction
- just refer to its details and its compliance to IEEE standards,

Note that general specification is:

SSE extensions expand the SIMD execution model by adding facilities for
handling packed and scalar single-precision floating-point values contained in
128-bit registers.

and later

- The 128-bit packed single-precision floating-point data type (four IEEE single precision
floating-point values packed into a double quadword).

see CHAPTER 10, PROGRAMMING WITH STREAMING SIMD EXTENSIONS (SSE)

imagem de Tim Prince

You give so little information that we can't focus on your concern. Besides general issues about floating point, you must consider implications of compiler options you choose. icc requires the option -fp-model source (Windows spelling /fp:source) in order to adhere to C and C++ standards.

imagem de zhangxiuxia

Thanks a lot. But I cannot find "PROGRAMMING WITH STREAMING SIMD EXTENSIONS" from web.
Could you give me a copy of it

imagem de Maxym Dmytrychenko (Intel)
imagem de Sergey Kostrov
Quoting zhangxiuxia I write a program of assembly and c version both(data used are mainly single float point).

[SergeyK] In a C/C++ application a set ofCRT functions, like'control87' or'controlfp',is used to control
settings of FPU.There areexamples in MSDN on how these functions work.

In case of an assembler application that uses some SSE instructions a set of macroscould be
used to control MXCSRmodes ( please take a look at xmmintrin.h ), like _MM_SET_ROUNDING_MODE(...).

And found the result is a little different in decimal point . I debug and could not find any error.

[SergeyK] If you would give a little example it would help to everybody to understand your issues.

Even if results are different you should look for absolute and relative errors. Onsome
scientific projects a person withMS degree in mathematics ( of course if there is one... )
could do some analysis of these results to confirm that everythingis looking good or, results are not aceptible.

...

Best regards,
Sergey

Faça login para deixar um comentário.