BigDecimal.valueOf:
> Translates a double into a BigDecimal, using the double's canonical string representation provided by the Double.toString(double) method.
Double.toString:
> How many digits must be printed for the fractional part of m or a? There must be at least one digit to represent the fractional part, and beyond that as many, but only as many, more digits as are needed to uniquely distinguish the argument value from adjacent values of type double. That is, suppose that x is the exact mathematical value represented by the decimal representation produced by this method for a finite nonzero argument d. Then d must be the double value nearest to x; or if two double values are equally close to x, then d must be one of them and the least significant bit of the significand of d must be 0.
The implementation of `rationalize` uses `BigDecimal.valueOf`, which does the rounding. Exact conversion would be `new BigDecimal(double)` constructor.