Author Topic: Calculating, Mostly Addition  (Read 505 times)  Share 

Calculating, Mostly Addition
« on: 04 Mar 2012, 23:02 »
« Last Edit: 04 Mar 2012, 23:07 by KamikazeHighland »

monkey_05_06

  • AGS Project Admins
  • Has left the building.
Re: Calculating, Mostly Addition
« Reply #1 on: 08 Mar 2012, 23:15 »
[code]int C;
C++;[/code]

Ah, programming jokes. 8)
Let's be honest. Most people suck at coding. I suck at coding, but at least my code is readable. To Hell with anyone too lazy to maintain consistent formatting in their code. I could deal with bad interfaces and structure if I could even read your horrible code. And that's putting it nicely. -monkey

Iceboty V7000a

  • Local Moderator
  • * KILL* * KILL * * KILL *
    • Lifetime Achievement Award Winner
    •  
Re: Calculating, Mostly Addition
« Reply #2 on: 09 Mar 2012, 02:47 »
Care to elaborate why you need to work with such large numbers in AGS?

Re: Calculating, Mostly Addition
« Reply #3 on: 09 Mar 2012, 06:06 »
Well, I don't like for math to ever be wrong.  ;)

I've actually finished with all four arithmetic operations for non-negative, non-decimal numbers of any size.

But thank you anyway.

Iceboty V7000a

  • Local Moderator
  • * KILL* * KILL * * KILL *
    • Lifetime Achievement Award Winner
    •  
Re: Calculating, Mostly Addition
« Reply #4 on: 09 Mar 2012, 07:26 »
Care to elaborate why you need to work with such large numbers in AGS?

Is this really needed?

Re: Calculating, Mostly Addition
« Reply #5 on: 09 Mar 2012, 08:20 »
Necessary?  No.

I don't know c++, and it looks hard to learn.   :-\

I'm finished.

Dualnames

  • AGS Baker
  • Dualnames worked on a game that was nominated for an AGS Award!
Re: Calculating, Mostly Addition
« Reply #6 on: 09 Mar 2012, 08:55 »
Again, in case it didn't go through why are you re-inventing the wheel for?

Calin Leafshade

  • AGS Project Admins
  • Long live King Cat!
    • I can help with AGS tutoring
    •  
    • I can help with voice acting
    •  
  • Calin Leafshade worked on a game that was nominated for an AGS Award!Calin Leafshade worked on a game that won an AGS Award!
Re: Calculating, Mostly Addition
« Reply #7 on: 09 Mar 2012, 09:19 »
(32bit) Ints themselves are only accurate to 32-bits but larger numbers can be stored using multiple registers. Theoretically a computer can store a number as large as you like with no errors. Its just far slower because it has to do clever, expensive multiple register arithematic.

Leon: You need the sword first before you can get the monkey.

Re: Calculating, Mostly Addition
« Reply #8 on: 09 Mar 2012, 09:40 »
It's not about large numbers, it's about accuracy, and uncertainty.  When you multiply or divide ints or floating point numbers more than once, multiple rounding errors can creep up in no time at all.

Multiple registers, you say?

Calin Leafshade

  • AGS Project Admins
  • Long live King Cat!
    • I can help with AGS tutoring
    •  
    • I can help with voice acting
    •  
  • Calin Leafshade worked on a game that was nominated for an AGS Award!Calin Leafshade worked on a game that won an AGS Award!
Re: Calculating, Mostly Addition
« Reply #9 on: 09 Mar 2012, 11:27 »
dividing ints can introduce rounding errors yes. You would use floats if accuracy was important. The accuracy of a float decreases as the value of the number stored increases but the larger the size of the float the less significance the error will have. Even the vast majority of scientific applications dont require accuracy to more than about 6 significant figures.

Accuracy of integer division can be a problem but if you are concerned about the accuracy of floating point numbers then you really need something far more specialised than AGS.

Leon: You need the sword first before you can get the monkey.

Wyz

  • AGS Project Admins
  • anno 1986
    • I can help with AGS tutoring
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
Re: Calculating, Mostly Addition
« Reply #10 on: 10 Mar 2012, 12:43 »
I'm curious what method you use right now; adding two number of 155 (decimal) digits will boil down to around 30 additions. This is still peanuts for any processor and even for AGS' virtual machine. Adding more digits will cause the processing time to grow linearly. It should by no means be slower than multiplication.
Life is like an adventure without the pixel hunts.