Re: [Chicken-users] Chicken objc egg on OSX Lion

2012-01-10 Thread Stephen Eilert
On Sat, Nov 19, 2011 at 5:55 PM, Jim Ursetto  wrote:

>
> On Nov 19, 2011, at 11:01 AM, Achint Sandhu wrote:
>
> >   The cleanest option I have found so far is the objective-C
> extension for Chicken Scheme (http://wiki.call-cc.org/eggref/4/objc),
> which I'm having trouble installing on 10.7.
> >
> >   A quick google search reveals
> http://lists.gnu.org/archive/html/chicken-users/2010-12/msg00041.html and
> http://comments.gmane.org/gmane.lisp.scheme.chicken/12638 which seem to
> indicate that the objc extension isn't being actively developed and/or
> maintained.
>
> Correct, objc is not supported on 10.6 or higher, due to significant
> internal changes from Objective C 1.0 to 2.0 in that version.
>
>
Sorry for digging up an old thread but, what would those significant
internal changes be? Where would one have to begin in order to understand
the code?



-- Stephen

*"Kids these days.*
*Whatever happened to hard work?"*

   -- Joel Spolsky, The perils of javaschools
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Bug in numbers egg -- log function

2012-01-10 Thread Peter Bex
On Tue, Jan 10, 2012 at 03:36:04AM +0100, Alexander Shendi wrote:
> Dear Chicken users,
> 
> I have encounterd what seems to be a bug in the numbers egg. The problem
> occurs when I evaluate "(log 297.0+0.1i)".

Please try the attached patch (or numbers trunk, as of r25802).

#;1> (use numbers)
#;2> (log 297.0+0.1i)
5.69373219548625+0.000336700323976755i

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
-- Donald Knuth
Index: numbers.scm
===
--- numbers.scm (revision 25798)
+++ numbers.scm (working copy)
@@ -1359,15 +1359,17 @@
 (define exp %exp)
 
 (define (%log x)
-  (cond
-   ((%> x 0.0 'log) ; avoid calling inexact->exact on X here (to avoid 
overflow?)
-(##core#inline_allocate ("C_a_i_log" 4) (%exact->inexact x)))
-   ((%= x 0.0)
-(if (%exact? x)
-(log0 'log x)
-   (##core#inline_allocate ("C_a_i_log" 4) (%exact->inexact x
-   (else ; negative
-(%+ (%log (%magnitude x)) (* (make-complex 0 1) (%angle x))
+  (let ((type (%check-number x)))
+(cond
+ ;; avoid calling inexact->exact on X here (to avoid overflow?)
+ ((or (eq? type COMP) (%< x 0.0 'log)) ; General case
+  (%+ (%log (%magnitude x)) (* (make-complex 0 1) (%angle x
+ ((eq? x 0); Exact zero?  That's undefined
+  (log0 'log x))
+ ((eq? type NONE)
+  (bad-number 'exp x))
+ (else ; Simple real number case
+  (##core#inline_allocate ("C_a_i_log" 4) (%exact->inexact x))
 
 (define log %log)
 
Index: tests/numbers-test.scm
===
--- tests/numbers-test.scm  (revision 25798)
+++ tests/numbers-test.scm  (working copy)
@@ -418,6 +418,13 @@
  (test "log of exp = 1" 1.0 (log (exp 1)))
  (test "log of -1" (string->number "0.0+3.141592653589793i") (log -1))
 
+ (test "log with complex number"
+   (string->number "0.0+1.5707963267948966i")
+   (log (string->number "+i")))
+
+ (test "exp(log(x)) = x"
+   (string->number "2.0-3.0i") (exp (log (string->number "2.0-3.0i"
+
  (letrec ((fac (lambda (n)
  (if (zero? n)
  1
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Bug in numbers egg -- log function

2012-01-10 Thread Peter Bex
On Tue, Jan 10, 2012 at 03:36:04AM +0100, Alexander Shendi wrote:
> Dear Chicken users,
> 
> I have encounterd what seems to be a bug in the numbers egg. The problem
> occurs when I evaluate "(log 297.0+0.1i)". I have tested this with 
> the current stable release (4.7.0) on the following platforms:
> 
> OS CPU   Machine
> ===
> OpenBSD 5.0   Loongson2F (mips64el)  Lemote Yeeloong 8089B
> OpenBSD 5.0   i686 (x86) Asus eeePC 701
> 
> I have appended the two logs below. 

Thanks for the logs.  I'll have a look.

> I have two questions:
> 
> - Is this list the proper place to report the bug?

Yes, this is fine.  You could also send me a mail directly, or file
a ticket on trac (the latter is preferred).

> - How do I obtain the source code of the numbers egg, so 
>   I can come up with a patch?

You can fetch it from subversion:
https://code.call-cc.org/svn/chicken-eggs/release/4/numbers/trunk

(username: "anonymous", password: "")

Alternatively, use chicken-install -r  to retrieve the source
code without installing it or removing them.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
-- Donald Knuth

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Bug in complex log function in numbers egg

2012-01-10 Thread Alexander Shendi
Dear Chicken users,

I have encounterd what seems to be a bug in the numbers egg. The problem
occurs when I evaluate "(log 297.0+0.1i)". I have tested this with 
the current stable release (4.7.0) on the following platforms:

OS CPU   Machine
===
OpenBSD 5.0   Loongson2F (mips64el)  Lemote Yeeloong 8089B
OpenBSD 5.0   i686 (x86) Asus eeePC 701

I have appended the two logs below. 

I have two questions:

- Is this list the proper place to report the bug?
- How do I obtain the source code of the numbers egg, so 
  I can come up with a patch?

Many thanks in advance,

Alexander Shendi

= Log for yeeloong.local (mips64el) =
Script started on Mon Jan  9 21:40:58 2012
$ csi -v

CHICKEN
(c)2008-2011 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.7.0 
openbsd-unix-gnu-mips [ 64bit dload ptables ]
compiled 2011-11-13 on loongson.local (OpenBSD)

$ csi -R numbers -e '(log 297+0.1i)'

Error: (log) bad argument type - complex number has no ordering: 297.0+0.1i

Call history:

  (##core#require-extension (numbers) #t)
  (##core#begin (##core#begin (##core#begin 
(##sys#require (quote numbers))) (import numbers)) (##core..
  (##core#begin (##core#begin (##sys#require (quote 
numbers))) (import numbers))
  (##core#begin (##sys#require (quote numbers)))
  (##sys#require (quote numbers))
  (quote numbers)
  (##core#quote numbers)
  (import numbers)
  (import (except scheme + - * / = > < >= <= eqv? 
number->string string->number exp log sin cos tan at..
  (##core#undefined)
  (##core#undefined)
  (##core#undefined)
(##sys#require (quote numbers))
  (log 297.0+0.1i)
(log 297.0+0.1i)  <--
$ 

Script done on Mon Jan  9 21:41:36 2012

= Log for eeepc.local (i386) 
=
Script started on Mon Jan  9 22:04:44 2012
$ csi -v

CHICKEN
(c)2008-2011 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.7.0 
openbsd-unix-gnu-x86 [ manyargs dload ptables ]
compiled 2012-01-09 on eeepc.local (OpenBSD)

$ csi -R numbers -e '(log 297.0+0.1i)'

Error: (log) bad argument type - complex number has no ordering: 297.0+0.1i

Call history:

  (##core#require-extension (numbers) #t)
  (##core#begin (##core#begin (##core#begin 
(##sys#require (quote numbers))) (import numbers)) (##core..
  (##core#begin (##core#begin (##sys#require (quote 
numbers))) (import numbers))
  (##core#begin (##sys#require (quote numbers)))
  (##sys#require (quote numbers))
  (quote numbers)
  (##core#quote numbers)
  (import numbers)
  (import (except scheme + - * / = > < >= <= eqv? 
number->string string->number exp log sin cos tan at..
  (##core#undefined)
  (##core#undefined)
  (##core#undefined)
(##sys#require (quote numbers))
  (log 297.0+0.1i)
(log 297.0+0.1i)  <--
$ 

Script done on Mon Jan  9 22:05:23 2012

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users