Ruby Datamapper 存储以科学记数法显示的小数
我有一个模型,称为交付:
property :id, Serial
property :created_at, DateTime
property :updated_at, DateTime
property :price, BigDecimal, :precision => 10, :scale => 2
交付有一个价格,在 SQLite 中查看时,其值为 5.49、6.95、4.95
当在输出中显示此信息(以 haml 编码)时,delivery.price 中的值显示为 0.695 E1、0.495E1 等
知道为什么它们以这种格式显示,以及如何最好地“正确”显示它们。
感谢所有帮助!
I have a model, called delivery:
property :id, Serial
property :created_at, DateTime
property :updated_at, DateTime
property :price, BigDecimal, :precision => 10, :scale => 2
Delivery has a price, which when viewed in SQLite is values such as 5.49, 6.95, 4.95
When displaying this information in the output (coded in haml), the values from delivery.price are displayed like 0.695E1 , 0.495E1 etc
Any idea why they are showing in this format, and how best to display them 'correctly.
All help is appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
转换为字符串 (
BigDecimal#to_s
) 采用格式参数:Conversion to string (
BigDecimal#to_s
) takes a format parameter: