js-hexfloat
Advanced tools
Comparing version 0.3.0 to 0.3.1
/* | ||
* $Id: hexfloat.js,v 0.1 2016/01/04 11:51:21 dankogai Exp dankogai $ | ||
* $Id: hexfloat.js,v 0.3 2016/01/04 17:53:08 dankogai Exp dankogai $ | ||
* | ||
@@ -13,4 +13,4 @@ * Licensed under the MIT license. | ||
var RE_HEXFLOAT = | ||
/([\+\-]?)0x([0-9A-F]+).?([0-9A-F]*)p([\+\-]?[0-9]*)/i; | ||
// 1 2 3 4 | ||
/([\+\-]?)0x([0-9A-F]+)\.?([0-9A-F]*)p([\+\-]?[0-9]*)/i; | ||
// 1 2 3 4 | ||
var parseHexFloat = function(s) { | ||
@@ -17,0 +17,0 @@ var m = RE_HEXFLOAT.exec(s); |
{ | ||
"name": "js-hexfloat", | ||
"version": "0.3.0", | ||
"description": "Rudimentary C99 Hexadecimal Float Support in JS", | ||
"version": "0.3.1", | ||
"description": "Rudimentary C99 Hexadecimal Floating Point Support in JS", | ||
"main": "hexfloat.js", | ||
@@ -6,0 +6,0 @@ "directories": { |
@@ -5,3 +5,3 @@ [![build status](https://secure.travis-ci.org/dankogai/js-hexfloat.png)](http://travis-ci.org/dankogai/js-hexfloat) | ||
Rudimentary C99 Hexadecimal Float Support in JS | ||
Rudimentary C99 Hexadecimal Floating Point Support in JS | ||
@@ -33,3 +33,3 @@ ## SYNOPSIS | ||
````javascript | ||
/([\+\-]?)0x([0-9A-F]+).?([0-9A-F]*)p([\+\-]?[0-9]*)/i | ||
/([\+\-]?)0x([0-9A-F]+)\.?([0-9A-F]*)p([\+\-]?[0-9]*)/i | ||
```` | ||
@@ -36,0 +36,0 @@ |
/* | ||
* $Id: test.js,v 0.1 2016/01/04 11:51:34 dankogai Exp dankogai $ | ||
* $Id: test.js,v 0.2 2016/01/04 17:52:54 dankogai Exp dankogai $ | ||
* | ||
@@ -44,2 +44,10 @@ * use mocha to test me | ||
is(isNaN(parseHexFloat('nonsense')), true)); | ||
it('0x1p-1074 == Number.MIN_VALUE', | ||
is(parseHexFloat('0x1p-1074'), Number.MIN_VALUE)); | ||
it('Number.MIN_VALUE.toHexString()', | ||
is(Number.MIN_VALUE.toHexString(), '0x1p-1074')); | ||
it('0x1.fffffffffffffp+1023 == Number.MAX_VALUE', | ||
is(parseHexFloat('0x1.fffffffffffffp+1023'), Number.MAX_VALUE)); | ||
it('Number.MAX_VALUE.toHexString()', | ||
is(Number.MAX_VALUE.toHexString(), '0x1.fffffffffffffp+1023')); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16358
99