Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

尝试修改了一些bug #24

Open
liangaili opened this issue May 10, 2019 · 0 comments
Open

尝试修改了一些bug #24

liangaili opened this issue May 10, 2019 · 0 comments

Comments

@liangaili
Copy link

master...liangaili:patch-1

try to fix some bugs in ecStat.js. details below …

  1. Sometimes precision will become negavite value (I don't know why), set it to -precision or 0 (I don't know why, but my code works for me) if this happens.
    有的时候precision这个值会变成负数,导致出错,根据其他issue里的建议,我修改了部分precision的值,有的时候设成了-precision,有时设成了0,总之现在我这里不再出这个报错了。

  2. Doing rangeArray[i - 1] + step is not right, rangeArray is an array of floats while step is a string, which makes 20 + '0.1' become '200.1', change it to (rangeArray[i - 1] + parseFloat(step));
    在计算bins的x0和x1的时候,计算到最后一个元素需要计算rangeArray[i - 1] + step,这时前项是float而后项是string,导致计算结果错误。

  3. +((bin.x0 + bin.x1) / 2).toFixed(precision) will produce depulicated value, try this in your console: ((1.4+1.5)/2).toFixed(1) and ((1.3+1.4)/2).toFixed(1) will both produce 1.4
    计算bins的最后,toFixed导致了部分相邻项目会重叠。

  4. var ret = +((stop >= start ? step1 : -step1).toFixed(precision)); sometimes ret will be 0 (I don't know and why), but when this happens, just return 0.1
    有时返回的step会变成0,不知道为什么,但是强行设置成了0.1可以避免出错。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant