Commit ee40c455 authored by Over_score's avatar Over_score

Little changes in testSuite

parent 23578a4c
......@@ -104,8 +104,8 @@ In: NCSD=34 SL=0 FI=0 RL=LonI:"0" RZ=Re34:"1111222233334444555566667777888886"
RY=Re34:"1111222233334444555566667777888885" ...
RX=Re34:"277805558333611138891666944472221"
Out: EC=0 FI=0 SL=1 RL=Re34:"277805558333611138891666944472221" RZ=Re34:"1" ...
RY=Re34:"-0.5" ...
RX=Re34:"-0.499999999999999999999999999999999100089999999999999999999999999989"
RY=Re34:"-0.499999999999999999999999999999999100089999999999999999999999999989" ...
RX=Re34:"-0.5"
; 1111222233334444555566667777888886*x^2 + 1111222233334444555566667777888885*x + 277805558333611138891666944472221 = 0
;-------------------------------------------------
......@@ -113,8 +113,8 @@ In: NCSD=34 SL=0 FI=0 RL=LonI:"0" RZ=LonI:"1111222233334444555566667777888886"
RY=LonI:"1111222233334444555566667777888885" ...
RX=LonI:"277805558333611138891666944472221"
Out: EC=0 FI=0 SL=1 RL=LonI:"277805558333611138891666944472221" RZ=Re16:"1" ...
RY=Re16:"-0.5" ...
RX=Re16:"-0.499999999999999999999999999999999100089999999999999999999999999989"
RY=Re16:"-0.499999999999999999999999999999999100089999999999999999999999999989" ...
RX=Re16:"-0.5"
; x^2 + 1e50*x + 1 = 0
;-------------------------------------------------
......
......@@ -26,7 +26,7 @@ extern const int16_t menu_FCNS[];
extern const int16_t menu_CNST[];
extern const int16_t menu_MENUS[];
extern const softmenu_t softmenu[];
char line[100000], lastInParameters[10000], fileName[1000], filePath[1000], filePathName[2000], registerExpectedAndValue[1000];
char line[100000], lastInParameters[10000], fileName[1000], filePath[1000], filePathName[2000], registerExpectedAndValue[1000], realString[1000];
int32_t lineNumber, numTestsFile, numTestsTotal;
int32_t functionIndex, funcType, correctSignificantDigits, numberOfCorrectSignificantDigitsExpected;
void (*funcNoParam)(uint16_t);
......@@ -1020,8 +1020,7 @@ void checkRegisterType(calcRegister_t regist, char letter, uint32_t expectedData
int relativeErrorReal16(real16_t *expectedValue16, real16_t *value16, char *numberPart, calcRegister_t regist, char letter) {
real39_t expectedValue, value, relativeError, numSignificantDigits;
real16_t integer;
real39_t expectedValue, value, relativeError;
real16ToReal(expectedValue16, &expectedValue);
real16ToReal(value16, &value);
......@@ -1030,29 +1029,30 @@ int relativeErrorReal16(real16_t *expectedValue16, real16_t *value16, char *numb
if(!realIsZero(&expectedValue)) {
realDivide(&relativeError, &expectedValue, &relativeError, &ctxtReal39);
realDivide(const_1, &relativeError, &numSignificantDigits, &ctxtReal39);
}
else {
realCopy(const_1, &numSignificantDigits);
realCopy(&value, &relativeError);
}
realSetPositiveSign(&relativeError);
realSetPositiveSign(&numSignificantDigits);
if(!realIsZero(&numSignificantDigits)) {
WP34S_Log10(&numSignificantDigits, &numSignificantDigits);
}
else {
realZero(&numSignificantDigits);
}
realToReal16(&numSignificantDigits, &integer);
correctSignificantDigits = real16ToInt32(&integer);
correctSignificantDigits = -relativeError.exponent - relativeError.digits;
ctxtReal39.digits = 2;
realPlus(&relativeError, &relativeError, &ctxtReal39);
ctxtReal39.digits = 39;
if(correctSignificantDigits <= 16) {
//printf("\nThere are only %d correct significant digits in the %s part of the value: %d are expected!\n", correctSignificantDigits, numberPart, numberOfCorrectSignificantDigitsExpected);
realToString(&relativeError, realString);
if(letter == 0) {
printf("\nThere are only %d correct significant digits in the %s part of register %d!\n", correctSignificantDigits, numberPart, regist);
printf("\nThere are only %d correct significant digits in the %s part of register %d! Relative error is %s\n", correctSignificantDigits, numberPart, regist, realString);
printf("R%d = ", regist);
printReal16ToConsole(value16);
printf("\n");
}
else {
printf("\nThere are only %d correct significant digits in the %s part of register %c!\n", correctSignificantDigits, numberPart, letter);
printf("\nThere are only %d correct significant digits in the %s part of register %c! Relative error is %s\n", correctSignificantDigits, numberPart, letter, realString);
printf("%c = ", letter);
printReal16ToConsole(value16);
printf("\n");
}
printf("%s\n", lastInParameters);
printf("%s\n", line);
......@@ -1069,8 +1069,7 @@ int relativeErrorReal16(real16_t *expectedValue16, real16_t *value16, char *numb
int relativeErrorReal34(real34_t *expectedValue34, real34_t *value34, char *numberPart, calcRegister_t regist, char letter) {
real39_t expectedValue, value, relativeError, numSignificantDigits;
real16_t integer;
real39_t expectedValue, value, relativeError;
real34ToReal(expectedValue34, &expectedValue);
real34ToReal(value34, &value);
......@@ -1079,29 +1078,30 @@ int relativeErrorReal34(real34_t *expectedValue34, real34_t *value34, char *numb
if(!realIsZero(&expectedValue)) {
realDivide(&relativeError, &expectedValue, &relativeError, &ctxtReal39);
realDivide(const_1, &relativeError, &numSignificantDigits, &ctxtReal39);
}
else {
realCopy(const_1, &numSignificantDigits);
realCopy(&value, &relativeError);
}
realSetPositiveSign(&relativeError);
realSetPositiveSign(&numSignificantDigits);
if(!realIsZero(&numSignificantDigits)) {
WP34S_Log10(&numSignificantDigits, &numSignificantDigits);
}
else {
realZero(&numSignificantDigits);
}
realToReal16(&numSignificantDigits, &integer);
correctSignificantDigits = real16ToInt32(&integer);
correctSignificantDigits = -relativeError.exponent - relativeError.digits;
ctxtReal39.digits = 2;
realPlus(&relativeError, &relativeError, &ctxtReal39);
ctxtReal39.digits = 39;
if(correctSignificantDigits <= 34) {
//printf("\nThere are only %d correct significant digits in the %s part of the value: %d are expected!\n", correctSignificantDigits, numberPart, numberOfCorrectSignificantDigitsExpected);
realToString(&relativeError, realString);
if(letter == 0) {
printf("\nThere are only %d correct significant digits in the %s part of register %d!\n", correctSignificantDigits, numberPart, regist);
printf("\nThere are only %d correct significant digits in the %s part of register %d! Relative error is %s\n", correctSignificantDigits, numberPart, regist, realString);
printf("R%d = ", regist);
printReal34ToConsole(value34);
printf("\n");
}
else {
printf("\nThere are only %d correct significant digits in the %s part of register %c!\n", correctSignificantDigits, numberPart, letter);
printf("\nThere are only %d correct significant digits in the %s part of register %c! Relative error is %s\n", correctSignificantDigits, numberPart, letter, realString);
printf("%c = ", letter);
printReal34ToConsole(value34);
printf("\n");
}
printf("%s\n", lastInParameters);
printf("%s\n", line);
......
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