Learning Scientific Programming with Python (2nd edition)

P2.2.2: Some fun with the math module:

Question P2.2.2

(a) What is special about the numbers $\sin\left(2017\sqrt[5]{2}\right)$ and $(\pi + 20)^i$?

(b) What happens if you try to evaluate an expression, such as $e^{1000}$, which generates a number larger than the largest floating point number that can be represented in the default double precision? What if you restrict your calculation to integer arithmetic (for example, by evaluating $1000!$)?

(c) What happens if you try to perform an undefined mathematical operation such as division by zero?

(d) The maximum representable floating point number in IEEE 754 double precision is about $1.8 \times 10^{308}$. Calculate the length of the hypotenuse of a right angled triangle with opposite and adjacent sides $1.5 \times 10^{200}$ and $3.5 \times 10^{201}$ (i) using the math.hypot() function directly and (ii) without using this function.