Question

Suppose we work with some particular programming language (like C++) on some particular computer. Furthermore, we want to know which values are minimum and maximum for some particular numeric data type of this language. We can't use any specific tools of our language (like numeric_limits), and have no access to language or system documentation. Specifically, we don't know the lengths of our words. Is there an effective and rather precise way to find out the min/max we want to know?

We can certainly write some loop starting with zero and adding one at each step and wait for an overflow. But it is certainly not an effective way. We can write some loop and check some condition like $\log(\exp(n)) \stackrel{?}{=} n$, but I'm not sure whether this will answer our question.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with cs.stackexchange
scroll top