trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Weixin-Xu <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #1311: [TRAFODION-2818] For Server 2008, fu...
Date Thu, 30 Nov 2017 03:06:40 GMT
Github user Weixin-Xu commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/1311#discussion_r153976065
  
    --- Diff: win-odbc64/odbcclient/drvr35/sqltocconv.cpp ---
    @@ -36,6 +36,34 @@
     
     #define MAXCHARLEN 32768 //32K
     
    +// for server2008 when using function pow() then throws STATUS_ILLEGAL_INSTRUCTION
    +__int64 pow(int base, short scale)
    +{
    +	DWORD dwVersion = 0;
    +	DWORD dwBuild = 0;
    +
    +	dwVersion = GetVersion();
    +
    +	// Get the build number.
    +
    +	if (dwVersion < 0x80000000)
    +		dwBuild = (DWORD)(HIWORD(dwVersion));
    +
    +	__int64 retValue = 1;
    +	if (dwBuild == 7600)
    +	{
    +		scale = scale > 18 ? 18 : scale;
    +		for (int i = 0; i < scale; i++)
    +			retValue = retValue * 10;
    +	}
    +	else
    +	{
    +		retValue = pow((double)base, scale);
    --- End diff --
    
    When using the standard pow function in ODBC under server2008, it throws STATUS_ILLEGAL_INSTRUCTION.
    For the standard pow function, the type of parameter base is _Common_float_type including
float, double and long double.
    So using type int  as the parameter in pow() can lead linker to call this function first.


---

Mime
View raw message