tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Crawford <>
Subject Fuzzy Math
Date Wed, 04 Apr 2001 20:49:49 GMT
	Hi all,

	George Bush just might call it just another example of "Al Gore's
Fuzzy Math." We are experiencing bizarre bad math in a JSP (included below
and enclosed).  Our environment is as follows:

	Solaris 7
	Tomcat 3.2.1
	Apache 1.3.19
	JDK1.2.2_006 or _007 (native_threads)

	The bad math is occuring in a variable called 'temp'.  In the
enclosed JSP (aptly named, "fuzzy_math.jsp"), we simply echo the variable
'temp' three times in the JSP.  It correctly echos the calculated values of
the variable for 10 reloads.  But if you reload the JSP 1 more time (for a
total of 11 reloads), the third echo of the 'temp' variable (labeled
'temp3') _will change_ from the correct mathmatical value (of 102) to an
incorrect value (5)!  (The mathematical value of the first two instances
('temp1' and 'temp2') are always correct.)  Again, this bizarre behavior
only occurs on the 11th reload (and remains at the incorrect number

	--->This 'fuzzy math' does *not* occur with JDK1.2.2_006
(green_threads) (in the same above environment).<---
	Here is the code (also enclosed).  "temp3: <%= temp + 2 %>; Should
be 102; <br>" is the problematic line.)
	<%@ page language="java" %>
	    final int firstTimeOffset = 5;
	    double minuteWidth; // Adjust value via hourWidth.
	<%  // Instance variables (will be created for each servlet call)
	    long temp = 10;
	    long start = 20; // minutes after midnight
	    long duration = 50;
	        minuteWidth = 2;
	<meta http-equiv="Content-Type" content="text/html;
	<body bgcolor="#FFFFFF" link="000000" vlink="#000000"
	temp = (long) (firstTimeOffset + (start * minuteWidth));
	 temp1: <%= temp %>; Should be 45. <br>
	temp = (long) (duration * minuteWidth); 
	temp2: <%= temp %>; Should be 100. <br>
	temp3: <%= temp + 2 %>; Should be 102; <br>

	Details Summary:

	Fuzzy math occurs when:
	a.  using JDK1.2.2_006 (native_threads) or JDK 1.2.2_007
	b.  standalone Tomcat 3.2.1 (in the above environment) unaltered
downloaded binary

	'Fuzzy math' does *not* occur when:
	a.  running Tomcat 3.2.1 with JDK1.2.2_006 (green_threads);
	b.  on JavaWebServer2.0 running JDK 1.2.2_006 (green *or* native
threads) in the *same* OS environment as Tomcat, or in its own slightly
different Solaris 7 patch level environment.  

	I would greatly appreciate if someone could test this JSP on their


	Jeff Crawford
	Boulder, CO

Peer Digital, Inc.
Jeff Crawford
Configuration Manager
Senior Software Engineer
4001 Discovery Drive ยท Suite 270 
Boulder, CO 80303 
Direct:  303 544-7547
Main:  303 415 3550 
Fax:  303 415 3540


View raw message