You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jeff Crawford <JC...@PeerDigital.com> on 2001/04/04 22:49:49 UTC

Fuzzy Math

	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
indefinitely).

	--->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;
	%>
	<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
	</head>
	<body bgcolor="#FFFFFF" link="000000" vlink="#000000"
alink="fcc470">
	<%
	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>
	</body>
	</html>
	--------------------------------------------------

	Details Summary:

	Fuzzy math occurs when:
	a.  using JDK1.2.2_006 (native_threads) or JDK 1.2.2_007
(native_threads);
	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
system.

	Thanks!

	Jeff Crawford
	Boulder, CO

 <<fuzzy_math.jsp>> 
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 
www.peerdigital.com


 


Re: Fuzzy Math

Posted by Joe Laffey <jo...@laffeycomputer.com>.
This script works fine under Rh 6.2 Apache 1.3.19 mod_jk JDK 1.3_fcs
Tomcat 3.2


Joe Laffey
LAFFEY Computer Imaging
St. Louis, MO
----------------------
Need to do multi-file string replacement in Un*x, but don't want to mess
with sed? Try rpl. It's a free text replacement utility with source.
http://www.laffeycomputer.com/rpl.html  -- Check it out!
------------------------------------------------------------------------


Re: Fuzzy Math

Posted by Jim Cheesman <jc...@msl.es>.
At 10:49 PM 4/4/2001, you wrote:
>         '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
>system.
>
>         Thanks!


Runs fine on win2000, tomcat 3.2, jdk1.3


Jim




--

                           *   Jim Cheesman   *
             Trabajo: jchees@msl.es - (34)(91) 724 9200 x 2360
               Personal: mogrim@arrakis.es (34) 606 770 244
              Practice safe eating -- always use condiments.