changed: on win9x the configuration file is in

"c:\windows\data application\ttcalc\" now
changed: the program uses the TTMath 0.8.1 now
added:   from TTMath 0.8.1:
         root(x, index), bitand(x,y), bitor(x,y), bitxor(x,y)
         /band(x,y), bor(x,y), bxor(x,y)/
         asinh(x), acosh(x), atanh(x), acoth(x) /atgh(x), actgh(x)/
changed: from TTMath 0.8.1: calculations are much faster now
         especially the factorial() function
changed: from TTMath 0.8.1: the way of parsing operators


git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@37 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2007-04-17 13:41:38 +00:00
parent 8aae2470c5
commit aa10a71d13
11 changed files with 103 additions and 93 deletions

View File

@ -1,3 +1,15 @@
Version 0.8.1 (2007.04.17):
* changed: on win9x the configuration file is in a folder like:
"c:\windows\data application\ttcalc\" now
* changed: the program uses the TTMath 0.8.1 now
* added: from TTMath 0.8.1:
root(x, index), bitand(x,y), bitor(x,y), bitxor(x,y)
/band(x,y), bor(x,y), bxor(x,y)/
asinh(x), acosh(x), atanh(x), acoth(x) /atgh(x), actgh(x)/
* changed: from TTMath 0.8.1: calculations are much faster now
especially the factorial() function
* changed: from TTMath 0.8.1: the way of parsing operators
Version 0.8.0 (2007.04.02):
* added: the del key deletes a variable or a function now
(if the focus is on the list)

1
TODO
View File

@ -1,7 +1,6 @@
TODO TTCalc
===========
* Add some physical constants

View File

