I want to know how to find antilogarithm of a float. My first approach was to use built-in functions like exp(), pow() both in Python & C, but they gave out of range error.
Then I tried to break It in two parts, one integer & other float, then calculate 10 raise to the power separately for both of them & then multiply them to get the result. so when I try to calculate (a*b) in Python It says long int too large to convert to float
My Original task was to calculate antilog(x)%m & I converted it (a*b)%m where a is very very large integer & b is float.
So can anyone help me out with this? Is there any modular property that applies on floats? Or is there any "fast" & "efficient" way to calculate antilog(x)?
If you need to calculate
(10**x)%m
, don't try to compute10**x
first. The pow function takes three arguments:This seems perfect for your problem. You want
pow(10, x, m)
OOPS: except you have a non-integral exponent.
Can't you use these equalities:
a**(b+c) == a**b * a**c
(a*b)%m == (a%m * b%m) % m
to define a function like this: