axiom-developer
[Top][All Lists]
Advanced

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

RE: [Axiom-developer] Re: [Gcl-devel] Segmentation violation:cstack ok:s


From: Vanuxem Gregory
Subject: RE: [Axiom-developer] Re: [Gcl-devel] Segmentation violation:cstack ok:signalling error with GCL-2.7.0 (cvs head)
Date: Thu, 30 Nov 2006 19:27:11 +0100

Le mercredi 29 novembre 2006 à 21:20 -0500, Page, Bill a écrit :

[...]

> I think this may be "reasonable" compromize definition for a
> function with signature
> 
>   Float -> Float
> 
> Juergen recognized this pecularity.
> 
> On 29 Oct 2003 14:35:25 +0100 Juergen Weiss wrote:
> 
> > Here the lisp version of the C versions in csl
> > One problem: the formula may work for real arguments
> > only.
> >
> >
> > ;; stolen from csl
> > #+(or :cmu :akcl)
> > (defun cot (a)
> >   (if (or (> a 1000.0) (< a -1000.0))
> >       (/ (cos a) (sin a))
> >     (/ 1.0 (tan a))))
> >
> > ;; stolen from csl
> > #+(or :cmu :akcl)
> > (defun asec (a)
> >   (if (and (a > -1.0) (a < 1.0))
> >      0.0
> >     (acos (/ 1.0 a))))
> >
> 
> Perhaps a better argument checking would be a good idea, but
> obviously Axiom does not try to call this asec function for
> real values between -1 and 1.

It seems that you did not notice the errors, as me at first glance:

(and (a > -1.0) (a < 1.0))

This is not Lisp code :-)

This function is meant to be used only with DoubleFloat and effectively
it is called. The avantage, for me, of the other definition is that,
combined with C-TO-R, it throws a library error : "Result is not real"
and do not return 0. Of course it can be easily implemented in Spad.

> (1) -> )cl all
>    All user variables and function definitions have been cleared.
> (1) -> asec(1.9)$Float
> 
>    (1)  1.0165344923 4256851184
>                                                      Type: Float
> (2) -> asec(0.9)$Float
> 
>    >> Error detected within library code:
>    acos: argument > 1 in magnitude
> 
> protected-symbol-warn called with (NIL)
> (2) -> asec(0.9)$Complex(Float)
> 
>    (2)  3.1415926535 8979323846 + 0.4671453081 0326201812 8 %i
>                                               Type: Complex Float

For Float, Complex(Float) and Complex(DoubleFloat) the Lisp asec
function is not used. I haven't looked at this recently but I think in
these cases, the definition comes from the
ArcTrigonometricFunctionCategory category.

Greg





reply via email to

[Prev in Thread] Current Thread [Next in Thread]