moonad / Moonad

Moonad: a p2p academic journal, or a social network for code?
http://moonad.org/
MIT License
28 stars 7 forks source link

TODO lib #29

Closed MaisaMilena closed 3 years ago

MaisaMilena commented 4 years ago

Bits

Hint By just googling "binary addition" (or multiplication, division) etc. we can find some simple algorithms

Word

F64

Pos32

String

jonathanrlouie commented 4 years ago

I'll try implementing Pos32.dot

jonathanrlouie commented 4 years ago

I'd like to try implementing Bits.mul as well.

jonathanrlouie commented 4 years ago

I'd like to try implementing Bits.sub, Bits.div and Bits.mod, but I have a couple of questions about how that should be done:

  1. What is the expected behavior for Bits.sub(a, b) when b > a?

  2. What is the expected behavior for Bits.div(a, b)/Bits.mod(a, b) when b is zero?

EDIT: It seems to be common to return 0 in all these cases, so that's how I'm implementing them.

MaisaMilena commented 3 years ago

Moved to Formality repo