< Chris_Stewart_5>
Does bitcoin use a specific numbering system? It seems that it doesn't follow one's complement or twos complement from what i can tell..
< arubi>
Chris_Stewart_5, are you looking at compact size..?
< Chris_Stewart_5>
arubi: I'm just talking about numbering in genral, for instance "81" is -1
< Chris_Stewart_5>
0x81*
< arubi>
ah, that's different. it's just signed int really.. that's the way I see it anyway
< Chris_Stewart_5>
Maybe I am thinking about it too much - i was looking over the two popular signed number representations and neither seem to map to bitcoins numbers
< arubi>
I think it means.. [0x00,0x7f] is positive, [0x80,0xff] is negative
< arubi>
with 0x80 being "negative zero"
< Chris_Stewart_5>
... or I am missing something obvious
< sipa_>
Chris_Stewart_5: you're talking about how integers are encoded inside script
< sipa_>
not "how bitcoin uses numbering system"
< Chris_Stewart_5>
sipa_: Is this one of those things "Satoshi implemented it that way" or is there a purpose behind our encoding?
< sipa_>
no, satoshi did it that way, and it does not matter
< arubi>
I really can't think of a different way to represent a negative range of numbers..
< sipa_>
i'd have done it differently, but it hardly matters :)
< Chris_Stewart_5>
Gotcha, I was refactoring a library I am writing and I came across this weird encoding again and I was trying to figure out what it exactly was for documentation purposes
< Chris_Stewart_5>
Thanks arubi sipa_
< arubi>
oh don't thank me, I'm not even sure I'm right
< Chris_Stewart_5>
arubi: You would probably want to use twos complement to remove the weird corner case of -0 since that is kind of ugly
< sipa_>
yes, two's complement is most common
< arubi>
I'd want to know if I got to 0x80 or 0x00 when I subtracted two numbers if I signed it..
< sipa_>
?
< sipa_>
the result of a subtraction will never be 0x80
< sipa_>
because it's just a non-canonical encoding of 0
< arubi>
hm.. I see. thanks sipa_. I was thinking about (0x81 - 0x01), would that be 0x00 then?
< sipa_>
no, it would be {}
< arubi>
even better. cool
< sipa_>
the arithmetic operators always first convert their inputs to integers (the mathematical concept, not their byte representation), then do the relevant operation, and then convert back to the shortest byte encoding for the resulting number
< sipa_>
that means that there is no way to even observe the difference between {} {0x80} {0x00} ...
< sipa_>
except by comparing them byte-wise to known constants
< arubi>
oh I think I see. sipa_ , is that CScriptNum ?
< arubi>
seems like that's the place to look.
< sipa_>
yes
< hello_>
Could someone tell me what 'mempool' is in bitcoin core? I guess it is some ds where the transactions are stored , correct??
< sipa_>
hello_: every node in the network maintains a set of unconfirmed transactions
< sipa_>
hello_: miners use this to build new blocks
< hello_>
sipa_: Hi recently there was some discussion about some remove() cancel() function on the mempool? Could you explain it in a line...