令dataset.getymax返回零,以防数据集中没有项目,而不是 - infinity -nylogic
我正在将数据添加到数据集
当条件为true
时,我正在使用getymax()
来计算数据集中的最大值。但是,如果数据集
是空的(未收集项目),它将返回-Infinity
。有什么方法可以使getymax()
返回0
而不是-infinity
?
谢谢
I'm adding data to dataset
when a condition is true
, then I'm using getYMax()
to calculate the maximum value in the dataset. However, if the dataset
is empty (no items have been collected) it will return -infinity
. Is there any way to make getYMax()
return 0
instead of -infinity
?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然。使用单独的函数返回double并将数据集作为参数,将其称为
f_getDSmax()
:或者您以1行进行操作:
Sure. Use a separate function returning a double and taking the dataset as an argument, call it
f_getDSMax()
:Or you do it in 1 line: