Make sure you are working in your copy of the Covid Spread Starter File.

Benefits and Downsides of working with Approximations

1 What are some possible benefits to approximating large and small numbers when doing computations?

2 What are some possible downsides to approximating large and small numbers when doing computations?

Exponentiation and "RoughNums" in Pyret

3 Write each of the expressions below in Pyret, then evaluate them and write down the answer. The first one has been started for you!

Pyret Code

Evaluates to…​

Pyret Code

Evaluates to…​

102

expt​(​10, 2​)

100

1/3

21/2

33

271/3

31/3

4 When do you think Pyret switches to RoughNums, instead of Numbers?

5 In Pyret, evaluate the following expressions: 1 == 1, ~1 == ~1
Why do you think Pyret gives an error when comparing identical RoughNums?




6 The pros of using ~1 involve speed. What are the potential downsides of using ~1 to speed up a calculation?



7 How likely are these downsides to apply to our Bootstrap work in code.pyret.org (CPO)?

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, 1738598, 2031479, and 1501927). CCbadge Bootstrap by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.