UNPKG
big-rat
Version:
latest (1.0.4)
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
0.0.0
A big integer rational number
github.com/rat-nest/big-rat
rat-nest/big-rat
big-rat
/
add.js
12 lines
(8 loc)
•
189 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
'use strict'
var
rationalize =
require
(
'./lib/rationalize'
)
module
.
exports
= add
function
add
(
a, b
) {
return
rationalize
( a[
0
].
mul
(b[
1
]).
add
(b[
0
].
mul
(a[
1
])), a[
1
].
mul
(b[
1
])) }