Kaydet (Commit) 1d66c321 authored tarafından Regina Henschel's avatar Regina Henschel

i111609 ODFF implement missing imaginary functions

üst db94cea2
......@@ -379,6 +379,14 @@
#define HID_AAI_FUNC_OCT2HEX "SC_HID_AAI_FUNC_OCT2HEX"
#define HID_AAI_FUNC_CONVERT "SC_HID_AAI_FUNC_CONVERT"
#define HID_AAI_FUNC_FACTDOUBLE "SC_HID_AAI_FUNC_FACTDOUBLE"
#define HID_AAI_FUNC_IMTAN "SC_HID_AAI_FUNC_IMTAN"
#define HID_AAI_FUNC_IMSEC "SC_HID_AAI_FUNC_IMSEC"
#define HID_AAI_FUNC_IMCSC "SC_HID_AAI_FUNC_IMCSC"
#define HID_AAI_FUNC_IMCOT "SC_HID_AAI_FUNC_IMCOT"
#define HID_AAI_FUNC_IMSINH "SC_HID_AAI_FUNC_IMSINH"
#define HID_AAI_FUNC_IMCOSH "SC_HID_AAI_FUNC_IMCOSH"
#define HID_AAI_FUNC_IMSECH "SC_HID_AAI_FUNC_IMSECH"
#define HID_AAI_FUNC_IMCSCH "SC_HID_AAI_FUNC_IMCSCH"
// DateFunc Addin Functions (max.20) -----------------------------------------
#define HID_DAI_FUNC_DAYSINMONTH "SC_HID_DAI_FUNC_DAYSINMONTH"
......
......@@ -88,6 +88,10 @@ const ScUnoAddInHelpId pAnalysisHelpIds[] =
{ "getImargument" , HID_AAI_FUNC_IMARGUMENT },
{ "getImconjugate" , HID_AAI_FUNC_IMCONJUGATE },
{ "getImcos" , HID_AAI_FUNC_IMCOS },
{ "getImcosh" , HID_AAI_FUNC_IMCOSH },
{ "getImcot" , HID_AAI_FUNC_IMCOT },
{ "getImcsc" , HID_AAI_FUNC_IMCSC },
{ "getImcsch" , HID_AAI_FUNC_IMCSCH },
{ "getImdiv" , HID_AAI_FUNC_IMDIV },
{ "getImexp" , HID_AAI_FUNC_IMEXP },
{ "getImln" , HID_AAI_FUNC_IMLN },
......@@ -96,10 +100,14 @@ const ScUnoAddInHelpId pAnalysisHelpIds[] =
{ "getImpower" , HID_AAI_FUNC_IMPOWER },
{ "getImproduct" , HID_AAI_FUNC_IMPRODUCT },
{ "getImreal" , HID_AAI_FUNC_IMREAL },
{ "getImsec" , HID_AAI_FUNC_IMSEC },
{ "getImsech" , HID_AAI_FUNC_IMSECH },
{ "getImsin" , HID_AAI_FUNC_IMSIN },
{ "getImsinh" , HID_AAI_FUNC_IMSINH },
{ "getImsqrt" , HID_AAI_FUNC_IMSQRT },
{ "getImsub" , HID_AAI_FUNC_IMSUB },
{ "getImsum" , HID_AAI_FUNC_IMSUM },
{ "getImtan" , HID_AAI_FUNC_IMTAN },
{ "getIntrate" , HID_AAI_FUNC_INTRATE },
{ "getIseven" , HID_AAI_FUNC_ISEVEN },
{ "getIsodd" , HID_AAI_FUNC_ISODD },
......
......@@ -91,6 +91,14 @@ ScCompiler::AddInMap ScCompiler::maAddInMap[] =
{ "IMSUB", "IMSUB", false, "com.sun.star.sheet.addin.Analysis.getImsub", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMSUB" },
{ "IMSUM", "IMSUM", false, "com.sun.star.sheet.addin.Analysis.getImsum", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMSUM" },
{ "IMSQRT", "IMSQRT", false, "com.sun.star.sheet.addin.Analysis.getImsqrt", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMSQRT" },
{ "IMTAN", "IMTAN", false, "com.sun.star.sheet.addin.Analysis.getImtan", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMTAN" },
{ "IMSEC", "IMSEC", false, "com.sun.star.sheet.addin.Analysis.getImsec", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMSEC" },
{ "IMCSC", "IMCSC", false, "com.sun.star.sheet.addin.Analysis.getImcsc", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMCSC" },
{ "IMCOT", "IMCOT", false, "com.sun.star.sheet.addin.Analysis.getImcot", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMCOT" },
{ "IMSINH", "IMSINH", false, "com.sun.star.sheet.addin.Analysis.getImsinh", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMSINH" },
{ "IMCOSH", "IMCOSH", false, "com.sun.star.sheet.addin.Analysis.getImcosh", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMCOSH" },
{ "IMSECH", "IMSECH", false, "com.sun.star.sheet.addin.Analysis.getImsech", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMSECH" },
{ "IMCSCH", "IMCSCH", false, "com.sun.star.sheet.addin.Analysis.getImcsch", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETIMCSCH" },
{ "COMPLEX", "COMPLEX", false, "com.sun.star.sheet.addin.Analysis.getComplex", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETCOMPLEX" },
{ "CONVERT", "CONVERT_ADD", false, "com.sun.star.sheet.addin.Analysis.getConvert", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETCONVERT" },
{ "AMORDEGRC", "AMORDEGRC", false, "com.sun.star.sheet.addin.Analysis.getAmordegrc", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETAMORDEGRC" },
......@@ -130,6 +138,7 @@ ScCompiler::AddInMap ScCompiler::maAddInMap[] =
{ "COUPPCD", "COUPPCD", false, "com.sun.star.sheet.addin.Analysis.getCouppcd", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETCOUPPCD" },
{ "COUPNUM", "COUPNUM", false, "com.sun.star.sheet.addin.Analysis.getCoupnum", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETCOUPNUM" },
{ "FVSCHEDULE", "FVSCHEDULE", false, "com.sun.star.sheet.addin.Analysis.getFvschedule", "COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETFVSCHEDULE" },
};
// static
......
......@@ -449,6 +449,14 @@ hidspecial HID_AAI_FUNC_IMSIN { HelpID = HID_AAI_FUNC_IMSIN; };
hidspecial HID_AAI_FUNC_IMSUB { HelpID = HID_AAI_FUNC_IMSUB; };
hidspecial HID_AAI_FUNC_IMSUM { HelpID = HID_AAI_FUNC_IMSUM; };
hidspecial HID_AAI_FUNC_IMSQRT { HelpID = HID_AAI_FUNC_IMSQRT; };
hidspecial HID_AAI_FUNC_IMTAN { HelpID = HID_AAI_FUNC_IMTAN; };
hidspecial HID_AAI_FUNC_IMSEC { HelpID = HID_AAI_FUNC_IMSEC; };
hidspecial HID_AAI_FUNC_IMCSC { HelpID = HID_AAI_FUNC_IMCSC; };
hidspecial HID_AAI_FUNC_IMCOT { HelpID = HID_AAI_FUNC_IMCOT; };
hidspecial HID_AAI_FUNC_IMSINH { HelpID = HID_AAI_FUNC_IMSINH; };
hidspecial HID_AAI_FUNC_IMCOSH { HelpID = HID_AAI_FUNC_IMCOSH; };
hidspecial HID_AAI_FUNC_IMSECH { HelpID = HID_AAI_FUNC_IMSECH; };
hidspecial HID_AAI_FUNC_IMCSCH { HelpID = HID_AAI_FUNC_IMCSCH; };
hidspecial HID_AAI_FUNC_COMPLEX { HelpID = HID_AAI_FUNC_COMPLEX; };
hidspecial HID_AAI_FUNC_OCT2BIN { HelpID = HID_AAI_FUNC_OCT2BIN; };
hidspecial HID_AAI_FUNC_OCT2DEZ { HelpID = HID_AAI_FUNC_OCT2DEZ; };
......
......@@ -1240,6 +1240,86 @@ STRING SAL_CALL AnalysisAddIn::getImsqrt( const STRING& aNum ) THROWDEF_RTE_IAE
}
STRING SAL_CALL AnalysisAddIn::getImtan( const STRING& aNum ) THROWDEF_RTE_IAE
{
Complex z( aNum );
z.Tan();
return z.GetString();
}
STRING SAL_CALL AnalysisAddIn::getImsec( const STRING& aNum ) THROWDEF_RTE_IAE
{
Complex z( aNum );
z.Sec();
return z.GetString();
}
STRING SAL_CALL AnalysisAddIn::getImcsc( const STRING& aNum ) THROWDEF_RTE_IAE
{
Complex z( aNum );
z.Csc();
return z.GetString();
}
STRING SAL_CALL AnalysisAddIn::getImcot( const STRING& aNum ) THROWDEF_RTE_IAE
{
Complex z( aNum );
z.Cot();
return z.GetString();
}
STRING SAL_CALL AnalysisAddIn::getImsinh( const STRING& aNum ) THROWDEF_RTE_IAE
{
Complex z( aNum );
z.Sinh();
return z.GetString();
}
STRING SAL_CALL AnalysisAddIn::getImcosh( const STRING& aNum ) THROWDEF_RTE_IAE
{
Complex z( aNum );
z.Cosh();
return z.GetString();
}
STRING SAL_CALL AnalysisAddIn::getImsech( const STRING& aNum ) THROWDEF_RTE_IAE
{
Complex z( aNum );
z.Sech();
return z.GetString();
}
STRING SAL_CALL AnalysisAddIn::getImcsch( const STRING& aNum ) THROWDEF_RTE_IAE
{
Complex z( aNum );
z.Csch();
return z.GetString();
}
STRING SAL_CALL AnalysisAddIn::getComplex( double fR, double fI, const ANY& rSuff ) THROWDEF_RTE_IAE
{
sal_Bool bi;
......
......@@ -127,7 +127,14 @@
#define ANALYSIS_Couppcd (ANALYSIS_FUNCDESC_START+90)
#define ANALYSIS_Coupnum (ANALYSIS_FUNCDESC_START+91)
#define ANALYSIS_Fvschedule (ANALYSIS_FUNCDESC_START+92)
#define ANALYSIS_Imtan (ANALYSIS_FUNCDESC_START+93)
#define ANALYSIS_Imsec (ANALYSIS_FUNCDESC_START+94)
#define ANALYSIS_Imcsc (ANALYSIS_FUNCDESC_START+95)
#define ANALYSIS_Imcot (ANALYSIS_FUNCDESC_START+96)
#define ANALYSIS_Imsinh (ANALYSIS_FUNCDESC_START+97)
#define ANALYSIS_Imcosh (ANALYSIS_FUNCDESC_START+98)
#define ANALYSIS_Imsech (ANALYSIS_FUNCDESC_START+99)
#define ANALYSIS_Imcsch (ANALYSIS_FUNCDESC_START+100)
#define ANALYSIS_FUNCNAME_START (1)
......@@ -224,7 +231,14 @@
#define ANALYSIS_FUNCNAME_Couppcd (ANALYSIS_FUNCNAME_START+90)
#define ANALYSIS_FUNCNAME_Coupnum (ANALYSIS_FUNCNAME_START+91)
#define ANALYSIS_FUNCNAME_Fvschedule (ANALYSIS_FUNCNAME_START+92)
#define ANALYSIS_FUNCNAME_Imtan (ANALYSIS_FUNCNAME_START+93)
#define ANALYSIS_FUNCNAME_Imsec (ANALYSIS_FUNCNAME_START+94)
#define ANALYSIS_FUNCNAME_Imcsc (ANALYSIS_FUNCNAME_START+95)
#define ANALYSIS_FUNCNAME_Imcot (ANALYSIS_FUNCNAME_START+96)
#define ANALYSIS_FUNCNAME_Imsinh (ANALYSIS_FUNCNAME_START+97)
#define ANALYSIS_FUNCNAME_Imcosh (ANALYSIS_FUNCNAME_START+98)
#define ANALYSIS_FUNCNAME_Imsech (ANALYSIS_FUNCNAME_START+99)
#define ANALYSIS_FUNCNAME_Imcsch (ANALYSIS_FUNCNAME_START+100)
#define ANALYSIS_DEFFUNCNAME_START (RID_ANALYSIS_DEFFUNCTION_NAMES+1)
......@@ -321,6 +335,13 @@
#define ANALYSIS_DEFFUNCNAME_Couppcd (ANALYSIS_DEFFUNCNAME_START+90)
#define ANALYSIS_DEFFUNCNAME_Coupnum (ANALYSIS_DEFFUNCNAME_START+91)
#define ANALYSIS_DEFFUNCNAME_Fvschedule (ANALYSIS_DEFFUNCNAME_START+92)
#define ANALYSIS_DEFFUNCNAME_Imtan (ANALYSIS_DEFFUNCNAME_START+93)
#define ANALYSIS_DEFFUNCNAME_Imsec (ANALYSIS_DEFFUNCNAME_START+94)
#define ANALYSIS_DEFFUNCNAME_Imcsc (ANALYSIS_DEFFUNCNAME_START+95)
#define ANALYSIS_DEFFUNCNAME_Imcot (ANALYSIS_DEFFUNCNAME_START+96)
#define ANALYSIS_DEFFUNCNAME_Imsinh (ANALYSIS_DEFFUNCNAME_START+97)
#define ANALYSIS_DEFFUNCNAME_Imcosh (ANALYSIS_DEFFUNCNAME_START+98)
#define ANALYSIS_DEFFUNCNAME_Imsech (ANALYSIS_DEFFUNCNAME_START+99)
#define ANALYSIS_DEFFUNCNAME_Imcsch (ANALYSIS_DEFFUNCNAME_START+100)
#endif
......@@ -188,6 +188,14 @@ public:
virtual STRING SAL_CALL getImsum( constREFXPS& xOpt, const SEQSEQ( STRING )& aNum1, const SEQ( ANY )& aFollowingPars ) THROWDEF_RTE_IAE;
virtual STRING SAL_CALL getImsqrt( const STRING& aNum ) THROWDEF_RTE_IAE;
virtual STRING SAL_CALL getImtan( const STRING& aNum ) THROWDEF_RTE_IAE;
virtual STRING SAL_CALL getImsec( const STRING& aNum ) THROWDEF_RTE_IAE;
virtual STRING SAL_CALL getImcsc( const STRING& aNum ) THROWDEF_RTE_IAE;
virtual STRING SAL_CALL getImcot( const STRING& aNum ) THROWDEF_RTE_IAE;
virtual STRING SAL_CALL getImsinh( const STRING& aNum ) THROWDEF_RTE_IAE;
virtual STRING SAL_CALL getImcosh( const STRING& aNum ) THROWDEF_RTE_IAE;
virtual STRING SAL_CALL getImsech( const STRING& aNum ) THROWDEF_RTE_IAE;
virtual STRING SAL_CALL getImcsch( const STRING& aNum ) THROWDEF_RTE_IAE;
virtual STRING SAL_CALL getComplex( double fReal, double fImaginary, const ANY& rSuffix ) THROWDEF_RTE_IAE;
virtual double SAL_CALL getConvert( double fVal, const STRING& aFromUnit, const STRING& aToUnit ) THROWDEF_RTE_IAE;
......
......@@ -1350,6 +1350,150 @@ Resource RID_ANALYSIS_FUNCTION_DESCRIPTIONS
};
Resource ANALYSIS_Imtan
{
String 1 // description Imtan
{
Text [ en-US ] = "Returns the tangent of a complex number";
};
String 2 // name of parameter 1 Imtan
{
Text [ en-US ] = "Complex number";
};
String 3 // description of parameter 1 Imtan
{
Text [ en-US ] = "A complex number";
};
};
Resource ANALYSIS_Imsec
{
String 1 // description Imsec
{
Text [ en-US ] = "Returns the secant of a complex number";
};
String 2 // name of parameter 1 Imsec
{
Text [ en-US ] = "Complex number";
};
String 3 // description of parameter 1 Imsec
{
Text [ en-US ] = "A complex number";
};
};
Resource ANALYSIS_Imcsc
{
String 1 // description Imcsc
{
Text [ en-US ] = "Returns the cosecant of a complex number";
};
String 2 // name of parameter 1 Imcsc
{
Text [ en-US ] = "Complex number";
};
String 3 // description of parameter 1 Imcsc
{
Text [ en-US ] = "A complex number";
};
};
Resource ANALYSIS_Imcot
{
String 1 // description Imcot
{
Text [ en-US ] = "Returns the cotangent of a complex number";
};
String 2 // name of parameter 1 Imcot
{
Text [ en-US ] = "Complex number";
};
String 3 // description of parameter 1 Imcot
{
Text [ en-US ] = "A complex number";
};
};
Resource ANALYSIS_Imsinh
{
String 1 // description Imsinh
{
Text [ en-US ] = "Returns the hyperbolic sine of a complex number";
};
String 2 // name of parameter 1 Imsinh
{
Text [ en-US ] = "Complex number";
};
String 3 // description of parameter 1 Imsinh
{
Text [ en-US ] = "A complex number";
};
};
Resource ANALYSIS_Imcosh
{
String 1 // description Imcosh
{
Text [ en-US ] = "Returns the hyperbolic cosine of a complex number";
};
String 2 // name of parameter 1 Imcosh
{
Text [ en-US ] = "Complex number";
};
String 3 // description of parameter 1 Imcosh
{
Text [ en-US ] = "A complex number";
};
};
Resource ANALYSIS_Imsech
{
String 1 // description Imsech
{
Text [ en-US ] = "Returns the hyperbolic secant of a complex number";
};
String 2 // name of parameter 1 Imsech
{
Text [ en-US ] = "Complex number";
};
String 3 // description of parameter 1 Imsech
{
Text [ en-US ] = "A complex number";
};
};
Resource ANALYSIS_Imcsch
{
String 1 // description Imcsch
{
Text [ en-US ] = "Returns the hyperbolic cosecant of a complex number";
};
String 2 // name of parameter 1 Imcsch
{
Text [ en-US ] = "Complex number";
};
String 3 // description of parameter 1 Imcsch
{
Text [ en-US ] = "A complex number";
};
};
Resource ANALYSIS_Complex
{
String 1 // description Complex
......
......@@ -811,6 +811,78 @@ Resource RID_ANALYSIS_DEFFUNCTION_NAMES
};
};
StringArray ANALYSIS_DEFFUNCNAME_Imtan
{
ItemList =
{
< "IMTAN"; >;
< "IMTAN"; >;
};
};
StringArray ANALYSIS_DEFFUNCNAME_Imsec
{
ItemList =
{
< "IMSEC"; >;
< "IMSEC"; >;
};
};
StringArray ANALYSIS_DEFFUNCNAME_Imcsc
{
ItemList =
{
< "IMCSC"; >;
< "IMCSC"; >;
};
};
StringArray ANALYSIS_DEFFUNCNAME_Imcot
{
ItemList =
{
< "IMCOT"; >;
< "IMCOT"; >;
};
};
StringArray ANALYSIS_DEFFUNCNAME_Imsinh
{
ItemList =
{
< "IMSINH"; >;
< "IMSINH"; >;
};
};
StringArray ANALYSIS_DEFFUNCNAME_Imcosh
{
ItemList =
{
< "IMCOSH"; >;
< "IMCOSH"; >;
};
};
StringArray ANALYSIS_DEFFUNCNAME_Imsech
{
ItemList =
{
< "IMSECH"; >;
< "IMSECH"; >;
};
};
StringArray ANALYSIS_DEFFUNCNAME_Imcsch
{
ItemList =
{
< "IMCSCH"; >;
< "IMCSCH"; >;
};
};
StringArray ANALYSIS_DEFFUNCNAME_Complex
{
ItemList =
......
......@@ -463,6 +463,46 @@ Resource RID_ANALYSIS_FUNCTION_NAMES
Text [ en-US ] = "IMSQRT";
};
String ANALYSIS_FUNCNAME_Imtan
{
Text [ en-US ] = "IMTAN";
};
String ANALYSIS_FUNCNAME_Imsec
{
Text [ en-US ] = "IMSEC";
};
String ANALYSIS_FUNCNAME_Imcsc
{
Text [ en-US ] = "IMCSC";
};
String ANALYSIS_FUNCNAME_Imcot
{
Text [ en-US ] = "IMCOT";
};
String ANALYSIS_FUNCNAME_Imsinh
{
Text [ en-US ] = "IMSINH";
};
String ANALYSIS_FUNCNAME_Imcosh
{
Text [ en-US ] = "IMCOSH";
};
String ANALYSIS_FUNCNAME_Imsech
{
Text [ en-US ] = "IMSECH";
};
String ANALYSIS_FUNCNAME_Imcsch
{
Text [ en-US ] = "IMCSCH";
};
String ANALYSIS_FUNCNAME_Complex
{
Text [ en-US ] = "COMPLEX";
......
......@@ -328,6 +328,38 @@ module addin
string getImsqrt( [in] string Num )
raises( com::sun::star::lang::IllegalArgumentException );
/// imtan.
string getImtan( [in] string Num )
raises( com::sun::star::lang::IllegalArgumentException );
/// imsec.
string getImsec( [in] string Num)
raises( com::sun::star::lang::IllegalArgumentException );
/// imcsc.
string getImcsc( [in] string Num )
raises( com::sun::star::lang::IllegalArgumentException );
/// imcot.
string getImcot( [in] string Num )
raises( com::sun::star::lang::IllegalArgumentException );
/// imsinh.
string getImsinh( [in] string Num )
raises( com::sun::star::lang::IllegalArgumentException );
/// imcosh.
string getImcosh( [in] string Num )
raises( com::sun::star::lang::IllegalArgumentException );
/// imsech.
string getImsech( [in] string Num)
raises( com::sun::star::lang::IllegalArgumentException );
/// imcsch.
string getImcsch( [in] string Num )
raises( com::sun::star::lang::IllegalArgumentException );
/// complex.
string getComplex( [in] double Real, [in] double Imaginary, [in] any Suffix )
raises( com::sun::star::lang::IllegalArgumentException );
......
......@@ -102,6 +102,14 @@ const FuncDataBase pFuncDatas[] =
FUNCDATA( Imsub, UNIQUE, STDPAR, 2, FDCat_Tech ),
FUNCDATA( Imsqrt, UNIQUE, STDPAR, 1, FDCat_Tech ),
FUNCDATA( Imsum, UNIQUE, INTPAR, 1, FDCat_Tech ),
FUNCDATA( Imtan, UNIQUE, STDPAR, 1, FDCat_Tech ),
FUNCDATA( Imsec, UNIQUE, STDPAR, 1, FDCat_Tech ),
FUNCDATA( Imcsc, UNIQUE, STDPAR, 1, FDCat_Tech ),
FUNCDATA( Imcot, UNIQUE, STDPAR, 1, FDCat_Tech ),
FUNCDATA( Imsinh, UNIQUE, STDPAR, 1, FDCat_Tech ),
FUNCDATA( Imcosh, UNIQUE, STDPAR, 1, FDCat_Tech ),
FUNCDATA( Imsech, UNIQUE, STDPAR, 1, FDCat_Tech ),
FUNCDATA( Imcsch, UNIQUE, STDPAR, 1, FDCat_Tech ),
FUNCDATA( Complex, UNIQUE, STDPAR, 3, FDCat_Tech ),
FUNCDATA( Convert, DOUBLE, STDPAR, 3, FDCat_Tech ),
FUNCDATA( Amordegrc, UNIQUE, INTPAR, 7, FDCat_Finance ),
......@@ -1991,15 +1999,9 @@ void Complex::Sqrt( void )
}
inline sal_Bool SinOverflow( double f )
{
return fabs( f ) >= 134217728;
}
void Complex::Sin( void ) THROWDEF_RTE_IAE
{
if( SinOverflow( r ) )
if( !::rtl::math::isValidArcArg( r ) )
THROW_IAE;
if( i )
......@@ -2017,7 +2019,7 @@ void Complex::Sin( void ) THROWDEF_RTE_IAE
void Complex::Cos( void ) THROWDEF_RTE_IAE
{
if( SinOverflow( r ) )
if( !::rtl::math::isValidArcArg( r ) )
THROW_IAE;
if( i )
......@@ -2091,6 +2093,160 @@ void Complex::Log2( void ) THROWDEF_RTE_IAE
}
void Complex::Tan(void) THROWDEF_RTE_IAE
{
if ( i )
{
if( !::rtl::math::isValidArcArg( 2.0 * r ) )
THROW_IAE;
double fScale =1.0 / ( cos( 2.0 * r ) + cosh( 2.0 * i ));
r = sin( 2.0 * r ) * fScale;
i = sinh( 2.0 * i ) * fScale;
}
else
{
if( !::rtl::math::isValidArcArg( r ) )
THROW_IAE;
r = tan( r );
}
}
void Complex::Sec( void ) THROWDEF_RTE_IAE
{
if( i )
{
if( !::rtl::math::isValidArcArg( 2 * r ) )
THROW_IAE;
double fScale = 1.0 / (cosh( 2.0 * i) + cos ( 2.0 * r));
double r_;
r_ = 2.0 * cos( r ) * cosh( i ) * fScale;
i = 2.0 * sin( r ) * sinh( i ) * fScale;
r = r_;
}
else
{
if( !::rtl::math::isValidArcArg( r ) )
THROW_IAE;
r = 1.0 / cos( r );
}
}
void Complex::Csc( void ) THROWDEF_RTE_IAE
{
if( i )
{
if( !::rtl::math::isValidArcArg( 2 * r ) )
THROW_IAE;
double fScale = 1.0 / (cosh( 2.0 * i) - cos ( 2.0 * r));
double r_;
r_ = 2.0 * sin( r ) * cosh( i ) * fScale;
i = -2.0 * cos( r ) * sinh( i ) * fScale;
r = r_;
}
else
{
if( !::rtl::math::isValidArcArg( r ) )
THROW_IAE;
r = 1.0 / sin( r );
}
}
void Complex::Cot(void) THROWDEF_RTE_IAE
{
if ( i )
{
if( !::rtl::math::isValidArcArg( 2.0 * r ) )
THROW_IAE;
double fScale =1.0 / ( cosh( 2.0 * i ) - cos( 2.0 * r ) );
r = sin( 2.0 * r ) * fScale;
i = - ( sinh( 2.0 * i ) * fScale );
}
else
{
if( !::rtl::math::isValidArcArg( r ) )
THROW_IAE;
r = 1.0 / tan( r );
}
}
void Complex::Sinh( void ) THROWDEF_RTE_IAE
{
if( !::rtl::math::isValidArcArg( r ) )
THROW_IAE;
if( i )
{
double r_;
r_ = sinh( r ) * cos( i );
i = cosh( r ) * sin( i );
r = r_;
}
else
r = sinh( r );
}
void Complex::Cosh( void ) THROWDEF_RTE_IAE
{
if( !::rtl::math::isValidArcArg( r ) )
THROW_IAE;
if( i )
{
double r_;
r_ = cosh( r ) * cos( i );
i = sinh( r ) * sin( i );
r = r_;
}
else
r = cosh( r );
}
void Complex::Sech(void) THROWDEF_RTE_IAE
{
if ( i )
{
if( !::rtl::math::isValidArcArg( 2.0 * r ) )
THROW_IAE;
double fScale =1.0 / ( cosh( 2.0 * r ) + cos( 2.0 * i ));
double r_;
r_ = 2.0 * cosh( 2.0 * r ) * cos( i ) * fScale;
i = - (2.0 * sinh( 2.0 * r ) * sin( i ) * fScale );
r = r_ ;
}
else
{
if( !::rtl::math::isValidArcArg( r ) )
THROW_IAE;
r = 1.0 / cosh( r );
}
}
void Complex::Csch(void) THROWDEF_RTE_IAE
{
if ( i )
{
if( !::rtl::math::isValidArcArg( 2.0 * r ) )
THROW_IAE;
double fScale =1.0 / ( cosh( 2.0 * r ) - cos( 2.0 * i ));
double r_;
r_ = 2.0 * sinh( 2.0 * r ) * cos( i ) * fScale;
i = - ( 2.0 * cosh( 2.0 * r ) * sin( i ) * fScale );
r = r_ ;
}
else
{
if( !::rtl::math::isValidArcArg( r ) )
THROW_IAE;
r = 1.0 / sinh( r );
}
}
ComplexList::~ComplexList()
......
......@@ -443,7 +443,7 @@ class Complex
sal_Unicode c;
public:
inline Complex( double fReal, double fImag = 0.0, sal_Char cC = '\0' );
inline Complex( double fReal, double fImag = 0.0, sal_Unicode cC = '\0' );
Complex( const STRING& rComplexAsString ) THROWDEF_RTE_IAE;
inline static sal_Bool IsImagUnit( sal_Unicode c );
......@@ -471,6 +471,15 @@ public:
inline void Mult( const Complex& rMult );
inline void Sub( const Complex& rMult );
inline void Add( const Complex& rAdd );
void Tan( void ) THROWDEF_RTE_IAE;
void Sec( void ) THROWDEF_RTE_IAE;
void Csc( void ) THROWDEF_RTE_IAE;
void Cot( void ) THROWDEF_RTE_IAE;
void Sinh( void ) THROWDEF_RTE_IAE;
void Cosh( void ) THROWDEF_RTE_IAE;
void Sech( void ) THROWDEF_RTE_IAE;
void Csch( void ) THROWDEF_RTE_IAE;
};
......@@ -788,7 +797,7 @@ inline const FuncData* FuncDataList::Get( sal_uInt32 n ) const
}
inline Complex::Complex( double fReal, double fImag, sal_Char cC ) :
inline Complex::Complex( double fReal, double fImag, sal_Unicode cC ) :
r( fReal ), i( fImag ), c( cC )
{
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment