This site is a preview of the curriculum for our Summer 2018 bootcamp in Burlington, Vermont. As we continue our preparation, courses and lessons will appear and disappear; we will rename, rearrange, clarify, and obfuscate as needed... Please consider this a work in progress and keep checking in.

Ruby Basics:
Numbers


Slides

Numbers

Ref. WGR Chapter 8, Section 8.3, Numerical objects

Numerical Operations

+ - * / %

etc.

Floats vs. Integers (Fixnums)

floating point literals

conversion only happens when it needs to

>> 2/3 == 0
=> true

>> 2.0/3 == 0.6666666666666666
=> true

>> 2.0/3 == 0.666666666666666
=> false

>> 2.0/3 == 0.6666666666666667
=> false

>> 2.to_f/3
=> 0.6666666666666666

IEEE Rounding Error Is Awesome

>> 0.5 - 0.4 - 0.1
=> -2.7755575615628914e-17

>> (0.8 - 0.7 - 0.1)/(0.5 - 0.4 - 0.1)
=> -3.0


Comments

comments powered by Disqus