dijit.form.Number 未正确显示指数形式的数字
我有一个数字 Dojo 控件,它显示点后 30 位数字的数字。它正确地格式化数字,但是当数字足够小时,例如8e-13,控件显示类似8e-13,000000000000000000000000000000的内容,而不是0,000000000000800000000000000000。显然它失败并被标记为无效。我尝试将“round:-1”传递给它的约束,但没有任何结果。我还注意到 1.0000000000008 在控件中正确显示。这种奇怪的格式可能是什么原因? 谢谢。
I have a number Dojo control that shows numbers with 30 digits after point. It formats numbers correctly, but when the number is small enough e.g. 8e-13, control shows something like 8e-13,000000000000000000000000000000 rather than 0,000000000000800000000000000000. Apparently it fails and becomes marked as invalid. I tried to pass "round:-1" to its constraints without any result. I also have noticed that 1.0000000000008 is shown correctly in control. What could be the reason of this strange formatting?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Dijit 根本不能很好地处理这些案件。它是为更简单的情况而设计的。正如您所注意到的,指数表示破坏了格式化例程,因此极端数字根本不起作用。有一个以指数表示法格式化数字的选项,但这基本上没有实现。
Dijit simply doesn't handle these cases well. It's designed for more simple cases. Exponential representation breaks the formatting routines, so numbers at the extremes simply don't work, as you've noticed. There is an option for format numbers in their exponential notation, but that's largely unimplemented.