Results 1 to 6 of 6

Thread: Long Division Alternative

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2003
    Posts
    114

    Long Division Alternative

    Do anyone have any alternatives to long division? Normally I would find a quotient for something like 540028/1272 by using long division. Is there a better or another way?

    Thanks
    I can do all things with VB.

  2. #2
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    Calculators
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104
    What would be better? Do you mean faster? You might force it to floating points, now that Pentium chips do floating point division faster than integer division. Otherwise, you might just estimate, but then you deal with acceptable error. If you are very tolerant of error, the answer is always 1 or 0.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2003
    Posts
    114
    Yes, I meant faster. I guess the only way to get the correct answer efficiently is long division. Thanks.
    I can do all things with VB.

  5. #5
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375
    I'm not sure if this will do anything, but you might want to try multiplying by the reciprocal instead of dividing. It may be faster. Just guessing though.
    You just proved that sig advertisements work.

  6. #6
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104
    If you can get the reciprocal without division, then multiplication would be faster, though only slightly on floating point.

    If you are dividing by powers of 2, you can use bit shifting, which would be much faster, but that is a highly restricted solution. Still, x/4 + x/2 will be faster than 3x/4 if you use bit shifting.

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