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 Item Group:  Software
Status:  Fixed Assigned to:  cederberg
Open/Closed:  Closed

Discussion locked!

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

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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.

     

    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.14-d582.
    Corresponding source code