long.js icon indicating copy to clipboard operation
long.js copied to clipboard

Implement power function (clean up)

Open CyDragon80 opened this issue 7 years ago • 2 comments

This is basically a clean up of the previous PR: https://github.com/dcodeIO/long.js/pull/62.

Adds power function. See original PR for previous details and discussion. This also fixes a couple places where multiply could return a signed zero when the original was unsigned (which was mentioned in https://github.com/dcodeIO/long.js/issues/72).

CyDragon80 avatar Dec 05 '18 18:12 CyDragon80

It is probably best not to let that operation silently overflow without throwing some kind of meaningful error. I think I've figured out how to check for overflow in a relatively efficient manner. If there is a cleaner way to go about it, I am open to suggestions.

CyDragon80 avatar Dec 06 '18 02:12 CyDragon80

Looking back at this, I realized I could catch floating point exponents easily enough in the overflow check, so I tweaked it and added the necessary test.

CyDragon80 avatar Oct 17 '19 00:10 CyDragon80