Kaydet (Commit) 9dd0e2aa authored tarafından Eike Rathke's avatar Eike Rathke

dr78: #i111413# new ODFF interpreter functions SEC, SECH, CSC, CSCH; patch from…

dr78: #i111413# new ODFF interpreter functions SEC, SECH, CSC, CSCH; patch from <regina>, slightly reworked

# HG changeset patch
# User Eike Rathke [er] <eike.rathke@oracle.com>
# Date 1291394833 -3600
# Node ID ff05fcb4fe392f8c336466982a25fdfda207515a
# Parent  4ca136c3f3c8eb330664884c2ff79e2027d8e4eb
üst 69c4db12
...@@ -518,6 +518,10 @@ ...@@ -518,6 +518,10 @@
#define HID_FUNC_COTHYP "SC_HID_FUNC_COTHYP" #define HID_FUNC_COTHYP "SC_HID_FUNC_COTHYP"
#define HID_FUNC_TANHYP "SC_HID_FUNC_TANHYP" #define HID_FUNC_TANHYP "SC_HID_FUNC_TANHYP"
#define HID_FUNC_ARCTAN2 "SC_HID_FUNC_ARCTAN2" #define HID_FUNC_ARCTAN2 "SC_HID_FUNC_ARCTAN2"
#define HID_FUNC_COSECANT "SC_HID_FUNC_COSECANT"
#define HID_FUNC_SECANT "SC_HID_FUNC_SECANT"
#define HID_FUNC_SECANTHYP "SC_HID_FUNC_SECANTHYP"
#define HID_FUNC_COSECANTHYP "SC_HID_FUNC_COSECANTHYP"
#define HID_FUNC_DEG "SC_HID_FUNC_DEG" #define HID_FUNC_DEG "SC_HID_FUNC_DEG"
#define HID_FUNC_RAD "SC_HID_FUNC_RAD" #define HID_FUNC_RAD "SC_HID_FUNC_RAD"
#define HID_FUNC_EXP "SC_HID_FUNC_EXP" #define HID_FUNC_EXP "SC_HID_FUNC_EXP"
......
...@@ -412,6 +412,10 @@ void ScArcSinHyp(); ...@@ -412,6 +412,10 @@ void ScArcSinHyp();
void ScArcCosHyp(); void ScArcCosHyp();
void ScArcTanHyp(); void ScArcTanHyp();
void ScArcCotHyp(); void ScArcCotHyp();
void ScCosecant();
void ScSecant();
void ScCosecantHyp();
void ScSecantHyp();
void ScExp(); void ScExp();
void ScLn(); void ScLn();
void ScLog10(); void ScLog10();
......
...@@ -1748,6 +1748,30 @@ void ScInterpreter::ScArcCotHyp() ...@@ -1748,6 +1748,30 @@ void ScInterpreter::ScArcCotHyp()
PushDouble(0.5 * log((nVal + 1.0) / (nVal - 1.0))); PushDouble(0.5 * log((nVal + 1.0) / (nVal - 1.0)));
} }
void ScInterpreter::ScCosecant()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "regina", "ScInterpreter::ScCosecant" );
PushDouble(1.0 / ::rtl::math::sin(GetDouble()));
}
void ScInterpreter::ScSecant()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "regina", "ScInterpreter::ScSecant" );
PushDouble(1.0 / ::rtl::math::cos(GetDouble()));
}
void ScInterpreter::ScCosecantHyp()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "regina", "ScInterpreter::ScCosecantHyp" );
PushDouble(1.0 / sinh(GetDouble()));
}
void ScInterpreter::ScSecantHyp()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "regina", "ScInterpreter::ScSecantHyp" );
PushDouble(1.0 / cosh(GetDouble()));
}
void ScInterpreter::ScExp() void ScInterpreter::ScExp()
{ {
......
...@@ -3812,6 +3812,10 @@ StackVar ScInterpreter::Interpret() ...@@ -3812,6 +3812,10 @@ StackVar ScInterpreter::Interpret()
case ocArcCosHyp : ScArcCosHyp(); break; case ocArcCosHyp : ScArcCosHyp(); break;
case ocArcTanHyp : ScArcTanHyp(); break; case ocArcTanHyp : ScArcTanHyp(); break;
case ocArcCotHyp : ScArcCotHyp(); break; case ocArcCotHyp : ScArcCotHyp(); break;
case ocCosecant : ScCosecant(); break;
case ocSecant : ScSecant(); break;
case ocCosecantHyp : ScCosecantHyp(); break;
case ocSecantHyp : ScSecantHyp(); break;
case ocExp : ScExp(); break; case ocExp : ScExp(); break;
case ocLn : ScLn(); break; case ocLn : ScLn(); break;
case ocLog10 : ScLog10(); break; case ocLog10 : ScLog10(); break;
......
...@@ -3468,6 +3468,105 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 ...@@ -3468,6 +3468,105 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1
Text [ en-US ] = "The value for the y coordinate." ; Text [ en-US ] = "The value for the y coordinate." ;
}; };
}; };
// -=*# Resource for function CSC #*=-
Resource SC_OPCODE_COSECANT
{
String 1 // Description
{
Text [ en-US ] = "Return the cosecant of an angle. CSC(x)=1/SIN(x)" ;
};
ExtraData =
{
0;
ID_FUNCTION_GRP_MATH;
U2S( HID_FUNC_COSECANT );
1; 0;
0;
};
String 2 // Name of Parameter 1
{
Text [ en-US ] = "Angle" ;
};
String 3 // Description of Parameter 1
{
Text [ en-US ] = "The angle in radians for which the cosecant is to be calculated." ;
};
};
// -=*# Resource for function SEC #*=-
Resource SC_OPCODE_SECANT
{
String 1 // Description
{
Text [ en-US ] = "Return the secant of an angle. SEC(x)=1/COS(x)" ;
};
ExtraData =
{
0;
ID_FUNCTION_GRP_MATH;
U2S( HID_FUNC_SECANT );
1; 0;
0;
};
String 2 // Name of Parameter 1
{
Text [ en-US ] = "Angle" ;
};
String 3 // Description of Parameter 1
{
Text [ en-US ] = "The angle in radians for which the secant is to be calculated." ;
};
};
// -=*# Resource for function CSCH #*=-
Resource SC_OPCODE_COSECANT_HYP
{
String 1 // Description
{
Text [ en-US ] = "Return the hyperbolic cosecant of a hyperbolic angle. CSCH(x)=1/SINH(x)" ;
};
ExtraData =
{
0;
ID_FUNCTION_GRP_MATH;
U2S( HID_FUNC_COSECANTHYP );
1; 0;
0;
};
String 2 // Name of Parameter 1
{
Text [ en-US ] = "Angle" ;
};
String 3 // Description of Parameter 1
{
Text [ en-US ] = "The hyperbolic angle in radians for which the hyperbolic cosecant is to be calculated." ;
};
};
// -=*# Resource for function SECH #*=-
Resource SC_OPCODE_SECANT_HYP
{
String 1 // Description
{
Text [ en-US ] = "Return the hyperbolic secant of a hyperbolic angle. SECH(x)=1/COSH(x)" ;
};
ExtraData =
{
0;
ID_FUNCTION_GRP_MATH;
U2S( HID_FUNC_SECANTHYP );
1; 0;
0;
};
String 2 // Name of Parameter 1
{
Text [ en-US ] = "Angle" ;
};
String 3 // Description of Parameter 1
{
Text [ en-US ] = "The hyperbolic angle in radians for which the hyperbolic secant is to be calculated." ;
};
};
// -=*# Resource for function DEG #*=- // -=*# Resource for function DEG #*=-
Resource SC_OPCODE_DEG Resource SC_OPCODE_DEG
{ {
......
...@@ -191,6 +191,10 @@ hidspecial HID_FUNC_SINHYP { HelpID = HID_FUNC_SINHYP; }; ...@@ -191,6 +191,10 @@ hidspecial HID_FUNC_SINHYP { HelpID = HID_FUNC_SINHYP; };
hidspecial HID_FUNC_COTHYP { HelpID = HID_FUNC_COTHYP; }; hidspecial HID_FUNC_COTHYP { HelpID = HID_FUNC_COTHYP; };
hidspecial HID_FUNC_TANHYP { HelpID = HID_FUNC_TANHYP; }; hidspecial HID_FUNC_TANHYP { HelpID = HID_FUNC_TANHYP; };
hidspecial HID_FUNC_ARCTAN2 { HelpID = HID_FUNC_ARCTAN2; }; hidspecial HID_FUNC_ARCTAN2 { HelpID = HID_FUNC_ARCTAN2; };
hidspecial HID_FUNC_COSECANT { HelpID = HID_FUNC_COSECANT; };
hidspecial HID_FUNC_SECANT { HelpID = HID_FUNC_SECANT; };
hidspecial HID_FUNC_COSECANTHYP { HelpID = HID_FUNC_COSECANTHYP; };
hidspecial HID_FUNC_SECANTHYP { HelpID = HID_FUNC_SECANTHYP; };
hidspecial HID_FUNC_DEG { HelpID = HID_FUNC_DEG; }; hidspecial HID_FUNC_DEG { HelpID = HID_FUNC_DEG; };
hidspecial HID_FUNC_RAD { HelpID = HID_FUNC_RAD; }; hidspecial HID_FUNC_RAD { HelpID = HID_FUNC_RAD; };
hidspecial HID_FUNC_EXP { HelpID = HID_FUNC_EXP; }; hidspecial HID_FUNC_EXP { HelpID = HID_FUNC_EXP; };
......
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