Menu

#1 Bug: Error #1009

2.0
closed
None
2013-12-21
2013-12-19
Mihai Chira
No

Steps to reproduce:
1. Run this code:
var decimal:Decimal = new Decimal(251);
var divisor:Decimal = new Decimal(66666666666666660000);
var d:AbstractDecimal = decimal.divide(divisor, new MathContext(x, y));

where (x, y) are either of these values: (7, 1) (7, 2) (7, 3) (7, 4) (7, 5) (7, 6) (7, 7) (8, 1) (8, 2) (8, 3) (8, 4) (8, 5) (8, 6) (8, 7) (9, 1) (9, 2) (9, 3) (9, 4) (9, 5) (9, 6) (9, 7) (10, 1) (10, 2) (10, 3) (10, 4) (10, 5) (10, 6) (10, 7) (11, 1) (11, 2) (11, 3) (11, 4) (11, 5) (11, 6) (11, 7)(12, 1) (12, 2) (12, 3) (12, 4) (12, 5) (12, 6) (12, 7) (13, 1) (13, 2) (13, 3) (13, 4) (13, 5) (13, 6) (13, 7).

Actual result: RTE
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.fxcomps.money::DivisionResult/isRemainderZero()[C:\Users\Developer1\workspace\FXComps-2.0.0\src\com\fxcomps\money\DivisionResult.as:74]
at com.fxcomps.money::Decimal/divide()[C:\Users\Developer1\workspace\FXComps-2.0.0\src\com\fxcomps\money\Decimal.as:1029]
...

This can easily be solved by changing the constructor of DivisionResult to say "this.remainder_ = _remainder || []" instead of "this.remainder_ = _remainder", but the problem seems to be in Decimal.divide().

Discussion

  • Mihai Chira

    Mihai Chira - 2013-12-19

    This should have been tagged for Milestone 2.0.

     
  • Laszlo Sas

    Laszlo Sas - 2013-12-19
    • status: open --> closed
     
  • Laszlo Sas

    Laszlo Sas - 2013-12-19

    Remainder sometimes was not set (when was qhat==0). Fixed.

     
  • Laszlo Sas

    Laszlo Sas - 2013-12-19
    • Milestone: 1.0 --> 2.0
     
  • Mihai Chira

    Mihai Chira - 2013-12-19

    Wow, that was fast! Thanks a lot, Laszlo.

    PS: I've converted the code to compile against SDK 4.11. If that helps you at all, I can send it to you.

     
  • Laszlo Sas

    Laszlo Sas - 2013-12-20

    I would be very grateful if you would send me the converted code. You can attach the compressed files to this discussion or send them to laszlo.sas(at)codeiron.com.

    Many thanks!

    Laszlo

     
  • Mihai Chira

    Mihai Chira - 2013-12-21

    It's attached. Not too many changes were required, actually.

     
  • Laszlo Sas

    Laszlo Sas - 2013-12-21

    Many thanks!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.