o1-labs / integers_stubs_js Goto Github PK
View Code? Open in Web Editor NEWJavascript stubs for the integers library in js_of_ocaml
License: MIT License
Javascript stubs for the integers library in js_of_ocaml
License: MIT License
Missing primitives:
integers_uint32_to_hexstring
integers_uint64_to_hexstring
The native version of Unsigned.UInt32.to_int64
returns an int64 holding the exact same value as the given uint32, which I suppose is the expected behavior. The js stubs version, when the leftmost bit is 1, yields a different, very large number instead. I suspect the stubs are filling the 32 leftmost bits with ones instead zeroes.
let ui32 = Unsigned.UInt32.of_int 3748276426 in
let i64 = Unsigned.UInt32.to_int64 ui32 in
Format.eprintf "%Ld@." i64
Native output: 3748276426
Javascript output: 281478724987082
Saved me lot of time when I tried to port some code for the browser!
The way UInt64s are handled does not properly install the written comparison function.
I believe this is because uint64 values are actually represented as int64 so the setting of custom functions here does nothing:
caml_custom_ops["integers:uint64"] =
{ serialize: caml_int64_marshal
, deserialize: caml_int64_unmarshal
, hash: caml_int64_hash
, compare: integers_uint64_compare };
As a result, the compare function for uint64s is the signed compare, and thus does not work correctly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.