Skip to content

Commit

Permalink
add section on missing functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Oct 25, 2019
1 parent 4f826d8 commit efb76bb
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ An efficient 64-bit integer with correct overflow.

Bitwise operators in javascript can only use 32 bits. Sometimes, external protocols use 64-bit integers. This package implementes such integers with "correct" overflow behavior.

This is a low-level package focussed on speed. The 64-bit integers are represented as a 2-tuple of 32-bit numbers.
This is a low-level package focussed on speed. The 64-bit integers are represented as a 2-tuple of 32-bit numbers. There are helpers for conversion to string and `elm/bytes` `Bytes`.

```elm
import Int64
Expand Down Expand Up @@ -33,3 +33,25 @@ Performance is roughly half for subtraction, addition and the bitwise operators.
## Reliabiltiy

This package is extensively tested with fuzz tests. Nonetheless, the logic is extremely tricky, so there might still be bugs.

## Missing functionality


1. `Int64 -> Int`

This is unsafe, because `Int` cannot store all the information of a `Int64`. If you think the conversion is safe for you, use:

```elm
Int64.fromInt 42
|> Int64.toSignedString
|> String.fromInt
--> Just 42
```

2. `String -> Int64`

And by extension converting 64-bit integers in e.g. JSON into `Int64`. This is tricky to implement, but PRs are welcome!

3. Multiplication, integer division, modulo

Would be nice to have, again PRs are welcome!

0 comments on commit efb76bb

Please sign in to comment.