pjfanning opened a new pull request, #154:
URL: https://github.com/apache/poi-xmlbeans/pull/154

   Follow-up to #144.
   
   A `BigDecimal` set from Java code (e.g. `setBigDecimalValue` with 
validate-on-set) can carry a negative scale. `new BigDecimal("1E+5")` has 
unscaled value `1` and scale `-5`, but is 100000: six digits. 
`JavaDecimalHolderEx.validateValue` counted only the digits of 
`unscaledValue()`, so it passed `totalDigits=3`.
   
   Fix: for a non-zero value with a negative scale, add `-scale` to the digit 
count. Zero (`0E+5`) is still one digit. Values parsed from the lexical form 
never have a negative scale, so their behaviour is unchanged.
   
   Regression test added to `TotalDigitsFractionValidateTest`; it fails without 
the fix and passes with it.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to