Re: Draft of Binary module

On 13 March 2013 18:07, Florent Georges <fgeorges@fgeorges.org> wrote:
> On 13 March 2013 18:20, Adam Retter wrote:
>
>> An octet is implicitly in Base 8, so why would I then want to
>> manipulate it as thought it were Base 10 (but without
>> converting it to Base 10). This just doesnt make sense to me -
>
>> If I understand correctly -
>
>> bin:binary-to-octets(xs:hexBinary("FFFF"))  would give me (255, 255)
>
>> The problem is that I now have two Base 8 values in a Base 10
>> data type
>
>   I don't really understand.  An octet is not more base 8 nor
> base 10.  Neither is an integer.  They are abstractions of
> numbers, they don't have any base (their lexical representations
> have a base though).

Maybe I am confused, but perhaps an example would show my point or
illustrate an error in my thinking -

bin:binary-to-octets(xs:hexBinary("FF")) would give me (255)

If I then use the XQuery operators on this integer (and it seems to me
they do assume Base 10), I get something that is no longer a valid
octet.

e.g. -

bin:binary-to-octets(xs:hexBinary("FF")) + 1 would give me (256)


bin:octets-to-binary((256))

This would give me an error correct? if this was truly an octet (or
the operations were Base aware) and I was adding 1 to it I would not
get the sequence (256) but rather (1, 0) I think...

Does that make sense, if not I will try a different example...


>   Regards,
>
> --
> Florent Georges
> http://fgeorges.org/
> http://h2oconsulting.be/



--
Adam Retter

eXist Developer
{ United Kingdom }
adam@exist-db.org
irc://irc.freenode.net/existdb

Received on Wednesday, 13 March 2013 19:41:34 UTC