json-rust
json-rust copied to clipboard
Arithmetic for Number (and JsonValue)?
It shouldn't be too difficult to implement all the arithmetic std::ops
for Number
, multiplication is already done but commented. Addition and subtraction needs to be able to level the exponent (much the same way PartialEq does it), which should also be abstracted somewhere.
Interesting question is whether or not the results should be normalized (e.g.: if mantissa 150
with exponent -2
should be lowered to mantissa 15
with exponent -1
) ?
Required for #66