gpt4 book ai didi

java - 将 Bigdecimal 和 int 相乘产生错误

转载 作者:行者123 更新时间:2023-11-29 10:13:48 25 4
gpt4 key购买 nike

<分区>

当我将其存储在 Integer 中时,我有一个值,如 0.0004,它正在转换为 Exponential 格式,所以我使用了 Bigdecimal 将其转换为正常值,如下所示

 Bigdecimal x=BigDecimal.valueOf(0.0004)

现在,我尝试乘以 x*100,但我遇到了以下错误。

Error: The operator * is undefined for the argument type(s) BigDecimal, int

由于这个错误,如果我再次使用它而不使用 bigdecimal,它将转换为 EXponential

任何人都可以建议我乘以 Bigdecimal 和 int 的方法。

google 了很多,但找不到正确的解决方案。

谢谢你的时间

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com