@ -27,6 +27,12 @@
<param name="Keyword" value="tgh">
<param name="Keyword" value="coth">
<param name="Keyword" value="ctgh">
<param name="Keyword" value="asinh">
<param name="Keyword" value="acosh">
<param name="Keyword" value="atanh">
<param name="Keyword" value="atgh">
<param name="Keyword" value="acoth">
<param name="Keyword" value="actgh">
<param name="Keyword" value="degtodeg">
<param name="Keyword" value="degtorad">
<param name="Keyword" value="radtodeg">
@ -57,65 +63,77 @@
<dd>This function calculates the natural logarithm of x,<br>e.g. ln(123)=4.812...</dd>
<dt>log(x; base)</dt>
<dd>This function calculates the logarithm of x with a base equal 'base'<br>e.g. log(123; 4)=3.471...</dd>
<dd>This function calculates the logarithm of x with a base equal 'base'<br>log(123; 4)=3.471...</dd>
<dt>exp(x)</dt>
<dd>This function calculates the exponent of x<br>e.g. exp(20)=e^20=485165195.409...</dd>
<dd>This function calculates the exponent of x<br>exp(20)=e^20=485165195.409...</dd>
<dt>sin(x)</dt>
<dd>This function returns the sine of x.<br>For example sin(0.8)=0.717...<br>The argument x is in radians, if you want to calculate
with degrees use the degtorad(x) function first e.g. sin(degtorad(30))=0.5 calculates the sine of 30 degrees.</dd>
<dt>cos(x)</dt>
<dd>Cosine of x<br>e.g. cos(1.3)=0.267...<br>The argument x is in radians.</dd>
<dd>Cosine of x<br>cos(1.3)=0.267...<br>The argument x is in radians.</dd>
<dt>tan(x) or tg(x)</dt>
<dd>Tangent of x<br>e.g. tan(3.6)=0.493...<br>The argument x is in radians.</dd>
<dd>Tangent of x<br>tan(3.6)=0.493...<br>The argument x is in radians.</dd>
<dt>cot(x) or ctg(x)</dt>
<dd>Cotangent of x<br>e.g. cot(2.3)=-0.893...<br>The argument x is in radians.</dd>
<dd>Cotangent of x<br>cot(2.3)=-0.893...<br>The argument x is in radians.</dd>
<dt>asin(x)</dt>
<dd>Arc sine of x<br>e.g. asin(0.7)=0.775...<br>The result is in radians. If you want the result to be in degrees use
<dd>Inverse sine (arc sine) of x<br>e.g. asin(0.7)=0.775...<br>The result is in radians. If you want the result to be in degrees use
radtodeg function e.g. radtodeg(asin(0,5))=30</dd>
<dt>acos(x)</dt>
<dd>Arc cosine of x<br>e.g. acos(0.9)=0.451...<br>The result is in radians.</dd>
<dd>Inverse cosine (arc cosine) of x<br>acos(0.9)=0.451...<br>The result is in radians.</dd>
<dt>atan(x) or atg(x)</dt>
<dd>Arc tangent of x<br>e.g. atan(3.3)=1.276...<br>The result is in radians.</dd>
<dd>Inverse tangent (arc tangent) of x<br>atan(3.3)=1.276...<br>The result is in radians.</dd>
<dt>acot(x) or actg(x)</dt>
<dd>Arc cotangent of x<br>e.g. acot(10)=0.099...<br>The result is in radians.</dd>
<dd>Inverse cotangent (arc cotangent) of x<br>acot(10)=0.099...<br>The result is in radians.</dd>
<dt>sinh(x)</dt>
<dd>This function returns hyperbolic sine of x<br>e.g.sinh(12)=81377.395...</dd>
<dd>This function returns hyperbolic sine of x<br>sinh(12)=81377.395...</dd>
<dt>cosh(x)</dt>
<dd>Hyperbolic cosine of x<br>e.g. cosh(8.5)=2457.384...</dd>
<dd>Hyperbolic cosine of x<br>cosh(8.5)=2457.384...</dd>
<dt>tanh(x) or tgh(x)</dt>
<dd>Hyperbolic tangent of x<br>e.g. tanh(0.67)=0.584...</dd>
<dd>Hyperbolic tangent of x<br>tanh(0.67)=0.584...</dd>
<dt>coth(x) or ctgh(x)</dt>
<dd>Hyperbolic cotangent of x<br>e.g. coth(1.67)=1.073...</dd>
<dd>Hyperbolic cotangent of x<br>coth(1.67)=1.073...</dd>
<dt>asinh(x)</dt>
<dd>This function returns inverse hyperbolic sine of x<br>asinh(3.6)=1.992...</dd>
<dt>acosh(x)</dt>
<dd>This function returns inverse hyperbolic cosine of x<br>acosh(2.23)=1.440...</dd>
<dt>atanh(x) or atgh(x)</dt>
<dd>This function returns inverse hyperbolic tangent of x<br>atanh(0.67)=0.810...</dd>
<dt>acoth(x) or actgh(x)</dt>
<dd>This function returns inverse hyperbolic cotangent of x<br>acoth(1.23)=1.135...</dd>
<dt>DegToDeg(deg; min; sec)</dt>
<dd>This function converts degrees from the long format with degres, minutes and seconds into only degrees.<br>
For example degtodeg(12; 30; 0)=12.5</dd>
<dt>DegToRad(deg)</dt>
<dd>This function converts degrees into radians<br>e.g. degtorad(12.5)=0.218166...</dd>
<dd>This function converts degrees into radians<br>degtorad(12.5)=0.218166...</dd>
<dt>DegToRad(deg; min; sec)</dt>
<dd>This function converts degrees in the long format (degrees, minutes, seconds) to radians.<br>For example
degtorad(12; 30; 0)=0.218166...</dd>
<dt>RadToDeg(rad)</dt>
<dd>This function converts radians into degrees<br>e.g. radtodeg(pi)=180</dd>
<dd>This function converts radians into degrees<br>radtodeg(pi)=180</dd>
<dt>sqrt(x)</dt>
<dd>Sqrt returns the square root of x<br>e.g. sqrt(9)=3</dd>
<dd>Sqrt returns the square root of x<br>sqrt(9)=3</dd>
<dt>root(x ; n)</dt>
<dd>The nth root of a 'x', 'n' must be integer and not negative, if 'n' is zero the result is one,
@ -125,26 +143,26 @@ root(-8;3)=-2
</dd>
<dt>factorial(x)</dt>
<dd>The factorial function<br>e.g. factorial(6)=1*2*3*4*5*6=720</dd>
<dd>The factorial function<br>factorial(6)=1*2*3*4*5*6=720</dd>
<dt>abs(x)</dt>
<dd>The absolute value of x<br>e.g. abs(-10)=10</dd>
<dd>The absolute value of x<br>abs(-10)=10</dd>
<dt>sgn(x)</dt>
<dd>This function returns the sign of x that means when the x is positive the result is 1, when the x is negative
the result is -1 and when the x is zero the result is zero too, e.g.<br>
the result is -1 and when the x is zero the result is zero too<br>
sgn(-10)=-1<br>
sgn(0)=0<br>
sgn(5)=1</dd>
<dt>mod(x,y)</dt>
<dd>Mod returns the remainder from the division x by y<br>e.g. mod(10; 2.2)=1.2 because 10=2.2*4 + 1.2</dd>
<dd>Mod returns the remainder from the division x by y<br>mod(10; 2.2)=1.2 because 10=2.2*4 + 1.2</dd>
<dt>int(x)</dt>
<dd>This method returns only the integer part of x.<br>e.g. int(2.7)=2</dd>
<dd>This method returns only the integer part of x.<br>int(2.7)=2</dd>
<dt>round(x)</dt>
<dd>This method rounds the value of x to the nearest integer e.g.<br>
<dd>This method rounds the value of x to the nearest integer<br>
round(2.8)=3<br>
round(2.2)=2<br>
round(2)=2<br>
@ -152,7 +170,7 @@ round(-4.8)=-5<br>
round(-4.1)=-4</dd>
<dt>ceil(x)</dt>
<dd>This function returns a value representing the smallest integer that is greater than or equal to x, e.g.<br>
<dd>This function returns a value representing the smallest integer that is greater than or equal to x<br>
ceil(2.8)=3<br>
ceil(2.2)=3<br>
ceil(2)=2<br>
@ -160,7 +178,7 @@ ceil(-4.8)=-4<br>
ceil(-4.1)=-4</dd>
<dt>floor(x)</dt>
<dd>This function returns a value representing the largest integer that is less than or equal to x, e.g.<br>
<dd>This function returns a value representing the largest integer that is less than or equal to x<br>
floor(2.8)=2<br>
floor(2.2)=2<br>
floor(2)=2<br>

