testing bigfloat constants incorrectly



For example,
(defmfun zerop1 (a) (if (numberp a) (zerop a) (alike1 a bigfloatzero)))
on line 199
(defmfun onep1 (a) (or (and (numberp a) (= a 1)) (equal a bigfloatone)))
on line 311 

and many other places where a comparison to bigfloatone occurs. 
but bigfloat ones will look like this: in
default bigfloat fpprec:

((BIGFLOAT SIMP 56) 36028797018963968 1)

but fpprec:32 makes bigfloat one look like:
((BIGFLOAT SIMP 109) 324518553658426726783156020576256 1)

one thought is to use this to test for bigfloat zero also

(defun mzerop(z)
  (and (mnump z)
       (or (and (numberp z)(= z 0))
	   (and (bigfloatp z)(= (cadr z) 0))))) ;bigfloat zeros may be diff
precisions

alternatively, alike1 would be
ok for zeros, since they will always look like ((bigfloat simp <precision>)
0 0),
 and I think that alike1 doesn't check cdars. But testing for bigfloatone is
not so easy unless the precisions are identical.

RJF


> -----Original Message-----
> From: maxima-admin at math.utexas.edu 
> [mailto:maxima-admin at math.utexas.edu] On Behalf Of Raymond Toy
> Sent: Tuesday, August 08, 2006 7:23 AM
> To: Richard Fateman
> Cc: 'Maxima'
> Subject: Re: [Maxima] testing bigfloat constants incorrectly
> 
> >>>>> "Richard" == Richard Fateman <fateman at cs.berkeley.edu> writes:
> 
>     Richard> I've notice a bunch of places in simp.lisp where 
> there are tests to see if a
>     Richard> number k is zero or one, and someone added an 
> extra consideration, namely,
>     Richard> is k equal to bigfloatzero or bigfloatone.
> 
> Should all of them be changed? 
> 
>     Richard> If these tests were important, there are tests 
> for these conditions (see the
>     Richard> bfloat defs), which could be used which are not 
> especially slower than
>     Richard> equal. 
> 
> Which bfloat defs are you talking about here?  Can you point 
> out what function tests for a bigfloat zero/one?
> 
> Ray
> 
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>