VERY large numbers in multiplication

0 favourites
  • 3 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • ------------Multiplication without multiplication----------------

    Subscribe to Construct videos now

    This guy is a monster in c++. You can watch his lessons even if you don't know Russian, because I'm know and don't understand him )))

    It's hard to explain what I actually do in the code and more harder translate it.

    As you can see it have two methods abot how make multipli using addition only (P.S. and one time subtraction)

    HTML

    Hre the C2's code

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's a old post, but right now I'm check the standart multiplication ("Multipli" button) between 6000000000*6000000000 (9 zeroes)- and C2 can't count it

    BUT the "Fast" method in "Fast" button count 9000000000000 and 9000000000000 (12 zeroes)correctly

    I'm confused !

  • it would have probably been faster to use bit shifting rather than addition for

    acc += acc

    probably

    acc = acc << 1

    n = n << 1

    The method he uses is still requiring the computer to addition. Which is fast, but bitshifting as the sample above litterally means acc += acc without the math. It bumps the bit's up.

    Using a custom mathlib is common for the bleeding edge game engines. However it's not that simple of a job. Mostly the work isn't the math. It's that this form of math works best for INT32 and INT64 based math. The hurdle is handling FLOAT32 or FLOAT64 math operations.

    He is using the model of doubling up. Once the add it's higher it's just a system of reducing the over amount by the remaining.

    I remember hunting down a Java mathlibrary back when I was trying to do games in MIDP Java for mobile phones. before Smart Phone :D

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)