View File

@ -18,6 +18,7 @@ operators_priority.html
userfunctions.html
index.html
tips.html
bitwise_functions.html
[INFOTYPES]

View File

@ -25,6 +25,10 @@
<param name="Name" value="Logical operators and functions">
<param name="Local" value="logical_functions.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Bitwise functions">
<param name="Local" value="bitwise_functions.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="User defined variables and functions">
<param name="Local" value="userfunctions.html">

View File

@ -3,7 +3,7 @@
[Setup]
AppName=TTCalc
AppVerName=TTCalc 0.8.0
AppVerName=TTCalc 0.8.1
AppPublisher=Tomasz Sowa
AppPublisherURL=http://sourceforge.net/projects/ttcalc
AppSupportURL=http://sourceforge.net/projects/ttcalc
@ -24,7 +24,6 @@ Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "..\..\output\ttcalc.exe"; DestDir: "{app}"; Flags: ignoreversion

View File

@ -56,7 +56,7 @@
#define TTCALC_MAJOR_VER 0
#define TTCALC_MINOR_VER 8
#define TTCALC_REVISION_VER 1
#define TTCALC_PRERELEASE_VER 1
#define TTCALC_PRERELEASE_VER 0

View File

@ -228,9 +228,9 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(tab_precision,"Precision");
InsertGuiPair(tab_display,"Display");
InsertGuiPair(radio_precision_1,"Small - 96 bits for mantissa, 32 bits for exponent");
InsertGuiPair(radio_precision_2,"Medium - 192 bits for mantissa, 64 bits for exponent");
InsertGuiPair(radio_precision_3,"Big - 288 bits for mantissa, 96 bits for exponent");
InsertGuiPair(radio_precision_1,"Small - 96 bits for the mantissa, 32 bits for the exponent");
InsertGuiPair(radio_precision_2,"Medium - 192 bits for the mantissa, 64 bits for the exponent");
InsertGuiPair(radio_precision_3,"Big - 288 bits for the mantissa, 96 bits for the exponent");
InsertGuiPair(precision_1_info,"(+/-)6.9 e+646457021, 26 valid digits (decimal)");
InsertGuiPair(precision_2_info,"(+/-)4.3 e+2776511644261678623, 56 valid digits");

View File

