**Public Function RationalComplexToVBExpr( _
ByVal vExpr As Variant _
) As Variant**

**"Rational Complex Number To Visual Basic Expression" **

Convert an expression of the form "[+-] n? (/ n)? ([+-] n (/ n)? \*? (#i)?)?" into a Visual Basic expression.

For example, "-34/56-12/89*#i" would be converted to "RealToComplex(-34/56, -12/89)"

**Summary:** We used this function to translate several sample numeric values from the form produced by the symbolic math package Derive (by Soft Warehouse, Honolulu, Hawaii; http://www.derive.com/derive.htm) into a form recognized by Visual Basic and supported by various Entisoft Tools functions. We used those sample values to help validate our advanced trigonometric calculations. That validation process is NOT complete; however, each of those functions has been validated with a wide range of input values.

**Examples:** ? RationalComplexToVBExpr(12)
12
? RationalComplexToVBExpr("12")
12
? RationalComplexToVBExpr("12.45")
12.45
? RationalComplexToVBExpr("12.34+56.78*#i")
RealToComplex(12.34, 56.78)
? RationalComplexToVBExpr("45*#i")
RealToComplex(0, 45)
? RationalComplexToVBExpr("12+45*#i")
RealToComplex(12, 45)
? RationalComplexToVBExpr("-12-45*#i")
RealToComplex(-12, -45)
? RationalComplexToVBExpr("23/45+67/89*#i")
RealToComplex(23/45, 67/89)

**See also:** ComplexStringToReals Function
InfixToBasic Function
MathComplex Class
MathTrigComplex Class

**vExpr:** String containing a numeric expression. Function returns Null if vExpr is Null or cannot be fixed up to a String. The string numeric expression must consist of a real part and/or a complex part. Each part (the real part and the complex part) must consist of either 1) a signed integer constant or 2) a signed rational expression of the form "A/B" where A and B are both integers. The complex part (if any) can be signed and it must be followed by "*#i" to signify that it is the complex part. **Special handling:** If vExpr is "1/0" then this function will return "DivideByZero" which is a reference to the DivideByZero Property. If vExpr is "?" then this function will return "UnknownValue" because Derive uses the question mark to represent undefined values.

Copyright 1996-1999 Entisoft

Entisoft Tools is a trademark of Entisoft.