Opened 16 years ago
Closed 16 years ago
#165 closed enhancement (fixed)
need cast from int to real operation in symbolic package
| Reported by: | Stephen Siegel | Owned by: | ywei |
|---|---|---|---|
| Priority: | major | Milestone: | Release 1.0 |
| Component: | symbolic | Version: | 1.0 |
| Keywords: | cast symbolic real int | Cc: |
Description
I _think_ all this operation needs to do is take a symbolic expression and return a symbolic expression which is identical except the SymType is rational instead of int.
Change History (6)
comment:1 by , 16 years ago
| Status: | new → accepted |
|---|
comment:2 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | accepted → closed |
comment:3 by , 16 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
I'm getting the CloneNotSupportedException. I am running the MeanTestLoopTest. I have not yet checked in my code, but will soon. This is a great example of where a unit test would help. A unit test should be created that tests this method and added to the test source tree.
public SymExpression intToRational(SymExpression expr)
{
if(!(expr.getType() instanceof SymInteger))
{
throw new RuntimeException("The argument of the integer to rationl cast operation must have integer type "
+ "instead of " + expr.getType());
}
SymExpression newExpr = null;
try
{
newExpr = (SymExpression)(super.clone());
}
catch(CloneNotSupportedException e)
{
e.printStackTrace();
}
newExpr.setType(this.rationalType);
return newExpr;
}
comment:6 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
This is done in the new symbolic package in v. 1.0.
Note:
See TracTickets
for help on using tickets.

A method called intToRational() is added to SymUniverseIF to convert an integer type expression to rational type.