You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
巴林闲侠
6f4dcd76d0
|
3 years ago | |
---|---|---|
.. | ||
docs | 3 years ago | |
externs | 3 years ago | |
tests | 3 years ago | |
.npmignore | 3 years ago | |
.travis.yml | 3 years ago | |
LICENSE | 3 years ago | |
Long.js | 3 years ago | |
Long.min.js | 3 years ago | |
NOTICE | 3 years ago | |
README.md | 3 years ago | |
bower.json | 3 years ago | |
jsdoc.json | 3 years ago | |
long.png | 3 years ago | |
package.json | 3 years ago |
README.md
A Long class for representing a 64-bit two's-complement integer value derived from the Closure Library for stand-alone use and extended with unsigned support.
Why?
As of the ECMAScript specification, number types have a maximum value of 2^53. Beyond that, behaviour might be unexpected. Furthermore, bitwise operations can only be performed on 32bit numbers. However, in some use cases it is required to be able to perform reliable mathematical and/or bitwise operations on the full 64bits. This is where Long.js comes into play.
Features
- CommonJS compatible
- RequireJS/AMD compatible
- Shim compatible (include the script, then use var Long = dcodeIO.Long;)
- node.js compatible, also available via npm
- Fully documented using jsdoc3
- API-compatible to the Closure Library implementation
- Zero production dependencies
- Small footprint
Usage
node.js / CommonJS
Install: npm install long
var Long = require("long");
var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF);
console.log(longVal.toString());
...
RequireJS / AMD
require.config({
"paths": {
"Math/Long": "/path/to/Long.js"
}
});
require(["Math/Long"], function(Long) {
var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF);
console.log(longVal.toString());
});
Browser / shim
<script src="Long.min.js"></script>
var Long = dcodeIO.Long;
var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF);
alert(longVal.toString());
Documentation
Downloads
License
Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.html