Results 1 to 6 of 6

Thread: Multiply Numbers

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Posts
    253

    Question

    Hello,

    I'm trying to multiply 2 fractions by using ONLY addition operations. Does anyone know how to do that?

    Thanks.

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    For X*Y Loop X times trough R=R+X
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Posts
    253
    That doesn't work for fractions (decimal fractions that the user enters)!

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    loose the decimal point, and add up both decimal places in the result, for instance:

    2.5 * 3.75
    decimal places: 1 + 2 = 3

    25 * 375
    loop 25 times, add up 375 to result

    result = 9375

    add 3 decimal places:

    9.375
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    keddie,

    How do you lose the decimal points without multiplication/division? Methinks that logarithms are the way to go.

    Cheers,

    P.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    paul> how about instrrev(value,".") to find it, and replace(value,".","") to removit it.

    Well i'm not sure how this scenario is set but i'm sure multiplication is done with integers.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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