bugGrammatica - Bugs: bug #7998, Possible divide by zero when...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #7998: Possible divide by zero when running --profile

Submitter:  Per Cederberg <cederberg>
Submitted:  Thu 04 Mar 2004 09:05:05 AM UTC
   
 
Severity:  2 - Normal Priority:  5 - Normal
Item Group:  Software Status:  Fixed
Assigned to:  cederberg Open/Closed:  Closed

Discussion locked!

Discussion

Sat 14 Mar 2009 09:34:51 AM UTC, comment #3: 

Version 1.5 was released on 2009-03-07. Closing this issue.

Per Cederberg <cederberg>
Group administrator
Wed 24 Mar 2004 08:11:13 PM UTC, comment #2: 

This has been resolved by always adding 1 millisecond to the time measured. The fix has been pushed to CVS and will appear in the next release (probably 1.5).

Per Cederberg <cederberg>
Group administrator
Wed 24 Mar 2004 07:43:55 PM UTC, comment #1: 

Also reported on the mailing list by Stefan Ukena.

Per Cederberg <cederberg>
Group administrator
Thu 04 Mar 2004 09:05:05 AM UTC, original submission:  

In some cases, for very short inputs, the --profile counts zero (0) milliseconds of execution time. This in turn will cause a divide by zero error when attempting to calculate the average parsing speed.

As reported by Lukas Zapletal:

Try to: gramm arithmetic.grammar --profile

Tokenizing a-test.data

Time elapsed:  0 millisec
Tokens found:  11
INTERNAL ERROR: ...
java.lang.ArithmeticException: / by zero
at net.percederberg.grammatica.Grammatica.profile(Grammatica.java:522)      
at net.percederberg.grammatica.Grammatica.main(Grammatica.java:175)

Bug is here:
System.out.println("  Time elapsed:  " + time + " millisec");
System.out.println("  Tokens found:  " + counter);
System.out.println("  Average speed: " + (counter / time) + "tokens/millisec"); * HERE - divide by zero *
System.out.println();

Per Cederberg <cederberg>
Group administrator

 

Attached Files

This item currently has no attached files.

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by cederberg (Posted a comment)
  •  

    Votes

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    History

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-03-14 cederberg Open/ClosedOpen Closed
        Discussion LockNone Locked
    2004-03-24 cederberg StatusNone Fixed

    Back to the top

    Powered by Savane 3.16.
    Corresponding source code