For decimal_v2=true, we should revisit the add/sub result type. Currently, we set result scale to max(S1, S2) (potentially losing precision). Other systems (e.g. SQL Server) seem to choose either S1 or S2 depending on whether digits to the left of the decimal point would be lost. This would require changes to the backend implementation of add/sub, however.
Currently we compute rP and rS as follows:
We currently handle the case where rP > 38 as follows:
This basically truncates the digits to the left of the decimal point.
The proposed result under V2 is: