1 / 9
Aug 2013

There are a couple of different ways that depend on what the constraints on a b and m are.

Not knowing any of that information the best answer that you are likely looking for is multiplicative inverse.

What problem are you trying to solve? I don't understand the requirement. Maybe some details would help.

If you're working with double then there is no trouble with dividing all items in a by its corresponding item in b to begin with.

Also, when computing a*2, where a is of type double some error is induced automatically.

say for example,

a = 1680.000000
a = a*2;
then value of 'a' shown is
a = 3359.999999

I'm using Fibonacci series. And as you know, n'th Fibonacci number can be found by the following formula and ɸ = 1.6180339887

[attachment=0]forum.png[/attachment]

So to store accurate value of phi, i'm using double.

There is a better (possibly more difficult) method of finding the nth fibonnacci number.

I think i found a better way for computing n'th Fibonacci number.
Thanks leppy.