i came to know this error recently while using pow function for a large data such as
pow(8376260,70)
it giving 0 as output which is wrong. i tried using long and unsigned but it giving the same output. is there any way to use large data in pow function??
Yeah this function is kinda weird so it does problems. Create your own pow function so it doesn't cause problems. Also the numbers you are using are very large so it will overflow
The function is fine, it even reports errors when it happens. You can check such errors with the
errno
macro.Thanks. I never lnew that. But isn't implementing the function yourself better? Especially when you have to do it for large numbers where you have to use mod
yep, in this case that would probably be the only option.
(unless you're using python, of course)
the pow function returns a "double" type.
You'd better use binary pow.