Am 16.04.2011 um 23:03 schrieb Ralf Hemmecke:

> On 04/16/2011 10:04 PM, Prof. Dr. Johannes Grabmeier wrote:
>> can anybody explain the meaning of the length function in Integer? I
>> thought that should be the length of the binary expansion, at least
>> for i>= 0:
> 
> Thank you for reporting.
> 
> I consider this a bug.

that is what I think as well, but I disagree with your "solution" to fix only 
the documentation, not the bug on which we agree!


> 
> In integer.spad the implementation is:
> 
>      length a == INTEGER_-LENGTH(a)$Lisp
> 
> whereas its definition is in si.spad (IntegerNumberSystem).
> 
>   length   : % -> %
>      ++ length(a) length of \spad{a} in digits.


We should fix this to

      ++ length(a) length of \spad{a} in binary digits neglecting a negative 
sign

length(-8) should return 4 
      

> 
> Very clear this is. :-( What is a digit? Binary digit? Decimal digit?
> Since that is not clearly defined, the implementation could even return 
> something else.
> 
> And the implementation via integer-length is maybe not perfectly representing 
> what one would intuitively understand by "lenght in digits".
> http://www.cs.utexas.edu/users/moore/acl2/v4-2/INTEGER-LENGTH.html
> 
> I've somehow the impression that even the lisp documentation is wrong. I 
> would believe that representing 0 requires at least 1 bit, but it's probably 
> a question of making the specification one way or the other. So, it would be 
> better to explicitly define length(0)=0.
> 
> So my suggestion would be to fix the documentation rather than the code.
> Other opinions?
> 
> While we are at it... anybody else experiencing a crashing hyperdoc?
> 
> Click Browse
> Enter "lenght"
> click "Operations"
> Click "Signatures"
> Click on the 4th "lenght"
> 
> My HyperDoc window disappears.
> 
> Ralf
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "FriCAS - computer algebra system" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/fricas-devel?hl=en.
> 

Mit freundlichen Grüßen

Johannes Grabmeier

Prof. Dr. Johannes Grabmeier
Köckstraße 1, D-94469 Deggendorf
Tel. +49-(0)-991-2979584, Tel. +49-(0)-171-5503789
Tel. +49-(0)-991-3615-100 (d),  Fax: +49-(0)-1803-5518-17745

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to