new BigDecimal(double) should not be used
MSALUse of new BigDecimal(double) constructor can lead to loss of precision. Use BigDecimal.valueOf(double) instead.
For example writing new BigDecimal(0.1) does not create a BigDecimal which is exactly equal to 0.1, but it is equal to 0.1000000000000000055511151231257827021181583404541015625. This is because 0.1 cannot be represented exactly as a double (or, for that matter, as a binary fraction of any finite length). BigDecimal.valueOf avoids this by converting through a string representation, preserving the value you actually intended.
org. openrewrite. staticanalysis. BigDecimalDoubleConstructorRecipemod run . --recipe= org. openrewrite. staticanalysis. BigDecimalDoubleConstructorRecipeInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.