Really big numbers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jscottm
    New Member
    • Feb 2016
    • 1

    Really big numbers

    I am trying to create a program that calculates the cost of one atom of an element but when I run the code this line...

    Code:
    decCostPerSingle = decSampleCost / decNumPerSample
    gets an error that says "DivideByZeroEx ception was unhandled" I think it may be because my "decNumPerSampl e" is somewhere around .00000000000000 000000000007985 and I think it is rounding down to zero.

    How do I fix this problem.
  • codegazer
    New Member
    • Oct 2015
    • 27

    #2
    You're very likely to have sussed this out by now, but I think you'll have to settle for Cost per trillion atoms or some other large number.

    Just make sure that you multiply up before you divide thus:
    (1000000000000 * decSampleCost) / decNumPerSample .

    Comment

    Working...