package zarith_stubs_js

  1. Overview
  2. Docs
Javascripts stubs for the Zarith library

Install

Dune Dependency

Authors

Maintainers

Sources

zarith_stubs_js-v0.16.0.tar.gz
sha256=d82391d892472355b992656a39fb01a9f6b8a6bd4feef3f286b4709cda255020

Description

This library contains no ocaml code, but instead implements all of the Zarith C stubs in Javascript for use in Js_of_ocaml

Published: 14 Jun 2023

README

Zarith Stubs JS

Zarith is an OCaml library that implements common operations over arbitrary-precision integers and rationals. It is implemented via a C api that primarily calls out to Gnu Multiple Precision Arithmetic Library. Because of that C API, Zarith could not be compiled via Js_of_ocaml until now.

Zarith Stubs JS is a reimplementation of the native C functions in JavaScript. It makes extensive use of peterolson/BigInteger.js as a shim for browser BigInt functionality and also for the implementations of many numerical algorithms.

How to use it ?

In order to use zarith with js_of_ocaml, just provide the javascript runtime files to the js_of_ocaml compiler and use zarith as you would normally do.

In practice,

  • if you use dune to build your project, just add zarith_stubs_js as a library dependency.

  • if you don't use dune, you need to find a way to pass both biginteger.js and runtime.js files to the js_of_ocaml compiler command line.

Dependencies (2)

  1. dune >= "2.0.0"
  2. ocaml >= "4.14.0"

Dev Dependencies

None

Conflicts (1)

  1. zarith < "1.12" | >= "1.13"