Results 1 to 11 of 11

Thread: Do really long calculations cause problems? what am i doing wrong?[resolved]

  1. #1

    Thread Starter
    Lively Member MET777's Avatar
    Join Date
    Apr 2005
    Posts
    76

    Resolved Do really long calculations cause problems? what am i doing wrong?[resolved]

    heres my code for saving some info to an array
    VB Code:
    1. For h = 0 To Shp.ubound
    2.     For i = 0 To Shp.ubound
    3.             gravforcex(h, i) = (Shp(h).Left - Shp(i).Left) * (((Sqr(Sqr((Shp(h).Left - Shp(i).Left) ^ 2 + (Shp(h).Top - Shp(i).Top) ^ 2))) ^ -1 * 500) / (Sqr((Shp(h).Left - Shp(i).Left) ^ 2 + (Shp(h).Top - Shp(i).Top) ^ 2)))
    4.             gravforcey(h, i) = (Shp(h).Top - Shp(i).Top) * (((Sqr(Sqr((Shp(h).Left - Shp(i).Left) ^ 2 + (Shp(h).Top - Shp(i).Top) ^ 2))) ^ -1 * 500) / (Sqr((Shp(h).Left - Shp(i).Left) ^ 2 + (Shp(h).Top - Shp(i).Top) ^ 2)))
    5.     Next i
    6. Next h

    on the gravforcex(h,i) = blah line... it gives me an invalid procedure call or argument error.
    shp is a shape control array, and its set up correctly... ive tested the top and left properties in other ways and they are working.
    if u have any input itd be greatly appreciated
    Last edited by MET777; Dec 30th, 2005 at 04:00 PM.
    --Matt

  2. #2

  3. #3

    Thread Starter
    Lively Member MET777's Avatar
    Join Date
    Apr 2005
    Posts
    76

    Re: Do really long calculations cause problems? what am i doing wrong?

    right... well the whole reasoning behind makeing that extremely large calculation was to speed up my program b/c i figured making 6 or 8 array variables in a loop would be much more time consuming than just rolling them all together... am i wrong in this assumption?
    --Matt

  4. #4

  5. #5

    Thread Starter
    Lively Member MET777's Avatar
    Join Date
    Apr 2005
    Posts
    76

    Re: Do really long calculations cause problems? what am i doing wrong?

    ok thanx... what is it that makes vb so slow if it processes numbers so fast? isnt everything in a program essentially numbers?
    --Matt

  6. #6

  7. #7

    Thread Starter
    Lively Member MET777's Avatar
    Join Date
    Apr 2005
    Posts
    76

    Re: Do really long calculations cause problems? what am i doing wrong?

    really? thats not been my impression... ive always been told that c++ and c are way faster powerful languages
    --Matt

  8. #8

  9. #9
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Do really long calculations cause problems? what am i doing wrong?

    Quote Originally Posted by MET777
    ok thanx... what is it that makes vb so slow if it processes numbers so fast? isnt everything in a program essentially numbers?
    Strings

    Working with Numbers is very fast in VB, actually VC++ time is just 15% faster than VB time.
    Last edited by jcis; Dec 31st, 2005 at 12:39 AM.

  10. #10
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Do really long calculations cause problems? what am i doing wrong?[resolved]

    you are probably trying to take the square root of a negative number.

  11. #11
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Do really long calculations cause problems? what am i doing wrong?[resolved]

    Quote Originally Posted by MET777
    ... what is it that makes vb so slow ... ?
    Quote Originally Posted by jcis
    Strings ...
    If it was that simple we could all leave with that ... I guess.
    Actually relatively small strings are quite fast - it's the large ones that slow down things. Also variants, objects, bindings and so on and so forth. But over all I think VB6 is pretty darn good "performer" !!!

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