Re: [Scheme-reports] Complex gcd? John Cowan (26 May 2014 18:24 UTC)
Re: [Scheme-reports] Complex gcd? Fredrik Noring (26 May 2014 19:11 UTC)

Re: [Scheme-reports] Complex gcd? John Cowan 26 May 2014 18:20 UTC

Fredrik Noring scripsit:

> 25 maj 2014 kl. 23:38 skrev John Cowan <cowan@mercury.ccil.org>:
>
> > It extends to Gaussian integers (complex numbers whose real and
> > imaginary parts are both integers), but there is no support for
> > those in Scheme except as a subset of the general complex numbers.
>
> OK, well, I thought exactness didn't matter given that R7RS explicitly
> provides "(lcm 32.0 -36) ==> 288.0" as an "inexact" example.

Correct.  `gcd` and those like it are applicable to both exact and inexact
integers, but not to non-integers exact or inexact, and in Scheme (as in
mathematics generally) the integers are a subset of the reals.

> So "32" and "32.0" are both fine, but "0.0+32.0i" is not (even
> though it is computable) because the "exact" version "0+32i" is not
> supported? (Odd, in my opinion.)

I don't understand this sentence.  It's true that 32 and 32.0 are both
fine and that 0.0+32.0i and 0+32i are not (though they may be provided as
an implementation-specific extension).  However, the failure to support
inexact Gaussian integers is not a *consequence* of the failure to support
exact ones; they are both equally barred because they are not integers.

> > Writing a SRFI for Gaussian integers would be a Good Thing.
>
> How would that work, would you be able to elaborate?

It would be a library of procedures applicable to Gaussian integers
specifically, where the standard procedures can't handle them, or produce
the wrong results, or do not yet exist.  Not being a mathematician,
I can't say what procedures should be provided.

--
John Cowan          http://www.ccil.org/~cowan        cowan@ccil.org
How comes city and country to be filled with drones and rogues, our highways
with hackers, and all places with sloth and wickedness?
                --W. Blith, Eng. Improver Improved, 1652

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports