rick.weber

Weird error using double precision

Discussion created by rick.weber on Dec 19, 2008
Latest reply on Mar 8, 2009 by dbnelson

Since the library of standard mathematical functions doesn't support double precision, I decided to write my own function to perform an exponential. In doing so I get this error:

 

ERROR: Expected a object of type 'struct'

While processing <buffer>:103

In compiler at GetSubpart()[astsymbol.cpp:636]

  Name() = <literal>

  member_name = x

Aborting...

Problem with compiling basisFunc_computeBasisFunction.hlslERROR: Expected a object of type 'struct'

While processing <buffer>:160

In compiler at GetSubpart()[astsymbol.cpp:636]

  Name() = <literal>

  member_name = x

Aborting...

Problem with compiling basisFunc_computeBasisFunction_addr.hlsl

 

(ignore the line numbers on the left. All numbers variables are declared as double).

 23   sum = 1.0; 

 24   exponent = val;

 26   sum += exponent;

 27   exponent*=exponent;

 28   tmp = exponent / 2.0;

 29   sum += tmp;

 30   exponent*=exponent;

 32   sum += exponent/6.0;

 33   exponent*=exponent;

 34   sum += exponent/24.0;

 35   exponent*=exponent;

 36   sum += exponent/120.0;

 37   exponent*=exponent;

 38   sum += exponent/720.0;

 39   exponent*=exponent;

 41   basis = sum;

The error occurs because of the sum += exponent/<literal> lines. Is this a bug? I also get the error on line 28. While this isn't told in the error, I deduced this by commenting stuff out.




Outcomes