pouët.net

Go to bottom

Fixed point problem

category: general [glöplog]
I read "http://msdn.microsoft.com/en-us/library/cc953fe1.aspx". wtf? long long should be 64bit...
added on the 2010-03-12 12:27:57 by raer raer
C++ has no standard 64 bit integer type, so the code is not portable at the first place.
added on the 2010-03-12 12:31:56 by torus torus
Well, C has, so maybe you could use that instead..
added on the 2010-03-12 12:45:35 by 216 216
I'm nitpicking, but visual studio is not a C compiler.

True, it compiles most c code. It works well in practice, but it's far from compliant. Neither has it C99 support (stdint.h or complex support anyone?) nor does it support the old stuff like K&R function declarations and the like.

C++ support is much better.

added on the 2010-03-12 12:56:40 by torus torus
torus : tried? > cl /Za /TC
added on the 2010-03-12 13:26:29 by the_Ye-Ti the_Ye-Ti
Ok. I got it. It was not only the precision issue with long long not being 64bit, but also the math was wrong.

Code: const int DUDX = (((((__int64)(UZ2 - UZ1) * (__int64)DY31) - ((__int64)(UZ3 - UZ1) * (__int64)-DY12)) << 4) / ((__int64)C)); //division removes scaling, thus 8.24 format const int DUDY = (((((__int64)(UZ3 - UZ1) * (__int64)-DX12) - ((__int64)(UZ2 - UZ1) * (__int64)DX31)) << 4) / ((__int64)C)); //division removes scaling, thus 8.24 format


Works nice now. Thanks for helping out.
added on the 2010-03-12 16:10:14 by raer raer
Result:
BB Image
added on the 2010-03-12 17:00:58 by raer raer
looks good!
added on the 2010-03-12 17:27:29 by torus torus
pouet demands a texturemapped cube!
added on the 2010-03-12 17:28:10 by torus torus
Will do, sire ;)
added on the 2010-03-12 17:49:48 by raer raer
I demand that you change your delta variables to DUDE_X and DUDE_Y.
added on the 2010-03-12 17:51:44 by thec thec
Dude, why?
added on the 2010-03-12 17:55:25 by raer raer
dude, because.
added on the 2010-03-12 17:56:06 by thec thec
The pope demands that you morph the cube into a sphere.
added on the 2010-03-12 18:13:45 by kusma kusma
The pope smokes dope.
added on the 2010-03-12 18:49:18 by raer raer
RareWtFailWhale: i demand you rewrite it like
Code: (UZ1-UZ3)*DX12 + (UZ1-UZ2)*DX31

for a less negative approach
added on the 2010-03-12 18:50:54 by the_Ye-Ti the_Ye-Ti
I'm happy that it works. Will optimize later. I'll maybe even post the ugly shit for you people to laugh at... ;)
added on the 2010-03-12 18:54:57 by raer raer
I'm up for a laugh.
added on the 2010-03-12 18:56:07 by kusma kusma
I'd rather clean it up first, before I blush and sweat after posting it. :)
added on the 2010-03-12 18:59:43 by raer raer
I'm laughing already :)

login

Go to top