unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Catonano <catonano@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: unsigned-int
Date: Fri, 23 Jun 2017 08:16:54 -0400	[thread overview]
Message-ID: <871sqaj3ux.fsf@netris.org> (raw)
In-Reply-To: <CAJ98PDzYQoaifaa4=-Cyp=XOK_tf-c=OZLpwSdBDLFqyq5guMA@mail.gmail.com> (catonano@gmail.com's message of "Thu, 22 Jun 2017 21:13:39 +0200")

Catonano <catonano@gmail.com> writes:

> 2017-06-22 18:20 GMT+02:00 Mark H Weaver <mhw@netris.org>:
>
>> Given this, and
>> the fact that you're passing the wrong width, makes me surprised that
>> this is working for you at all.
>
>
> Mark, thank you so much for your review. I appreciate that
>
> I apologize if my questions are naive.

No, not at all.  I appreciate your work on guile-freexl.  My surprise
that it was working at all was not a judgement of you, rather it was a
sincere confusion, but now I understand.

The combination of two mistakes: (endianness big) and width 1, actually
had the effect of making this work for numbers small enough to fit in 1
byte, which means unsigned numbers between 0 and 255 and signed numbers
between -128 and 127.

> So, yeah, I'm sorry for the fuss

No need to apologize.

> All that said, I applied the fixes that you suggested and I still get
> completely wrong number of rows of the spreadsheets and correct number of
> columns
>
> Exactly as before your correctons

Except that now it will work for larger numbers, and on architectures
that are truly big endian, whereas before it wouldn't have.

> For now I renounced to extract  numbers from my bytevectors
> 
> The culprit is: #vu8(232 3 0 0)
> 
> There are 27 lines in the sheet, so this bytevector should represent 27,
> somehow.

On a little-endian architecture (which includes Intel and most other
popular architectures), #vu8(232 3 0 0) represents 1000.  If that's the
number you're getting, then that part of the code is working correctly.

> On another sheet in the same file, this is what happens:
> 
> (#vu8(118 0 0 0) #vu8(17 0))
> 
> The sheet has 17 columns indeed. And it has 23 rows :-/

#vu8(118 0 0 0) represents 118.

I'm not sure why it's a different number than you're expecting, but I
can tell you that's the number in that bytevector.

       Mark



  parent reply	other threads:[~2017-06-23 12:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22  9:42 unsigned-int Catonano
2017-06-22  9:56 ` unsigned-int Catonano
2017-06-22 16:20 ` unsigned-int Mark H Weaver
2017-06-22 19:13   ` unsigned-int Catonano
2017-06-22 19:33     ` unsigned-int Catonano
2017-06-22 19:55       ` unsigned-int Catonano
2017-06-22 20:01         ` unsigned-int Catonano
2017-06-22 20:53           ` unsigned-int Catonano
2017-06-23 12:37       ` unsigned-int Mark H Weaver
2017-06-23 12:16     ` Mark H Weaver [this message]
2017-06-24  9:17       ` unsigned-int Catonano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871sqaj3ux.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=catonano@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).