[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: scheme-reports@x*Subject*: Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0*From*: Per Bothner <per@x>*Date*: Thu, 20 Dec 2012 22:19:07 -0800*In-reply-to*: <20121221055315.GB28661@mercury.ccil.org>*References*: <878v8z5iq8.fsf@tines.lan> <874njn5b65.fsf@tines.lan> <20121215204015.GG13463@mercury.ccil.org> <87obhv3ts0.fsf@tines.lan> <20121215231548.GC10312@mercury.ccil.org> <87bodu4r0r.fsf@tines.lan> <20121216041031.GE10312@mercury.ccil.org> <87pq25yh5s.fsf@tines.lan> <20121219221955.GH4477@mercury.ccil.org> <87d2y5y6fb.fsf@tines.lan> <20121221055315.GB28661@mercury.ccil.org>

On 12/20/2012 09:53 PM, John Cowan wrote: > Okay, the details are at ComplexRepresentations now. Racket, Kawa, Chez, > Vicare, Larceny, Ypsilon, !IronScheme, Spark support (imag-part 2.0) => 0 > even though they don't support mixed-exactness complex numbers. Kawa supports mixed-exactness complex numbers: #|kawa:1|# (define z1 (make-rectangular 1.4 2)) #|kawa:2|# (list (real-part z1) (imag-part z1)) (1.4 2) #|kawa:3|# (list (exact? (real-part z1)) (exact? (imag-part z1))) (#f #t) > My guess is that `make-rectangular` > always returns a boxed or unboxed pair of numbers whatever the values > may be on every system that supports complex numbers at all. Not on Kawa: #|kawa:7|# (eqv? (make-rectangular 1.4 0) 1.4) #t #|kawa:8|# (invoke (make-rectangular 1.4 0) 'getClass) class gnu.math.DFloNum #|kawa:9|# (invoke (make-rectangular 1.4 0.0) 'getClass) class gnu.math.DComplex The abstract class Complex has 3 subclasses: RealNum - real numbers (an abstract class) DComplex - a pair of (unboxed) doubles CComplex - a general pair of (boxed) RealNums The actual code called by make-rectangular is: public static Complex make (RealNum re, RealNum im) { if (im.isZero() && im.isExact()) return re; if (! re.isExact() && ! im.isExact()) return new DComplex(re.doubleValue(), im.doubleValue()); return new CComplex (re, im); } -- --Per Bothner per@x http://per.bothner.com/ _______________________________________________ Scheme-reports mailing list Scheme-reports@x http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports

**References**:**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*Mark H Weaver <mhw@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*Mark H Weaver <mhw@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*John Cowan <cowan@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*Mark H Weaver <mhw@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*John Cowan <cowan@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*Mark H Weaver <mhw@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*John Cowan <cowan@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*Mark H Weaver <mhw@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*John Cowan <cowan@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*Mark H Weaver <mhw@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*John Cowan <cowan@x>

- Prev by Date:
**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0** - Next by Date:
**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0** - Previous by thread:
**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0** - Next by thread:
**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0** - Index(es):