W2031 Designing a Floating Point Type
From Coder Merlin
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
Prerequisites[edit]
Background[edit]
Introduction[edit]
Topic Headers[edit]
Key Concepts[edit]
Exercises[edit]
Exercises

- Design a struct named Real whose member properties may only be of type Int or Bool.
- Define initializers:
init(_ d:Double)
init(_ n:Int)
- Define functions for addition, subtraction, multiplication, and division.
- All such functions should take the form:
func operationName(_ other:Real) -> Real
- These functions should be named add, subtract, multiply, and divide
- All such functions should take the form:
References[edit]
- Double Precision Floating Point Format (Wikipedia)
- IEEE754 Visualization (Bartaz)
- IEEE754 Floating Point Converter (Schmidt)
- Converting to IEEE754 Form (IA State)
- Conversion Library (David M. Gay)