Friday, 27 July 2007

Bug: Rounding of diet duration different in JavaScript and Perl CGI application

The JavaScript live update for the diet calculator rounded the diet duration in weeks differently from the Perl code: JavaScript truncated to the next lower integer, while Perl rounded to the nearest integer. This could result in a one-week discrepancy in diet duration between the value shown immediately and that which appeared after the user saved the diet calculator results. I modified the JavaScript code to round the same way as the Perl code does. (Reported by Jim Hollcraft.)

No comments: