logo       

[jira] Closed: (BOO-233) Added decimal type and unary negation operator ove: msg#00014

lang.boo.devel

Subject: [jira] Closed: (BOO-233) Added decimal type and unary negation operator overloading

Message:

The following issue has been closed.

Resolver: Rodrigo B. de Oliveira
Date: Fri, 4 Feb 2005 9:01 AM

patch applied. thanks.
---------------------------------------------------------------------
View the issue:
http://jira.codehaus.org/browse/BOO-233

Here is an overview of the issue:
---------------------------------------------------------------------
Key: BOO-233
Summary: Added decimal type and unary negation operator overloading
Type: New Feature

Status: Closed
Priority: Major
Resolution: FIXED

Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown

Project: Boo
Components:
Emitter
Type System
Compiler
Fix Fors:
0.5
Versions:
0.4

Assignee: Rodrigo B. de Oliveira
Reporter: Bill Wood

Created: Tue, 28 Dec 2004 2:31 PM
Updated: Fri, 4 Feb 2005 9:01 AM

Description:
Added decimal type as a first class numeric type. To do this, had to add
support for the general case of unary negation operator overloading.

def toDecimal(d as decimal):
return d

i as object = 1
d as object = decimal(9)
assert toDecimal(i) == 1
assert toDecimal(d) == 9
assert toDecimal(12345) == 12345
assert toDecimal(45678L) == 45678
assert toDecimal(45678L).GetType() == decimal

y as decimal = 1.2
z as double = 1.2
y = y*y-y/(y+y)*2
z = z*z-z/(z+z)*2
assert y == z

assert -y == ((-1)*y)
assert -y == -z

assert y
assert false == (not y)
y = 0
assert not y

_sbyte as sbyte = 1
y = _sbyte
++y
y += 1
y = y*2.5
assert y == 7.5

print ("not 0") if y - y
assert y - 1

assert y and y
assert y or y
assert y == y

zero as decimal = 0
assert decimal == (zero and d).GetType()
assert 0 == zero

assert y > 2 and y > 1
assert false == (y < 1)

print ("y > 10??") if y > 10
print ("y <= 0??") if y <= 0
if y <= 1.15:
print "y <= 1.15??"

b as decimal = y
assert y + b == 2*y
assert 2*y == 15



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise