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.

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.

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.

Reply via email to