gcl-devel
[Top][All Lists]
Advanced

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

Re: [Gcl-devel] tan compilation problem


From: Vadim V. Zhytnikov
Subject: Re: [Gcl-devel] tan compilation problem
Date: Wed, 07 Aug 2002 22:55:49 +0300
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.0.0) Gecko/20020526

Camm Maguire пишет:
Greetings!

"Vadim V. Zhytnikov" <address@hidden> writes:


Camm Maguire пишет:

Hi Vadim, and thanks for the report!  A fix is always easier than a
good report!!


Thanks for quick fix! Now it works fine. Actually this new tan
definition improved some other related things.  For example
previosly (tan 1) gave some weird number and now it produces
something sensible and exactly the same as (tan 1.0) which
we certainly expect. I only still wonder why the old tan defined
via sin/cos doesn't work properly.



Hmm.  If you can reproduce and report the errant behavior with an old
build, I'll verify that it has been eliminated, and not still present
somewhere in the functions called by number_tan.  Only if you feel
there is still some possibility of bug here.  Right now, I get the
same answer with (/ (sin 1) (cos 1)).


Maybe I confused you then just don't worry.
Now everything seems to be fine.



As for small nonzero values I'm not numerical calculus expert
but they seems to be OK.  First of all how can we expect to get
exact zero (cos (/ pi 2)) if (/ pi 2) is not exactly pi/2 (and
newer will be)?  So it seems that any value will do unless error
is too big.



Once (/ pi 2) is represented as a float, you are of course right.  But
if gcl had some type analogous to the rational type with which to
represent this number and those similar, then stuff like (equal (/ 1
(sqrt 2)) (cos (/ pi 4))) would return t, etc.  I'm sure maxima has
some facility for this -- I don't know if it really belongs in a lisp
system, though.

There is no symbolic pi in Common Lisp.  This pi is just _numerical_
constant.  Unlike Lisp Maxima has symbolic pi and know some exact rules
about it but Maxima's pi has nothing to do with Lisp's constant pi.


So the question is if the following code is useless:

object
number_tan(object x)
{
        object r, c;
        vs_mark;

        c = number_cos(x);
        vs_push(c);
        if (number_zerop(c) == TRUE)
                FEerror("Cannot compute the tangent of ~S.", 1, x);
        r = number_tan1(x);
        vs_reset;
        return(r);
}



--
     Vadim V. Zhytnikov

      <address@hidden>
     <address@hidden>
     <address@hidden>
    <address@hidden>








reply via email to

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