]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/es6-symbol/node_modules/es5-ext/math/fround/shim.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / node-gyp / node_modules / path-array / node_modules / array-index / node_modules / es6-symbol / node_modules / es5-ext / math / fround / shim.js
1 // Credit: https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js
2
3 'use strict';
4
5 var toFloat32;
6
7 if (typeof Float32Array !== 'undefined') {
8         toFloat32 = (function () {
9                 var float32Array = new Float32Array(1);
10                 return function (x) {
11                         float32Array[0] = x;
12                         return float32Array[0];
13                 };
14         }());
15 } else {
16         toFloat32 = (function () {
17                 var pack   = require('../_pack-ieee754')
18                   , unpack = require('../_unpack-ieee754');
19
20                 return function (x) {
21                         return unpack(pack(x, 8, 23), 8, 23);
22                 };
23         }());
24 }
25
26 module.exports = function (x) {
27         if (isNaN(x)) return NaN;
28         x = Number(x);
29         if (x === 0) return x;
30         if (!isFinite(x)) return x;
31
32         return toFloat32(x);
33 };