mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-02 10:43:44 +01:00
SoftGPU: Floor the exact pow product
The GE's pow multiplies the exponent and the float's bits exactly and floors, instead of a rounded float multiply, which mattered for e = 1.1 (gpu/probe exp102). The hardware backends keep the float version. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
8d8fc726a5
commit
467e8ef34a
1 file changed
+10
-1
@@ -51,7 +51,16 @@ static inline float pspLightPow(float v, float e) {
|
||||
return 1.0f;
|
||||
}
|
||||
if (v > 0.0f) {
|
||||
return PSPLightPow(v, e);
|
||||
// PSPLightPow, but the product is exact and floored rather than a rounded float multiply
|
||||
// (gpu/probe exp102: e = 1.1).
|
||||
int32_t ix;
|
||||
memcpy(&ix, &v, sizeof(ix));
|
||||
double t = std::floor((double)e * (double)(ix - 0x3F800000)) + 1065353216.0;
|
||||
t = t >= 0.0 ? (t < 2139095039.0 ? t : 2139095039.0) : 0.0;
|
||||
int32_t iy = (int32_t)t;
|
||||
float y;
|
||||
memcpy(&y, &iy, sizeof(y));
|
||||
return y;
|
||||
}
|
||||
// Negative stays negative, so let's just return the original.
|
||||
return v;
|
||||
|
||||
Reference in new issue
Block a user