~/talk

Comparison is not simple, but it can be simpler

Talkat CppCon 2015 · 2015-09-21..09-25· [compilers-and-language-design]
links:none on file
slides:none on file

The standard’s algorithms require a strict weak order and passing general floating‑point values to std::sort is undefined: examples show five‑element inputs with NaNs producing wildly different sorted partitions and binary_search failures, and memoization over 1/x breaks because +0/−0 and many distinct NaNs behave inconsistently. The uploader supplies code and slides on GitHub that implement IEEE’s total order function and three comparator kinds (partial, weak, total), which fix sorting and memoization; a proposal (N4367) pushes ternary comparators into the library.

AI-written summary · about

  1. 0:00Intro
  2. 0:16What is comparison?
  3. 1:11What is an equivalence relation?
  4. 2:18What is an order relation?
  5. 4:39What comparison orders are needed?
  6. 6:37How is sorting with NaN?
  7. 7:54How is sorting with signed zero?
  8. 10:25How is memoization with NaN?
  9. 13:47Is floating point the only problem?
  10. 16:05What is the real problem?
  11. 16:51Can it get worse?
  12. 19:59Write boolean comparison functions.
  13. 22:41How do we handle floating point?
  14. 23:27Respect IEEE 754 totalOrder.
  15. 25:06Check relationship with operators.
  16. 25:45Take advantage of common cases.
  17. 27:01How do we handle Zip+4 codes?
  18. 30:05How do we compare composite types?
  19. 33:10What can the standard do?
  20. 37:27Can we make coding easier?
  21. 39:24What is the path forward?
  22. 41:22Questions?
~/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.