bigdecimal如何表达负数
时间: 2023-10-18 22:59:22 浏览: 145
要在Java中使用BigDecimal表示负数,可以使用`negate()`方法。该方法返回一个BigDecimal对象,表示当前对象的相反数。例如,如果要将`bi`表示的BigDecimal对象转换为负数,可以使用`bi = bi.negate();`语句。这将改变`bi`的值为其相反数。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [判断bigdecimal类型是正负数还是0+bigdecimal正负数转换](https://blog.csdn.net/ljljlj1993/article/details/125997611)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *3* [Java编程BigDecimal用法实例分享](https://download.csdn.net/download/weixin_38668274/12770167)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文