Is it possible to compare two decimals while ignoring their precision, or at least ignoring it where it doesn't matter? For example new Decimal('1', 8) and new Decimal('1', 2) should be equal, and so should new Decimal('1.234', 5) and new Decimal('1.234', 20), but new Decimal('1.234', 4) and new Decimal('1.2340001', 20) should be different. The best I have at the moment is to use toFixed() with the higher of the two precisions and compare the strings, but that's a bit hard to read.
Is it possible to compare two decimals while ignoring their precision, or at least ignoring it where it doesn't matter? For example
new Decimal('1', 8)andnew Decimal('1', 2)should be equal, and so shouldnew Decimal('1.234', 5)andnew Decimal('1.234', 20), butnew Decimal('1.234', 4)andnew Decimal('1.2340001', 20)should be different. The best I have at the moment is to usetoFixed()with the higher of the two precisions and compare the strings, but that's a bit hard to read.