Bug 8116

Summary: Update EL arithmetic operators to handle Strings
Product: Taglibs Reporter: Nathan Abramson <arista>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Nathan Abramson 2002-04-15 18:09:10 UTC
Change the EL to implement these new rules for handling Strings in
arithmetic operators:

A.3.5.1 Binary operators - A {+,-,*} B
 if A and B are null, - return 0
 if A or B is Float, Double, or a String containing ".", "e", or "E"
   coerce both A and B to Double and apply operator
 otherwise
   coerce both A and B to Long and apply operator
 if operator results in exception, error

A.3.5.2 Binary operator - A {/} B
 if A and B are null, - return 0
 otherwise coerce both A and B to Double and apply operator
 if operator results in exception (such as divide by 0), error

A.3.5.3 Binary operator - A {%} B
 if A and B are null, return 0
 if A or B is Float, Double, or a String containing ".", "e", or "E"
   coerce both A and B to Double and apply operator
 otherwise
   coerce both A and B to Long and apply operator
 if operator results in exception (such as divide by 0), error

A.3.5.4 Unary minus operator - -A
 if A is null, return 0
 if A is a String
   if A contains ".", "e", or "E"
     coerce to a Double and apply operator
   otherwise
     coerce to a Long and apply operator
 if operator results in exception, error
 if A is Byte,Short,Integer,Long,Float,Double
   retain type, apply operator
 if operator results in exception, error
 otherwise, error
Comment 1 Nathan Abramson 2002-04-15 19:45:48 UTC
All of these changes have been made