Results 1 to 12 of 12

Thread: [RESOLVED] Really weird thing happening with my Double...

Threaded View

  1. #1

    Thread Starter
    New Member MuscleShark88's Avatar
    Join Date
    Feb 2010
    Posts
    12

    Resolved [RESOLVED] Really weird thing happening with my Double...

    I have no idea why this is happening...very strange.

    Assume the following situation:


    Dim FirstPlacePercent(4) as Double
    Dim StackSum as Long
    Dim Stack(4) as Long

    txtstack1.text = 1
    txtstack2.text = 50000
    txtstack3.text = 50000
    txtstack4.text = 50000

    Stack(1) = txtstack1.text
    Stack(2) = txtstack2.text
    Stack(3) = txtstack3.text
    Stack(4) = txtstack4.text

    For i = 1 to 4
    StackSum = StackSum + Stack(i)
    next i

    For i = 1 to 4
    FirstPlacePercent(i) = (Stack(i)/StackSum) * 100
    next i

    ____________________


    ok, so since Stack(1) is VERY small relative to the others...it should yield

    FirstPlacePercent(1) = .0000066666666
    FirstPlacePercent(2) = 33.333
    FirstPlacePercent(3) = 33.333
    FirstPlacePercent(4) = 33.333



    BUT for some reason that is beyond my knowledge, it is actually outputting

    FirstPlacePercent(1) = 6.666666
    FirstPlacePercent(2) = 33.333
    FirstPlacePercent(3) = 33.333
    FirstPlacePercent(4) = 33.333


    anyone have any clue why this is happening? b/c i'm baffled.
    Last edited by MuscleShark88; Mar 9th, 2010 at 02:57 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width