#!/usr/bin/env python
# coding: utf-8
#
# # Issues with `float` values
#
# Due to how decimjals numbers are represented (they are not natural for computers which are discrete machines), we have certain constraints in precision, and accuracy at the far reaches of the number's precision.
# In[5]:
import math
# In[2]:
celsius = 18.5
fahrenheit = (9/5) * celsius + 32
fahrenheit
# In[3]:
fahrenheit == 65.3
# In[4]:
round(fahrenheit, 1) == 65.3
# In[6]:
# Stolen from stackoverflow:
# https://stackoverflow.com/questions/558216/function-to-determine-if-two-numbers-are-nearly-equal-when-rounded-to-n-signific
math.isclose(fahrenheit, 65.3, rel_tol=1e-9, abs_tol=0.0)
# In[ ]: