#
d39b5bfd |
|
28-Feb-2022 |
Dale Cieslak <dcieslak@yahoo.com> |
DeskCalc: make input Locale-aware Accepts input with separators based on user's Locale. For example, with a European locale, "1.234,56" is valid input. With a US locale, "1,234.56" is accepted. The grouping separator is ignored and removed, and the decimal separator is kept. Supports multi-byte decimal separator and grouping separators. The keypad localization is based on the user's Language setting, but the separators come from the Formatting. Thus if the Language is set to English, but the Formatting is set to, for example, German, the keypad will show '.', but when pressed it will emit ',' to match the number Formatting. Otherwise the keypad breaks the localized formatting. Fixes #8503 Change-Id: I0d112bdca67a4e4898e37062102343194ed47f8f Reviewed-on: https://review.haiku-os.org/c/haiku/+/4965 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com> Reviewed-by: waddlesplash <waddlesplash@gmail.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
|
#
fad740e3 |
|
03-Mar-2016 |
John Scipione <jscipione@gmail.com> |
DeskCalc: Estimate n! using 9 term Stirling's Approximation for n >= 1000 Factorial Actual Value (truncated) Approximation 1000! 4.0238726007709377354370243392300398571937E2567 4.0238726007709377354370243392307 E2567 10000! 2.8462596809170545189064132121198688901480E35659 2.8462596809170545189064132121197 E35659 100000! 2.824229407960347874293421578024535518477E456573 2.824229407960347874293421578024 E456573 Close enough!
|
#
261bdbab |
|
17-Jan-2014 |
John Scipione <jscipione@gmail.com> |
Use 5 factor Stirling's Series
|
#
fb4dcb49 |
|
16-Jan-2014 |
John Scipione <jscipione@gmail.com> |
Use Stirling's approximation for n!
|
#
3aeed660 |
|
07-Aug-2014 |
Jérôme Duval <jerome.duval@gmail.com> |
include strings.h where appriopriate... instead or additionally to string.h, in preparation for functions move. * moves str[n]casecmp() functions and others to strings.h. * strings.h doesn't include string.h anymore. * this solves #10949
|
#
747612e3 |
|
08-Jul-2013 |
John Scipione <jscipione@gmail.com> |
ExpressionParser: Simplify pi detection
|
#
91a5e061 |
|
26-Jun-2013 |
John Scipione <jscipione@gmail.com> |
ExpressionParser: Fix parse exception string The main point of this commit is to fix this line: temp << (char)type << "' got '" << token.string << "'"; which gets printed when DeskCalc encounters a parse error. Specifically the (char)type part needed fixing. This code would try to print the char equivalent of a token which got converted to lower ascii character between 0 and 15. This would at best result in a newline and never anything helpful. I took the germ of idea and expanded upon it reassigning the TOKENs to the numeric values of the printable characters they represent where applicable. For instance TOKEN_STAR now has a value of 42 which is ascii for '*'. By using implicit char -> int conversion the numeric value is avoided in the code. So now (char)type will, in many cases get you the equivalent ascii char represented by that type. Those that don't such as TOKEN_IDENTIFIER and TOKEN_CONSTANT are special cased. Once the TOKEN's values correspond to their ASCII equivalents some other simplifications became possible interchanging the TOKEN and the character it represents.
|
#
55751d08 |
|
18-Dec-2012 |
Rene Gollent <anevilyak@gmail.com> |
Move Tokenizer/Token into ExpressionParser's namespace.
|
#
593808d9 |
|
03-Aug-2012 |
John Scipione <jscipione@gmail.com> |
Return authors name's to DeskCalc headers. No functional change. * Surround email addresses in angle brackets. * Add myself to ExpressionParser.cpp and .h * Remove myself from ExpressionTextView.cpp and .h * Alphatetize authors by last name. Thanks Ingo and Axel.
|
#
8ffd0477 |
|
30-Jul-2012 |
John Scipione <jscipione@gmail.com> |
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.
|
#
0f27a79e |
|
12-Nov-2011 |
John Scipione <jscipione@gmail.com> |
Check to see if the argument of tangent divided by half pi is an odd integer. If so, throw an out of domain error.
|
#
60ba75c5 |
|
06-Nov-2011 |
John Scipione <jscipione@gmail.com> |
Add a scientific mode to Deskcalc. Deskcalc already contains support for all the functions in scientific mode but up until now you had to know what they were called and type them in to figure them out. Scientific mode gives you access to most of the available functions via buttons. Pushing one of the the scientific mode buttons inserts the function name along with an innertube () at the current cursor location. If you have some text highlighted when you push a scientific mode button it will put that text inside the innertube. So you can type 0.5, then highlight the text with the mouse, and then push the sin button and you will get sin(0.5). The contextual menu has been altered to support the new mode. Instead of having a single show keypad option in the contextual menu there are 3 new options instead. Compact mode, Basic mode, and Scientific mode. Basic mode is the default mode showing the basic keypad. Compact mode is the same as show keypad turned off, showing just a bare text field. Scientific mode is the new mode which adds buttons for the different transcendental functions and constants that Deskcalc supports. You can also use Alt+0, Alt+1, and Alt+2 keyboard modifiers to switch between the modes. In addition to accepting the word 'pi' for the circumference of the unit circle, Deskcalc now also recognizes the UTF-8 character π which has a dedicated button in scientific mode. I also changed the parser so that lowercase 'e' always means Euler's number and uppercase 'E' always means 'times 10 to the' so 1E5 means 1 times 10 to the 5th. Another small tweak I did was to adjust the minimum basic mode width so that the window is flush with the tab. I also renamed fColums to fColumns, took out some spaces and other style changes and bumped the version to 2.2.0. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43199 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
26fbe862 |
|
26-Aug-2011 |
Stephan Aßmus <superstippi@gmx.de> |
Patch by John Scipione: Added cbrt() function to the supported functions and factrorial expression support. Closes ticket #7945, thanks a bunch! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42690 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1e9af051 |
|
19-Dec-2010 |
Stephan Aßmus <superstippi@gmx.de> |
Patch by jscipione: Check valid input value range for some MAPM functions, since they will otherwise just return 0, instead of indicating an error. Thanks! Fixes ticket #6398. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39889 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6a49b9e8 |
|
25-Apr-2010 |
Stephan Aßmus <superstippi@gmx.de> |
Patch by John Scipione: Rename the log and log10 functions in DeskCalc to ln and log, which is hopefully more in line with expectations of users. Thanks a lot! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36463 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7fd4194e |
|
25-Apr-2010 |
Stephan Aßmus <superstippi@gmx.de> |
Patch by John Scipione: Allow pi and e constants to have full MAPM precision. Thanks a bunch! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36462 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
100dd0cf |
|
23-Jan-2010 |
Michael Pfeiffer <michael.w.pfeiffer@gmail.com> |
Fixed number with exponent scanner (and simplified that code). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35249 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
86a0da42 |
|
22-Jan-2010 |
Stephan Aßmus <superstippi@gmx.de> |
Fixed spelling mistake. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35245 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f88faf25 |
|
22-Jan-2010 |
Stephan Aßmus <superstippi@gmx.de> |
Fix parsing scientific notation in the form of 1E+6 or 1E-6. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35244 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
417f4460 |
|
12-Oct-2009 |
Michael Lotz <mmlr@mlotz.ch> |
The parameter to toFixPtString() only controls the decimal places, not the actual digits. Therefore the buffer was always too small leading to memory corruption. Use the version that allocates the string for us instead, then trim it and assign it to the result. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33566 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
59d799da |
|
28-Jun-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved the mapm library from src/apps/deskcalc to src/libs and headers/libs. * Moved the ExpressionParser class to shared. It's now built into its own static library. * Added hexadecimal number support to the expression parser as well as Evaluation*() methods to get a number instead of a string. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31298 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
3aeed6607cd07762c0e709633c012b3a632dbad9 |
|
07-Aug-2014 |
Jérôme Duval <jerome.duval@gmail.com> |
include strings.h where appriopriate... instead or additionally to string.h, in preparation for functions move. * moves str[n]casecmp() functions and others to strings.h. * strings.h doesn't include string.h anymore. * this solves #10949
|
#
747612e39033209fdca054fe2be0f1f086ec425a |
|
08-Jul-2013 |
John Scipione <jscipione@gmail.com> |
ExpressionParser: Simplify pi detection
|
#
91a5e061488eeb84b78a1eae97009141d1a006b3 |
|
26-Jun-2013 |
John Scipione <jscipione@gmail.com> |
ExpressionParser: Fix parse exception string The main point of this commit is to fix this line: temp << (char)type << "' got '" << token.string << "'"; which gets printed when DeskCalc encounters a parse error. Specifically the (char)type part needed fixing. This code would try to print the char equivalent of a token which got converted to lower ascii character between 0 and 15. This would at best result in a newline and never anything helpful. I took the germ of idea and expanded upon it reassigning the TOKENs to the numeric values of the printable characters they represent where applicable. For instance TOKEN_STAR now has a value of 42 which is ascii for '*'. By using implicit char -> int conversion the numeric value is avoided in the code. So now (char)type will, in many cases get you the equivalent ascii char represented by that type. Those that don't such as TOKEN_IDENTIFIER and TOKEN_CONSTANT are special cased. Once the TOKEN's values correspond to their ASCII equivalents some other simplifications became possible interchanging the TOKEN and the character it represents.
|
#
55751d083a85ed8ee7f09ab06aedc598eea23f23 |
|
18-Dec-2012 |
Rene Gollent <anevilyak@gmail.com> |
Move Tokenizer/Token into ExpressionParser's namespace.
|
#
593808d96ab873ed345cf3a1ac1f5bf04809755f |
|
03-Aug-2012 |
John Scipione <jscipione@gmail.com> |
Return authors name's to DeskCalc headers. No functional change. * Surround email addresses in angle brackets. * Add myself to ExpressionParser.cpp and .h * Remove myself from ExpressionTextView.cpp and .h * Alphatetize authors by last name. Thanks Ingo and Axel.
|
#
8ffd0477dd4998324e051800da35cadd91a7fb8c |
|
30-Jul-2012 |
John Scipione <jscipione@gmail.com> |
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.
|
#
0f27a79e4368cb26dfa0884418e3b30d193d2b94 |
|
12-Nov-2011 |
John Scipione <jscipione@gmail.com> |
Check to see if the argument of tangent divided by half pi is an odd integer. If so, throw an out of domain error.
|
#
60ba75c5ec6df48a5fa2ae8a14802ea8001791bb |
|
06-Nov-2011 |
John Scipione <jscipione@gmail.com> |
Add a scientific mode to Deskcalc. Deskcalc already contains support for all the functions in scientific mode but up until now you had to know what they were called and type them in to figure them out. Scientific mode gives you access to most of the available functions via buttons. Pushing one of the the scientific mode buttons inserts the function name along with an innertube () at the current cursor location. If you have some text highlighted when you push a scientific mode button it will put that text inside the innertube. So you can type 0.5, then highlight the text with the mouse, and then push the sin button and you will get sin(0.5). The contextual menu has been altered to support the new mode. Instead of having a single show keypad option in the contextual menu there are 3 new options instead. Compact mode, Basic mode, and Scientific mode. Basic mode is the default mode showing the basic keypad. Compact mode is the same as show keypad turned off, showing just a bare text field. Scientific mode is the new mode which adds buttons for the different transcendental functions and constants that Deskcalc supports. You can also use Alt+0, Alt+1, and Alt+2 keyboard modifiers to switch between the modes. In addition to accepting the word 'pi' for the circumference of the unit circle, Deskcalc now also recognizes the UTF-8 character π which has a dedicated button in scientific mode. I also changed the parser so that lowercase 'e' always means Euler's number and uppercase 'E' always means 'times 10 to the' so 1E5 means 1 times 10 to the 5th. Another small tweak I did was to adjust the minimum basic mode width so that the window is flush with the tab. I also renamed fColums to fColumns, took out some spaces and other style changes and bumped the version to 2.2.0. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43199 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
26fbe862cfa75e6b8f18ba1c2a8f6900f7a2529a |
|
26-Aug-2011 |
Stephan Aßmus <superstippi@gmx.de> |
Patch by John Scipione: Added cbrt() function to the supported functions and factrorial expression support. Closes ticket #7945, thanks a bunch! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42690 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1e9af0512de95d9fde7eb9f2403c4de6d3a03a05 |
|
19-Dec-2010 |
Stephan Aßmus <superstippi@gmx.de> |
Patch by jscipione: Check valid input value range for some MAPM functions, since they will otherwise just return 0, instead of indicating an error. Thanks! Fixes ticket #6398. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39889 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6a49b9e8a0b48ab4e197376b43d7babdcdd134c2 |
|
25-Apr-2010 |
Stephan Aßmus <superstippi@gmx.de> |
Patch by John Scipione: Rename the log and log10 functions in DeskCalc to ln and log, which is hopefully more in line with expectations of users. Thanks a lot! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36463 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7fd4194e29701f93500213bd5f29ef760dbddea0 |
|
25-Apr-2010 |
Stephan Aßmus <superstippi@gmx.de> |
Patch by John Scipione: Allow pi and e constants to have full MAPM precision. Thanks a bunch! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36462 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
100dd0cf5c65e74cd7821b84610444101aab0040 |
|
23-Jan-2010 |
Michael Pfeiffer <michael.w.pfeiffer@gmail.com> |
Fixed number with exponent scanner (and simplified that code). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35249 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
86a0da42a567c5457c2ce92a12fb874d87932aa6 |
|
22-Jan-2010 |
Stephan Aßmus <superstippi@gmx.de> |
Fixed spelling mistake. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35245 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f88faf25fb61bba5ec6db021669619a1aa28fb5c |
|
22-Jan-2010 |
Stephan Aßmus <superstippi@gmx.de> |
Fix parsing scientific notation in the form of 1E+6 or 1E-6. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35244 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
417f446051e5c15c80dfbbd63b8874167c495aec |
|
12-Oct-2009 |
Michael Lotz <mmlr@mlotz.ch> |
The parameter to toFixPtString() only controls the decimal places, not the actual digits. Therefore the buffer was always too small leading to memory corruption. Use the version that allocates the string for us instead, then trim it and assign it to the result. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33566 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
59d799dabcba86f92658ddb402f634e262d9aae7 |
|
28-Jun-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved the mapm library from src/apps/deskcalc to src/libs and headers/libs. * Moved the ExpressionParser class to shared. It's now built into its own static library. * Added hexadecimal number support to the expression parser as well as Evaluation*() methods to get a number instead of a string. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31298 a95241bf-73f2-0310-859d-f6bbb57e9c96
|