#Multiply Bigdecimals fully
1 messages · Page 1 of 1 (latest)
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
that number is really small, not really large
you know hwat E-7 means?
E-7 means *10^-7
use .toPlainString()
"%.7f".formatted(theBigDecimal)
or
String.format("%.7f", theBigDecimal)
jshell> b.round(new MathContext(7, RoundingMode.FLOOR)).toPlainString()
$13 ==> "0.00000000001234567"
jshell> b.round(new MathContext(3, RoundingMode.FLOOR)).toPlainString()
$14 ==> "0.0000000000123"
or
System.out.printf("%.7f", theBigDecimal)
if you want to directly print it @pale drift
I would do the .round since you get a bit more control + I'd be scared there was some conversion to double happening with %.7f
ah and what I gave was if you want to round 7 places after the dot @pale drift
Closed the thread.
I'd be scared there was some conversion to double happening with %.7f
Closed the thread.
won't ur solution control the significant figures and not the decimal places?
-_-
just trying to stop bugs from creeping in