Multiplication with Decimal Values

Sep 25, 2012 at 6:05 AM

1) If I try to parse a decimal string, I am getting an error "Invalid Character". Intx.Parse("5.3")

2) How do I multiply a Intx number with a decimal number? I want to multiply a big Intx number with a value which has decimals in it.

Please advise



Sep 26, 2012 at 11:21 AM

Hi there,

Unfortunately, IntX doesn't support decimals (only integers are supported) and there are no plans to support them in future. You have several options to deal with decimals:

  • Construct your own type on top of IntX which will treat decimal as fixed point big integer. For example, 5.3 will be stored as 53 big integer with additional information that there is 1 digit after dot. This, of course, requires additional work from you.
  • Use some of the existing libraries which support big decimals out of the box. You can try W3b.Sine or any other lib (just google it).