Haskell.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview
thread

GCD

Simon Peyton-Jones

11 Dec 2001 11 Dec '01
9:37 a.m.

About the GCD operator, the Haskell Report currently says: "gcd x y is the greatest integer that divides both x and y. lcm x y is the smallest positive integer that both x and y divide." Why does 'lcm' say 'positive' while 'gcd' does not? What is gcd -3 -6 Presumably 3, not -3. You could say that is obvious, since 3 > -3. So I propose to add "positive" to the gcd spec: gcd x y is the greatest POSITIVE integer that divides both x and y. I don't think that changes the specification in fact, but experience has led me to always check these things! Simon

0 0
Reply
Sign in to reply online Use email software

Back to the thread

Back to the list

HyperKitty Powered by HyperKitty version 1.3.12.