Skip to content

betable/node-gmp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-gmp

synopsis

node-gmp wraps the libgmp library. This library has some poor practices when it comes to erro handling, so much trickery and deception is used to make this stable under node. Trickery includes: replacement allocators, replacement of jumps to abort() in instruction code and finally using sigsetjmp and siglongjmp to emulate try/throw a across C and signals in a more stable fashion.

The rest of gmp is just code.

    var gmp = require('gmp')
    var i = gmp.Int("123412341234123412341234123412341234");
    i.div("2").toString() // "61706170617061706170617061706170617"
    var f = gmp.Float("1234123412341234.123412341234", 1024).div("1.337");
    f.toString().replace(/(\.\d{10}).*$/, "$1") // "923054160315059.17981476530867"
    var r = gmp.Rational("22/7");
    r.toString() // "3.142857142857143"

requirements

installation

  # (useful environment variables: CXXFLAGS LINKFLAGS)
  $ node-waf configure build

Packages

No packages published

Languages

  • C++ 73.9%
  • JavaScript 21.4%
  • Python 4.7%