SC‐2024‐04‐29‐Morning - TheEvergreenStateCollege/upper-division-cs-23-24 GitHub Wiki

Software Construction, Spring 2024

Week 05

Topics:

  • Abstracting Internal Representation
    • A floating point number
    • Given a cell on a road in the city, assign it an address
    • Rust type signature for a trait interface
    • Olympia vs. Tokyo house addressing
  • Unit tests
  • Rust Debugger and rust-analyzer
  • Game Tree exploration with abstract Graph data type

Abstracting Internal Representation

A Floating Point Number

In the IEEE 754 standard, floating point numbers are stored in 32-bit (for single precision) and 64-bit (for double preicision) registers by dividing up their bitfields as follows

image

However, we can suffer from "floating point" errors that accumulate over time. Isn't there a way to represent some kinds of numbers that retain their precision?

Let's make up a custom type that improves on the representation of floating point numbers for a specific class of fractional values: ratios of integers.

Rational Numbers

Let's make an abstract type that lets us