All pastes #498901 Raw Edit

Chao7

public cpp v1 · immutable
·published 2007-05-20 19:05 UTC
rendered paste body
const float cPi = 3.14159265; // fast pi, actual = 3.14159274, maybe aliased to pi in hardware?const float4 ePi = float4( // discarded if prec < 7  //3.14159265358979323846264338327950288419716939937510    3.141592503e-0,  //3.141592503 - 7dp          0.1505897842e-6,  //3.1415926535897842 - 14 dp                  0.9038462422e-014,  //3.141592653589793238462422 - 21 dp                         0.2213832739e-021  //3.1415926535897932384626433832739 - 29 dp);  #if !defined( PI_PRECISION ) || PI_PRECISION < 7#define PI_PRECISION 7 // min prec = 7#endif #if PI_PRECISION >= 29const float getPi() { // 3 inst    float rPi;    rPi = ePi[3] +          ePi[2] +          ePi[1] +          ePi[0] ;    return rPi;}#elif PI_PRECISION >= 21const float getPi() { // 2 inst    float rPi;    rPi = ePi[2] +          ePi[1] +          ePi[0] ;    return rPi;}#elif PI_PRECISION >= 14const float getPi() { // 1 inst    float rPi;    rPi = ePi[1] +          ePi[0] ;    return rPi;}#elseconst float getPi() { // no inst    return cPi;}#endifconst static float Pi = getPi();float4 main( float4 unk1 : COLOR1, float4 unk2 : COLOR2 ) : COLOR0 {    // arguments to main are 'uncertain', and so are not const-expression optimized away    return float4( Pi, Pi, Pi, Pi );}