History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: BOO-424
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Rodrigo B. de Oliveira
Reporter: Doug H
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Boo

Exponential notation

Created: 07/Aug/05 02:13 AM   Updated: 24/Aug/05 11:25 PM
Component/s: Parser
Affects Version/s: 0.5.6
Fix Version/s: 0.6

Time Tracking:
Not Specified

File Attachments: 1. Text File exponential.patch (4 kb)

Issue Links:
dependent
 

Testcase included: yes


 Description  « Hide
This patch allows exponential notation for numbers. Here are some examples with comments:

x = 1e+2
print x, x.GetType() //100 int
x2 = 1e2 //the + sign is optional
print x2, x2.GetType() //100
x4 = 1.1e+2 //use a decimal point for better precision
print x4, x4.GetType() //110 double
x5 = 1.1e-2 //minus sign for negative exponents (but use decimal point since this is not for integers)
print x5, x5.GetType() //0.011
x6 = 1e+2L //you can use the L suffix
print x6, x6.GetType() //100 long
x7 = 6e+2s //timespans work as well
print x7, x7.GetType() //10:00
x8 = 10.0e-4h
print x8, x8.GetType() //3.6 seconds
x9 = .9e2 //numbers that start with a decimal point work
print x9, x9.GetType() //90

This syntax also works in interpolated expressions.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Rodrigo B. de Oliveira - 21/Aug/05 08:38 PM
Thanks!