|
-
Nov 27th, 2000, 01:53 PM
#1
Thread Starter
Addicted Member
Hello,
I'm trying to multiply 2 fractions by using ONLY addition operations. Does anyone know how to do that?
Thanks.
-
Nov 27th, 2000, 02:36 PM
#2
transcendental analytic
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.
-
Nov 28th, 2000, 04:26 AM
#3
Thread Starter
Addicted Member
That doesn't work for fractions (decimal fractions that the user enters)!
-
Nov 28th, 2000, 04:37 AM
#4
transcendental analytic
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.
-
Nov 28th, 2000, 06:57 AM
#5
Fanatic Member
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...
-
Nov 28th, 2000, 07:08 AM
#6
transcendental analytic
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|