#5818: gcd and fizzled reversed in event SparkCounters
-+--
Reporter: MikolajKonarski | Owner: duncan
Type: bug | Status: new
Priority
#5818: gcd and fizzled reversed in event SparkCounters
--+-
Reporter: MikolajKonarski | Owner: duncan
Type: bug | Status: closed
Priority
#5818: gcd and fizzled reversed in event SparkCounters
-+--
Reporter: MikolajKonarski | Owner: duncan
Type: bug | Status: new
Priority
#5818: gcd and fizzled reversed in event SparkCounters
-+--
Reporter: MikolajKonarski | Owner: duncan
Type: bug | Status: new
Priority
#5818: gcd and fizzled reversed in event SparkCounters
-+--
Reporter: MikolajKonarski | Owner: duncan
Type: bug | Status: new
Priority
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: closed
Priority: normal | Milestone: 7.2.1
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: closed
Priority: normal | Milestone: 7.2.1
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: closed
Priority: normal | Milestone: 7.2.1
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: closed
Priority: normal | Milestone: 7.2.1
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: closed
Priority: normal | Milestone: 7.2.1
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: closed
Priority: normal | Milestone: 7.2.1
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: closed
Priority: normal | Milestone: 7.2.1
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: patch
Priority: normal | Milestone: 7.2.1
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: patch
Priority: normal | Milestone: 7.2.1
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: patch
Priority: normal | Milestone: 7.2.1
23:48
| To: haskell-prime@haskell.org
| Subject: Re: Proposal: Make gcd total
|
| On Wed, May 25, 2011 at 08:24:52PM +0200, Daniel Fischer wrote:
|
| If it's considered to be a small enough change so a libraries proposal
| would be sufficient, all the better, but if not, I'd like to pursue
On Wednesday 18 May 2011 03:57:06 I wrote:
Following
http://hackage.haskell.org/trac/haskell-prime/wiki/Process#Proposals
I hereby volunteer to become the proposal owner.
So, how's this going to continue?
It sparked a renewed go at simplifying the libraries proposal process, but
since it
On Wed, May 25, 2011 at 08:24:52PM +0200, Daniel Fischer wrote:
If it's considered to be a small enough change so a libraries proposal
would be sufficient, all the better, but if not, I'd like to pursue the
haskell-prime process further.
My understanding is that for changes to libraries
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: patch
Priority: normal | Milestone: 7.2.1
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: patch
Priority: normal | Milestone: 7.2.1
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: new
Priority: normal | Milestone: Not GHC
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: new
Priority: normal | Milestone: 7.2.1
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: new
Priority: normal | Milestone: 7.2.1
On Mon, May 9, 2011 at 3:49 PM, Daniel Fischer
daniel.is.fisc...@googlemail.com wrote:
I would like to propose the elimination of the special error case
gcd 0 0 = error Prelude.gcd: gcd 0 0 is undefined
to replace it with
gcd 0 0 = 0
(which would be an automatic consequence of removing
I would like to propose the elimination of the special error case
gcd 0 0 = error Prelude.gcd: gcd 0 0 is undefined
to replace it with
gcd 0 0 = 0
(which would be an automatic consequence of removing the above line).
Rationale:
1. It makes gcd a total function.
2. It makes gcd associative.
3
+1
On 9 May 2011 19:11, Jacques Carette care...@mcmaster.ca wrote:
+1
Jacques
On 09/05/2011 6:49 PM, Daniel Fischer wrote:
I would like to propose the elimination of the special error case
gcd 0 0 = error Prelude.gcd: gcd 0 0 is undefined
to replace it with
gcd 0 0 = 0
(which would
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec | Owner:
Type: proposal| Status: closed
Priority: normal | Milestone: Not GHC
#2270: gcd is specialised only for Int
+---
Reporter: dons |Owner:
d...@galois.com
Type: bug | Status: closed
Priority
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec|Owner:
Type: proposal | Status: new
Priority: normal|Milestone: Not GHC
#3304: define gcd 0 0 = 0
--+-
Reporter: stevec| Owner:
Type: proposal | Status: new
Priority: normal| Milestone
#3304: define gcd 0 0 = 0
-+--
Reporter: stevec| Owner:
Type: proposal | Status: new
Priority: normal| Component: libraries/base
Thanks for all the replies, it looks like there is a lot of support for
having gcd 0 0 = 0.
I've since discovered that there was a similar discussion in 2001, where
the majority supported gcd 0 0 = 0, but the suggested change was never
implemented.
http://www.haskell.org/pipermail/haskell/2001
Am Sonntag 03 Mai 2009 00:17:22 schrieb Achim Schneider:
Steve stevech1...@yahoo.com.au wrote:
It is useful to define gcd(0, 0) = 0 and lcm(0, 0) = 0 because then
the natural numbers become a complete distributive lattice with gcd
as meet and lcm as join operation. This extension
On Sat, May 2, 2009 at 4:17 PM, Achim Schneider bars...@web.de wrote:
Steve stevech1...@yahoo.com.au wrote:
It is useful to define gcd(0, 0) = 0 and lcm(0, 0) = 0 because then
the natural numbers become a complete distributive lattice with gcd
as meet and lcm as join operation
Having gcd(0,0) = 0 doesn't mean that 0 is not divisible by any other
natural number. On the contrary, any natural trivially divides 0 since n*0 =
0. Perhaps the disagreement is over what is meant by greatest. The
greatest in gcd is not w.r.t. the canonical ordering on the naturals;
rather w.r.t
Nathan Bloomfield nblo...@gmail.com wrote:
The greatest in gcd is not w.r.t. the canonical ordering on the
naturals; rather w.r.t. the partial order given by the divides
relation.
This, to defend myself, was not how it was explained in high school.
--
(c) this sig last receiving data
This, to defend myself, was not how it was explained in high school.
No worries. I didn't realize this myself until college; most nonspecialist
teachers just don't know any better. Nor did, it appears, the original
authors of the Haskell Prelude. :)
BTW, this definition of gcd makes it possible
Something that perhaps could be added is that leaving 0 `gcd` 0 undefined
has two obvious annoying consequences: gcd is no longer idempotent (i.e. we
don't have a `gcd` a = a, for all a), and it is no longer associative ((a
`gcd` 0) `gcd` 0 is well-defined whilst a `gcd` (0 `gcd` 0
Am Sonntag 03 Mai 2009 18:16:38 schrieb Achim Schneider:
Nathan Bloomfield nblo...@gmail.com wrote:
The greatest in gcd is not w.r.t. the canonical ordering on the
naturals; rather w.r.t. the partial order given by the divides
relation.
Nitpick: it's not a partial order, but a preorder (2
On 2 May 2009, at 04:05, Steve wrote:
Why is gcd 0 0 undefined?
In math, one may define gcd(x, y) as a generator of the ideal
generated by x and y in the ring of integers Z. The gcd(x, y) then
always exists as the ring Z is a PID (principal ideal domain), i.e.,
all ideals can
Hi Steve,
Steve wrote:
Why is gcd 0 0 undefined?
That's a good question. Can you submit an official proposal?
http://www.haskell.org/haskellwiki/Library_submissions
Thanks,
Martijn.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http
Steve stevech1...@yahoo.com.au wrote:
It is useful to define gcd(0, 0) = 0 and lcm(0, 0) = 0 because then
the natural numbers become a complete distributive lattice with gcd
as meet and lcm as join operation. This extension of the definition
is also compatible with the generalization
[Question moved over from Haskell-Beginners]
I had a look at the gcd definition in GHC 6.10.1
ghc-6.10.1/libraries/base/GHC/Real.lhs
-- | @'gcd' x y@ is the greatest (positive) integer that divides both
@x@
-- and @y@; for example @'gcd' (-3) 6@ = @3@, @'gcd' (-3) (-6)@ = @3@,
-- @'gcd' 0 4
#2270: gcd is specialised only for Int
+---
Reporter: dons |Owner:
d...@galois.com
Type: bug | Status: new
Priority
#2270: gcd is specialised only for Int
-+--
Reporter: dons | Owner: [EMAIL
PROTECTED]
Type: bug | Status: new
Priority
#2270: gcd is specialised only for Int
-+--
Reporter: dons | Owner: [EMAIL
PROTECTED]
Type: bug | Status: new
Priority: normal
#2270: gcd is specialised only for Int
+---
Reporter: dons| Owner: [EMAIL PROTECTED]
Type: bug | Status: new
Priority: normal | Milestone: 6.10.1
#2270: gcd is specialised only for Int
--+-
Reporter: dons | Owner: [EMAIL PROTECTED]
Type: bug | Status: new
Priority: normal| Milestone: 6.10.1
Component
#2270: gcd is specialised only for Int
+---
Reporter: dons | Owner: [EMAIL PROTECTED]
Type: bug | Status: new
Priority: normal | Component: Compiler
Version
is the supremum (result of max in the expression above) if a and b are both 0?
(You're allowed to use values not prescribed by Haskell to exist. ;-)
(You can replace divisors by factors in that expression and still get the same
result.)
I may agree that an operation *similar* to gcd, where 0,0 as argument
Ch. A. Herrmann ([EMAIL PROTECTED]) wrote:
: In contrast, 0*x=0, thus 0 divides 0 (somehow).
: But I have problems with gcd being the greatest positive integer ...
[snip]
: - 0 is not positive, it is non-negative or natural
: - 2 also divides 0 and 2 is a greater integer than 0
: (0
Alan Bawden ([EMAIL PROTECTED]) wrote:
:In case it isn't clear already, these definitions make a lattice on
:the positive integers, with divides ~ leq, gcd ~ meet and lcm ~ join,
:using the report's definitions of gcd and lcm.
:
: Indeed, that's a nice way of putting it. How about
Simon == Simon Peyton-Jones [EMAIL PROTECTED] writes:
Simon Christoph does not like this
It's OK if the definition is clear; it wasn't using
the words positive or greatest integer.
Stating gcd 0 0 = 0 explicitly is a good thing,
even if it could be expressed verbatim;
people may think
From: Marc van Dongen [EMAIL PROTECTED]
Date: Tue, 18 Dec 2001 09:32:49 +
Alan Bawden ([EMAIL PROTECTED]) wrote:
: Indeed, that's a nice way of putting it. How about if the report just
: says:
:
:In order to make the non-negative integers into a lattice under `gcd
Lars Henrik Mathiesen ([EMAIL PROTECTED]) wrote:
: Alan Bawden ([EMAIL PROTECTED]) wrote:
: : Indeed, that's a nice way of putting it. How about if the report just
: : says:
: :
: :In order to make the non-negative integers into a lattice under `gcd'
: :and `lcm', we define `gcd
(in the ordinary sense)
divisor of 0. Indeed, +infinity is a much larger divisor of 0...
I'm not in favour of using a very special-purpose order, not used for
anything else, and that isn't even an order but a preorder, just to
motivate gcd 0 0 = 0. Even if using this very special-purpose preorder
.)
This thread made me curious, so I did a little library research. I was
surprised to discover that mathematicians discover on this, the domain
of definition of gcd a b:
DomainReferences
----
a /= 0, b /= 0Lang, Algebra, 3rd Edition
Hasse, Number
of polynomials over a field. Here the non-zero elements of
the field are the units; no one has ever suggested calling them primes!
In a general UFD one can only speak of _a_ gcd of two elements x and y,
meaning an element d such that one has (x, y) = (d), an equality of
ideals. In some special cases
Why not define gcd a b as the largest (in 'normal' order) integer d such
that the set of sums of
multiples of a and b {na+mb | n - Z, m - Z} is equal to the set of
multiples of d
{nd | n - Z}? Easy to understand, no talk of division, lattices, rings,
ideals etcetera, and it covers the cases
Sorry for an error in my previous message. The definition there of a gcd
works only in a prinicpal ideal domain (which covers all the rings
mentioned in the examples). According to Bourbaki, chapter on ordered
groups, the gcd of two non-zero elements of a UFD A is well-defined as
an element
From: Marc van Dongen [EMAIL PROTECTED]
Date: Sun, 16 Dec 2001 13:35:59 +
Marc van Dongen ([EMAIL PROTECTED]) wrote:
: An integer $a$ divides integer $b$ if there exists an integer
: $c$ such that $a c= b$.
To make clear why $0$ (and not any other non-zero integer) is the
gcd
I've reconsidered my earlier position and think now that the Prelude is wrong to make
gcd 0 0 an error, and should return 0. It probably doesn't make much difference to
anyone, but it's like 1 not being a prime; it may be slightly harder to explain, but it
makes the maths come out nicer
George == George Russell [EMAIL PROTECTED] writes:
George I've reconsidered my earlier position and think now that the
George Prelude is wrong to make gcd 0 0 an error, and should return
George 0. It probably doesn't make much difference to anyone, but
George it's like 1
From: Lars Henrik Mathiesen [EMAIL PROTECTED]
Date: 17 Dec 2001 14:50:21 -
...
In case it isn't clear already, these definitions make a lattice on
the positive integers, with divides ~ leq, gcd ~ meet and lcm ~ join,
using the report's definitions of gcd and lcm.
Indeed
Simon Peyton-Jones [EMAIL PROTECTED] writes
[..]
If someone could write a sentence or two to explain why gcd 0 0 = 0,
(ideally, brief ones I can put in the report by way of explanation),
I think that might help those of us who have not followed the details
of the discussion.
Here
Marc van Dongen ([EMAIL PROTECTED]) wrote:
: An integer $a$ divides integer $b$ if there exists an integer
: $c$ such that $a c= b$.
[snip]
: gcd 0 0 = 0; and
: gcd 0 0 /= error Blah
To make clear why $0$ (and not any other non-zero integer) is the
gcd of $0$ and $0$ I should have added
From: Simon Peyton-Jones [EMAIL PROTECTED]
Date: Fri, 14 Dec 2001 01:18:56 -0800
...
If someone could write a sentence or two to explain why gcd 0 0 = 0,
(ideally, brief ones I can put in the report by way of explanation),
I think that might help those of us who have
|Probably, the best specification would be
|
| gcd n m :: Integer = if n == 0 m == 0 then 0
| else
| greatest integer that divides both n and m
Well, thank you all those that have contributed. My original point
was simply to say
Simon Peyton Jones ([EMAIL PROTECTED]) wrote:
: If someone could write a sentence or two to explain why gcd 0 0 = 0,
: (ideally, brief ones I can put in the report by way of explanation),
: I think that might help those of us who have not followed the details
: of the discussion.
Division
People write on gcd 0 0 :
Alan Bawden [EMAIL PROTECTED]
If you take the point-of-view that gcd is actually an operation on
ideals, then gcd(0, 0) is 0. I.e. define gcd(x, y) to be the smallest
z = 0 such that {m*x + n*y | m, n in Z} = {n*z | n in Z}. This is
probably the most natural
From: S.D.Mechveliani [EMAIL PROTECTED]
Date: Thu, 13 Dec 2001 12:53:32 +0300
Further, the definintion
gcd(x, y) to be the smallest
z = 0 such that {m*x + n*y | m, n in Z} = {n*z | n in Z}
is not natural. In particular, how does it generalize to gcd X Y
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
Simon == Simon Peyton-Jones [EMAIL PROTECTED] writes:
Simon gcd x y is the greatest POSITIVE integer that divides
Simon both x and y.
Simon I don't think that changes the specification in fact, but
Simon experience has led me to always check these things!
I find
On Tue, Dec 11, 2001 at 11:06:28AM +0100, Ch. A. Herrmann wrote:
Simon == Simon Peyton-Jones [EMAIL PROTECTED] writes:
Simongcd x y is the greatest POSITIVE integer that divides
Simon both x and y.
Simon I don't think that changes the specification in fact, but
Simon
The natural reading of 'greatest' is, of course,
the greatest in the divisibility preorder (it's partial order
on natural numbers but only a preorder on integers).
Thus, gcd 0 0 = 0.
3 and -3 are equivalent in that preoder.
Thus, an additional comment may be in order.
Stefan
Simongcd x y is the greatest POSITIVE integer that divides
Simon both x and y.
I find it confusing to read a definition which contains redundant
information. Instead, I'd suggest to add something like:
Note: this number is always positive
Or, perhaps easier on the eye
People write about the Report definition of
gcd x y
as of greatest integer that divides x and y,
and mention
gcd 0 0 = 0
But 2 also divides 0, because 2*0 = 0.
Does the Report specify that gcd 0 0 is not defined?
For an occasion
$)\\
\$= \infinitary(\posinf)$ \if $x = 0$ and $y = 0$
\end{example}
% There is no need to say v0 above, since there are always positive values in that
% set, and max picks the largest/greatest one. 0 has all integer values except(!) 0
% as divisors. So for gcd 0 0 (maximum, supremum really
S.D.Mechveliani wrote
Does the Report specify that gcd 0 0 is not defined?
Yes. The Report definition says
gcd :: (Integral a) = a - a - a
gcd 0 0 = error Prelude.gcd: gcd 0 0 is undefined
gcd x y = gcd
From: George Russell [EMAIL PROTECTED]
Date: Tue, 11 Dec 2001 18:18:31 +0100
...
Yes. The Report definition says
gcd :: (Integral a) = a - a - a
gcd 0 0 = error Prelude.gcd: gcd 0 0 is undefined
gcd x y = gcd' (abs x) (abs y
On my proposal for minBy, gcd ... :: [a] - a
and remark on +, ... being the exceptions
Matt Harden [EMAIL PROTECTED] writes on 19 May 2000
(+), () ... are different. Because they have classical tradition
to be applied as binary infix operations.
And gcd, min, max, lcm have
Sun, 21 May 2000 11:53:39 +0400 (MSD), S.D.Mechveliani [EMAIL PROTECTED] pisze:
The economy of names is more important.
Convenience of programming is important too. Many Prelude functions
are unnecessary, but are convenient. (++) and concat are not needed
(you can write flip (foldr (:)) for
"S.D.Mechveliani" wrote:
When processing this tree, it would be natural to write in each node
m + b and min [m,b].
The former is "necessary" due to the infix-binary tradition.
The latter uses [,] because it is good to have one function min for a
list and for
-Original Message-
From: michael abbott [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 01, 1999 10:47 AM
To: Simon Peyton-Jones
Cc: [EMAIL PROTECTED]
Subject: Query re gcd() in Haskell 98
It seems a bit late to raise this, but I notice that the
standard prelude
for Haskell 98
It seems a bit late to raise this, but I notice that the standard prelude
for Haskell 98 in the final draft still defines
gcd 0 0 = error ...
I remember some inconclusive discussion on this some time ago, but there is
no reason not to let gcd 0 0 == 0, as would happen anyway without
[If this whole 'gcd' discussion is getting 'too mathematical' for this list,
I propose to continue it by private e-mail with members of the Haskell
committee. If so, please give me an e-mail address to contact.]
At 09:16 6-11-96 +0300, you wrote in reply to my 'Why not make "gcd 0
Dear all,
I am very sorry for something like misprinting tragically in the
classic gcd definition. I had written
" gcd(a,b) is the *greatest* by inclusion ideal (d) among the
ones with the property of
(d) = {x*d | x - R} to be *contained inside*
(
Hello,
there was recently a letter on the subject like
" gcd(0,0) should be 0 ".
Unfortunately, I had lost it and cannot citate.
Here are simple considerations to prevent the confusion.
(1)
gcd(0,0) = 0 is all right.
But setting this wo
In response to Marnix Klooster [EMAIL PROTECTED] and
S.D.Mechveliani [EMAIL PROTECTED], can I offer another
mathematic perspective to explain why gcd(0,0) should be zero?
Just looking at the natural numbers, the relationship "a divides b",
written a|b, defines a partial orde
89 matches
Mail list logo