math icon indicating copy to clipboard operation
math copied to clipboard

Accept hexadecimal input

Open 99hops opened this issue 4 years ago • 1 comments

Is it possible to add support for hexadecimal input to avoid additional conversion?

Example: BigDecimal::of('0x5208')->multipliedBy('0x59682f08');

99hops avatar Oct 08 '21 08:10 99hops

Hi,

I'm not sure if it makes sense to add more convenience formats in of(): it already accepts multiple formats to cover the needs of the 3 number classes (BigInteger, BigDecimal, BigRational), and accepting hexadecimal is opening the Pandora box: should we accept 0b afterwards?

Is it really a big issue to call BigInteger::fromBase()?

BenMorel avatar Oct 08 '21 20:10 BenMorel