Skip to content

postwait/node-gmp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 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

About

gmp for node

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 69.7%
  • JavaScript 23.3%
  • C 7.0%