Implement degree mode in DeskCalc.

Default is radian mode,  You set the option in the right click menu
like the other options.

Note: degree mode does not affect hyperbolic trigonometric functions.
This is how Mac Calculator, Windows Calculator, and Google Calculator
work.
This commit is contained in:
John Scipione
2012-07-30 22:35:57 -04:00
parent 93aac98d0a
commit 8ffd0477dd
7 changed files with 98 additions and 3 deletions
+5 -1
View File
@@ -42,6 +42,9 @@ class ExpressionParser {
ExpressionParser();
~ExpressionParser();
bool DegreeMode();
void SetDegreeMode(bool degrees);
void SetSupportHexInput(bool enabled);
BString Evaluate(const char* expressionString);
@@ -49,7 +52,6 @@ class ExpressionParser {
double EvaluateToDouble(const char* expressionString);
private:
MAPM _ParseBinary();
MAPM _ParseSum();
MAPM _ParseProduct();
@@ -64,6 +66,8 @@ class ExpressionParser {
void _EatToken(int32 type);
Tokenizer* fTokenizer;
bool fDegreeMode;
};
#endif // EXPRESSION_PARSER_H