
|
If you were logged in you would be able to see more operations.
|
|
|
Boo
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
|
|
|
File Attachments:
|
1.
exponential.patch (4 kb)
|
|
Issue Links:
|
dependent
|
|
|
|
This issue is depended upon by:
|
|
BOO-1
Generalize units in the syntax, allow pipeline to define new units
|
|
|
|
|
|
|
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.
|
|
Description
|
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. |
Show » |
|