File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,12 @@ var slice = Array.prototype.slice,
26
26
// test if object
27
27
isObject = function ( arg ) {
28
28
return toString . call ( arg ) === "[object Object]" ;
29
+ } ,
30
+
31
+ // calculate correction for IEEE
32
+ calcRdx = function ( n , m ) {
33
+ var val = n > m ? n : m ;
34
+ return Math . pow ( 10 , 15 - ~ ~ ( Math . log ( ( ( val > 0 ) ? val : - val ) ) * Math . LOG10E ) ) ;
29
35
} ;
30
36
31
37
// implement bind if browser doesn't natively support it
@@ -290,7 +296,7 @@ jStat.extend({
290
296
// generate sequence
291
297
seq : function ( min , max , length , func ) {
292
298
var arr = [ ] ,
293
- hival = 1e15 , // simple fix for IEEE floating point errors
299
+ hival = calcRdx ( min , max ) ,
294
300
step = ( max * hival - min * hival ) / ( ( length - 1 ) * hival ) ,
295
301
current = min ,
296
302
cnt = 0 ;
You can’t perform that action at this time.
0 commit comments