Combining integer and float types problem.

soggyoats@gmail.com soggyoats at gmail.com
Wed Sep 29 08:33:21 CEST 2010


I think that subject line might be a bit misleading. Sorry if it makes you confused, just disregard it.

Before I start, I'd like to say hello to you all and introduce myself, I am Matt Plant, but you can call me just that, as I like that name.

Anyway, I have a program where at one give point a variable may have to be used to calculate 10000!, and at another point it may be used to calculate 57/292. What I have found is that using float types give a bunch of problems (I think the reason why is because float types don't expand? I may be wrong). For example, with a float type initialized to the default precision, 10000! ends up being something like 25939292 followed by and ungodly amount of zeros. It's not even close to the correct amount. So, I was wondering, is there some way to make a universal data type? One that it is possible to do any operation to, without having to consider precision and the like? I guess a good comparison would be the python bignum library, which does pretty much exactly what I'm looking for, but just isn't GMP (which is altogether, in my opinion, much better).

Now, the errors in accuracy I am getting may be caused by a programming bug, in which case please tell me I am doing it wrong.

If anyone could help me out it would be greatly appreciated.

Sent from my Verizon Wireless Phone


More information about the gmp-discuss mailing list