@ -134,38 +134,46 @@ private:
for(i=0 ; i<matparser.stack.size() ; ++i)
{
if( matparser.stack[i].value.ToString(part,base_output, always_scientific, when_scientific, rounding) )
try
{
// we shouldn't have this error in the new version of ToStrign(...)
// (it could be if were using very big mantissa and exponent
// in the Big type)
if( matparser.stack[i].value.ToString(part,base_output, always_scientific, when_scientific, rounding) )
{
// we shouldn't have this error in the new version of ToStrign(...)
// (it could be if were using very big mantissa and exponent
// in the Big type)
//
// look at this: part.erase()
//
// we're using it because it's something wrong on gcc
// when we're compiling with -O3 optimization flag
//
// gcc version 3.4.2 (mingw-special) with -O3
// program tell us if there was an error here (from ToString())
// but in fact it shouldn't have been here
// I don't know where is the problem (I think in optimization,
// with -O1 and -O2 program works well and visual express works perfectly
// as well)
//
// look at this: part.erase()
//
// we're using it because it's something wrong on gcc
// when we're compiling with -O3 optimization flag
//
// gcc version 3.4.2 (mingw-special) with -O3
// program tell us if there was an error here (from ToString())
// but in fact it shouldn't have been here
// I don't know where is the problem (I think in optimization,
// with -O1 and -O2 program works well and visual express works perfectly
// as well)
part.erase();
// we can omit this part.erase() and use operator+= instead of
// operator= below, for example:
// part += GetPrgRes()->GetLanguages()->GuiMessage(country, Languages::overflow_during_printing);
// will be working correctly on gcc with -O3
// this error doesn't appear always, it can be seen, for example,
// if we use Big<1,3> type and we give '2^32' for calculating
// I didn't check this error on a new version of gcc
part = GetPrgRes()->GetLanguages()->GuiMessage(country, Languages::overflow_during_printing);
}
}
catch(...)
{
part.erase();
// we can omit this part.erase() and use operator+= instead of
// operator= below, for example:
// part += GetPrgRes()->GetLanguages()->GuiMessage(country, Languages::overflow_during_printing);
// will be working correctly on gcc with -O3
// this error doesn't appear always, it can be seen, for example,
// if we use Big<1,3> type and we give '2^32' for calculating
// I didn't check this error on a new version of gcc
part = GetPrgRes()->GetLanguages()->GuiMessage(country, Languages::overflow_during_printing);
part = GetPrgRes()->GetLanguages()->ErrorMessage(country, ttmath::err_internal_error);
}
result += part;

View File

@ -461,23 +461,6 @@ return true;
}
bool ProgramResources::IsWindowsNt()
{
OSVERSIONINFO os_info;
os_info.dwOSVersionInfoSize = sizeof( os_info );
if( !GetVersionEx( &os_info ) )
return false;
if( os_info.dwPlatformId != VER_PLATFORM_WIN32_NT )
// we've got Windows 3.1, Windows 95 or Windows 98
return false;
return true;
}
bool ProgramResources::ReadTextValueFromRegistry(HKEY main_key, const char * sub_key, const char * value, std::string & result)
{
HKEY reg_key;
@ -515,13 +498,10 @@ std::string application_data;
// if there'll be an error we assume that the current directory will be used
configuration_file = std::string(".\\") + simple_file_name;
// for the first we must check which operating system we're using
if( !IsWindowsNt() )
return;
// we're trying to read the value "AppData" from registry
// which can be, for instance, as:
// "C:\Documents and Settings\user\data application"
// "C:\Documents and Settings\user\data application" on WinNT
// or "C:\Windows\Data Application\" on Win9x
if( ReadTextValueFromRegistry(
HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
@ -553,8 +533,6 @@ std::string application_data;
delete [] buffer;
}
}

View File

@ -1026,14 +1026,6 @@ return false;
}
BOOL WmTabKeyDown(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
MessageBox(hWnd, "trol", "", 0);
return true;
}
void CreateTabMessagesTable(Messages & messages)
@ -1045,7 +1037,6 @@ void CreateTabMessagesTable(Messages & messages)
messages.Associate(WM_INIT_TAB_PRECISION, WmInitTabPrecision);
messages.Associate(WM_INIT_TAB_DISPLAY, WmInitTabDisplay);
messages.Associate(WM_NOTIFY, WmNotify);
messages.Associate(WM_KEYDOWN, WmTabKeyDown);
}