James,
4 / 8 *is* 0, at least the integer part is 0, with a remainder (modulus) of
.5. Some compilers try to compensate for humans using incorrect data types
in arithmetic calculations by rounding based on the 0.0 to 0.4 round down,
0.5 to 0.9 round up method. Some don't; they assume we code what we mean
and only specifiy integers if we are interested in integer precision. If
you need to divide numbers and want more accuracy in your results, try using
float or double style data types for your arithmetic.
E.G.
Float f = 4 / 8;
Integer i = f * 100;
or
Integer i = ((Float)(4 / 8)) * 100;
-----Original Message-----
From: Griggs, James [ mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ]
Sent: Thursday, November 25, 1999 5:25 AM
To: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Subject: <%=numresponses/numrequests*100 %>
Any reason the following statement would always produce a 0?
Other expressions work just fine when the result of the first calculation is
above 1 (eg: 5+2*100). Is this a rounding issue ???
<%=4/8*100 %>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html