Closed sublimator closed 10 years ago
This C++:
STAmount oneIOU (CURRENCY_ONE, ACCOUNT_ONE, 1); STAmount twoNative (2); STAmount multiplied (STAmount::multiply(oneIOU, twoNative)); STAmount divided (STAmount::divide(oneIOU, twoNative)); std::cout << oneIOU.getFullText() << std::endl; std::cout << twoNative.getFullText() << std::endl; std::cout << multiplied.getFullText() << std::endl; std::cout << divided.getFullText() << std::endl;
Gives the following (IMO sensible) output:
1/1/1 2/XRP 2/1/1 0.5/1/1
This javascript:
ripple = require('ripple-lib'); Amount = ripple.Amount; amt = Amount.from_json; console.log(amt("1.0/IOU").multiply(amt("2.0")).to_json()); console.log(amt("1.0/IOU").divide(amt("2.0")).to_json());
Gives the following (IMO ridiculous) output:
{ value: '2000000', currency: 'IOU' } { value: '0.0000005', currency: 'IOU' }
Thoughts:
Multiply and divide operations are primarily used for computing ask/bid where the logical native unit is XRP, NOT drops.
Should ripple-lib-java follow ripple-lib or rippled in this regard?
This C++:
Gives the following (IMO sensible) output:
This javascript:
Gives the following (IMO ridiculous) output:
Thoughts:
Multiply and divide operations are primarily used for computing ask/bid where the logical native unit is XRP, NOT drops.
Should ripple-lib-java follow ripple-lib or rippled in this regard?