English
BigDecimal
About 229 wordsLess than 1 minute
2026-01-09
BigDecimal
BigDecimal - Numeric type
Summary
Define BigDecimal: BigDecimal b
Example:
BigDecimal b = 0.01
```text
Static methods of BigDecimal type:
- `BigDecimal.of(<String value>)`
- `BigDecimal.of(<Number value>)`
Decimal rounding:
- b.setScale(decimal places, BigDecimal.ROUND_HALF_UP) Round half up
- b.setScale(decimal places, BigDecimal.ROUND_HALF_DOWN) ROUND_UP when discarded part >5, otherwise ROUND_DOWN
- b.setScale(decimal places, BigDecimal.ROUND_UP) Always round up (except 0) regardless of following digits
- b.setScale(decimal places, BigDecimal.ROUND_DOWN) Keep specified digits and truncate all following digits
Example:
```text
BigDecimal a = 3.435
BigDecimal b = a.setScale(2, BigDecimal.ROUND_UP)
BigDecimal c = a.setScale(2, BigDecimal.ROUND_DOWN)
BigDecimal d = a.setScale(2, BigDecimal.ROUND_HALF_UP)
BigDecimal e = a.setScale(2, BigDecimal.ROUND_HALF_DOWN)
log.info(b) //3.44
log.info(c) //3.43
log.info(d) //3.44
log.info(e) //3.43
```text
## Changelog
| Version | Date | Changes | Author |
| --- | --- | --- | --- |
| v1.0 | 2026-05-20 | Initial version | |
## Background
This document provides detailed information about the BigDecimal API functionality and usage, helping developers integrate relevant capabilities.
## Applicable Scenarios
Specific applicable scenarios are determined by actual business needs. Developers can select the appropriate API for integration as required.
## Prerequisites
- Access to Fxiaoke Open Platform
- Application authorization and configuration completed
- Basic knowledge of relevant business domain
## Steps
Please refer to the detailed instructions for each API.
## Notes
- Ensure prerequisites are met before calling APIs
- Pay attention to API call frequency limits
- Refer to error code documentation for exception handling
> **Compatibility:** This version currently has no deprecated or compatibility notes.