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 ywei, 16 years ago

Status: newaccepted

comment:2 by ywei, 16 years ago

Resolution: fixed
Status: acceptedclosed

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

comment:3 by Stephen Siegel, 16 years ago

Resolution: fixed
Status: closedreopened

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:4 by ywei, 16 years ago

Have you checked in the code to cause this problem?

comment:5 by ywei, 16 years ago

I mean the code that caused the exception you mentioned above.

comment:6 by Stephen Siegel, 16 years ago

Resolution: fixed
Status: reopenedclosed

This is done in the new symbolic package in v. 1.0.

Note: See TracTickets for help on using tickets.