ComplexNumToString(ComplexNumber)
Last updated November 15, 2001
Version: 1 | Requires: ColdFusion 5 | Library: MathLib
Description:
Convert a complex number stored as a structure by the Complex() UDF to a human readable form: a+bi. This is primarily intended as a quick output for debugging.
Return Values:
Returns a string
Example:
<cfset z=ComplexNum(3,-10)>
z = #ComplexNumToString(z)#
</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| ComplexNumber | Structure containing complex number you want converted to a string. | Yes |
Full UDF Source:
<cfscript>
/**
* Convert a stored complex number to a string in the form a + bi.
* Note that this function uses complex numbers stored as structures by the ComplexNum() UDF also available in this library.
*
* @param ComplexNumber Structure containing complex number you want converted to a string.
* @return Returns a string
* @author Matthew Walker (matthew@electricsheep.co.nz)
* @version 1, November 15, 2001
*/
function ComplexNumToString(ComplexNumber) {
if ( ComplexNumber.I LT 0 )
return "#ComplexNumber.R# - #Abs(ComplexNumber.I)#i";
else
return "#ComplexNumber.R# + #ComplexNumber.I#i";
}
</cfscript>
Search CFLib.org
Latest Additions
Dave Anderson added
iniToStruct
20 day(s) ago
Dave Anderson added
deDupeArray
20 day(s) ago
Richard added
dice
22 day(s) ago
Isaac Dealey added
getRelative
a while ago
Top Rated
backupDatabase
Rated 5.0, 22 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)
highlightAndCrop
Rated 5.0, 4 time(s)