~/talk

Exploring Swift’s numeric protocols

Talkat iOS Conf SG 2017 · 2017-10-19..10-20· [functional-programming]
slides:none on file

Covers Swift’s numeric-protocol hierarchy, standard-library source use, and concrete surprises: integer initializers trap on overflow but Float80 yields infinity for out-of-range values; adding 0.1 ten times produces ~1.0001119 due to rounding. Shows practical tools: examining bitPattern and using ulp(of:) and nextUp to compute representable gaps, converting bitPattern to an integer for relative ULP comparisons, and writing protocol-constrained helpers (generic hypotenuse, slope classification, byte-to-binary-string) that actually work across Int/Float types.

AI-written summary · about

  1. 0:00Intro
  2. 0:30Numbers
  3. 0:48Fundamental to computing
  4. 1:26Swift's numeric types
  5. 4:10Numeric Protocols
  6. 5:11protocol Binary Integer
  7. 7:21protocol Floating Point
  8. 9:38Semantics
  9. 10:04Mixing numeric types
  10. 10:36Type inference
  11. 11:20Previous example
  12. 13:37Extensions for our specific domain extension FloatingPoint
  13. 14:22Example: drawing line graphs
  14. 14:53small tweaks make a
  15. 20:20Integer representation
  16. 22:05Floating-point representation Float.pi
  17. 23:58Positive and negative zero
  18. 29:02Next representable Float
  19. 29:20Number Theory
  20. 32:14Next representable value: .nextUp protocol FloatingPoint !
  21. 33:30Comparing relative ULPs
  22. 35:28Precision is hard. Equality is harder.
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.