Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Where is the sincos function?

jpanta
Beginner
2,775 Views

I was sure that this is supported in older version but whenever I use a sincos function now (sincos(float v,float *sinv,float *cosv)), I get an undefined function error by the compiler.

Is it really dropped?

Thank you.

0 Kudos
1 Solution
Richard_A_Intel
Employee
2,775 Views

It may be worth knowing that the Intel compiler will automatically generate  __svml_sincosf8..() when a sin() and cos() is used on the same value.  This optimization happens on O2 and O3 and does not need to be explicitly programmed in the source.

View solution in original post

0 Kudos
9 Replies
TimP
Honored Contributor III
2,775 Views

I'm guessing that you are using a linux or MAC compiler and relying on C++ support in glibc or MSVC library.  Your man page on sincos and sincosf ought to discuss the supported ways of calling the function directly.

If I'm guessing wrong, a little more information from you would be helpful, such as the exact wording of the error.

I think standard compliant use of cosf() and sinf() may be more reliable, Compilers look for opportunities to combine them into a single sincos call, possibly a short vector version.

0 Kudos
jpanta
Beginner
2,775 Views

Nop, I am talking about Visual Studio + XE Composer 15. I thought that sincosf was a library function (not coming from MSVC library, it is not available there) since I had this working with older compiler (11.1 series). But... I may be wrong and had it somewhere defined myself that I overlooked.

0 Kudos
TimP
Honored Contributor III
2,775 Views

MSDN describes sincosf but C++11 has changed implementation of some forms of mixed data type math functions, so it's probably better to adhere strictly to what is described in documents.  I wouldn't count on not specifying /Qstd=c++11 as a way of retaining the older interpretation of math functions.

0 Kudos
jpanta
Beginner
2,775 Views

Great, thank you for the explanation.

0 Kudos
Bernard
Valued Contributor I
2,775 Views

 As described in MSDN sincos is part of DirectX HLSL intrinsic functions.

0 Kudos
SergeyKostrov
Valued Contributor II
2,775 Views
>>...I thought that sincosf was a library function (not coming from MSVC library... I'd like to inform you that 'sincos' function never was a part of CRT library ( C Run-Time ). It is possible that MKL library is used in your software development environment, or some another 3-rd party library is linked.
0 Kudos
Richard_A_Intel
Employee
2,776 Views

It may be worth knowing that the Intel compiler will automatically generate  __svml_sincosf8..() when a sin() and cos() is used on the same value.  This optimization happens on O2 and O3 and does not need to be explicitly programmed in the source.

0 Kudos
TimP
Honored Contributor III
2,775 Views

RICHARD A. (Intel) wrote:

It may be worth knowing that the Intel compiler with automatically generate  __svml_sincosf8..() when a sin() and cos() is used on the same value.  This optimization happens on O2 and O3 and does not need to be explicated programed in the source.

I alluded to this in #2, without specifically mentioning the ICL options.    If options such as /fp:source are set, /Qfast-transcendentals would need to be set as well.

0 Kudos
jpanta
Beginner
2,775 Views

Thank you all for the clarifications.

0 Kudos
Reply