Results 1 to 2 of 2

Thread: Overflow when dividing

  1. #1

    Thread Starter
    Frenzied Member cyborg's Avatar
    Join Date
    May 2000
    Location
    Sweden
    Posts
    1,755

    Question Overflow when dividing

    ok...
    im making a paint program, and when the user is going to draw a straight line, he has to do as in mspaint: hold down shift....
    the problem is when the program is going to calculate the m value and the k value of the line...

    here's a bit of the code:

    If Shift = 1 Then
    KValue = (Y - StartY) / (X - StartX)
    MValue = Y - X * KValue
    End If

    but it cant do the division!! it gives me the overflow error!
    why?
    Check out the FAQ and do a search before you post.
    My tutorials: Anti-Alias Pixels, Accurate Game Loop, Resource File

  2. #2
    Fanatic Member riis's Avatar
    Join Date
    Nov 2001
    Posts
    551
    make that Abs(X - StartX) >= 1
    Abs, so you can draw lines to the left from the current point.
    >= 1, because probably someone who draws with your program might want to draw lines with a difference of X which is 1.

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