fix `nextpow`, `prevpow` for types without `typemax` (#49669)
Without this change `prevpow` and `nextpow` fail for, e.g., `BigInt`;
incorrectly throwing a `MethodError`. For example, calls like
`prevpow(3, big"10")` or `nextpow(3, big"10")` fail.
The issue is that the code incorrectly assumes the existence of a
`typemax` method.
Another issue was a missing promote for the arguments of a
`mul_with_overflow` call.
Fixes #57906