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

关于幂函数的指数不是整数时图像不显示问题 #2

Open
yuqianglianshou opened this issue Oct 20, 2020 · 0 comments
Open

Comments

@yuqianglianshou
Copy link

当幂函数的指数不是整数时,图像是出不来的,比如 y = x^2.1 ,这是因为Math.pow(a,b);这个函数不支持 a<0且b不是整数的情况,此种情况会导致 domain error 错误。而程序会生成 x 小于0的点和 x 大于 0的点,当 x 小于0 求 y值时,所得y = NaN,故导致函数点无法绘制,函数图像绘制失败。请知悉。
我的解决办法是 当指数不是整数时,不生成x < 0的点,这样导致函数只有x>0的部分,但不会报错不显示。

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