Fix a few places in examples where C reference implementaion had a double-precision
fp constant undesirably causing computation to be done in double precision. Makes C scalar versions of the options pricing models, rt, and aobench 3-5% faster. Makes scalar version of noise about 15% faster. Others are unchanged.
This commit is contained in:
@@ -104,7 +104,7 @@ inline float NoiseWeight(float t) {
|
||||
|
||||
|
||||
inline float Lerp(float t, float low, float high) {
|
||||
return (1. - t) * low + t * high;
|
||||
return (1.f - t) * low + t * high;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ static float Turbulence(float x, float y, float z, int octaves) {
|
||||
lambda *= 1.99f;
|
||||
o *= omega;
|
||||
}
|
||||
return sum * 0.5;
|
||||
return sum * 0.5f;
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ void noise_serial(float x0, float y0, float x1, float y1,
|
||||
float y = y0 + j * dy;
|
||||
|
||||
int index = (j * width + i);
|
||||
output[index] = Turbulence(x, y, 0.6, 8);
|
||||
output[index] = Turbulence(x, y, 0.6f, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user