Steve_Yorkshire Posted February 9, 2018 Posted February 9, 2018 Many thanks to @Bloodknight for posting the original link. https://www.garagegames.com/community/resources/view/17059 from where I found Orion Elenzil's original post http://www.garagegames.com/community/resources/view/16983http://s2.quickmeme.com/img/76/762195e1666497074ede151e0cbeb39738a411d967572cbbe24b90cf8db6011f.jpgUsing math over 1,000,000 gives scientific herpyderpy: echo(10000000 + 1); 1e+007And 1e+007 isn't real helpful ...I updated the ConsoleFunctions into DefineEngineFunctions and slapped it all at the end of console/consoleFunctions.cpp. //yorks from Orion Elenzil DefineEngineFunction(mAddS32, const char*, (S32 v1, S32 v2), , "Add 2 large numbers") { S32 res = v1 + v2; char* ret = Con::getReturnBuffer(64); dSprintf(ret, 64, "%i", res); return ret; } DefineEngineFunction(mSubS32, const char*, (S32 v1, S32 v2), , "Subtract 2 large numbers") { S32 res = v1 - v2; char* ret = Con::getReturnBuffer(64); dSprintf(ret, 64, "%i", res); return ret; } DefineEngineFunction(mMulS32, const char*, (S32 v1, S32 v2), , "Multiply 2 large numbers") { S32 res = v1 * v2; char* ret = Con::getReturnBuffer(64); dSprintf(ret, 64, "%i", res); return ret; } DefineEngineFunction(mDivS32, const char*, (S32 v1, S32 v2), , "Divide 2 large numbers") { S32 res = v1 / v2; char* ret = Con::getReturnBuffer(64); dSprintf(ret, 64, "%i", res); return ret; } Known Issues: Dividing rounds, so:function testDiv() { %a = 1234567; %b = 3006780; echo(mDivS32(%b, %a)); }returns 2 instead of 2.435493577910312. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.