Commit e30f8968 authored by Over_score's avatar Over_score

Merge branch '404-implementing-ulp-and-neighb' into 'master'

Resolve "Implementing ULP and NEIGHB"

Closes #404

See merge request !496
parents a2a0fe59 fab0c6b5
No preview for this file type
......@@ -76,9 +76,9 @@ SRC_WP43S = \
cxToRe.c idiv.c idivr.c \
division.c exp.c expt.c factorial.c floor.c fractionalPart.c gamma.c gcd.c \
imaginaryPart.c integerPart.c invert.c lcm.c ln.c log10.c \
log2.c magnitude.c mant.c minusOnePow.c modulo.c multiplication.c parallel.c pcg_basic.c power.c \
log2.c magnitude.c mant.c minusOnePow.c modulo.c multiplication.c neighb.c parallel.c pcg_basic.c power.c \
random.c realPart.c remainder.c reToCx.c round.c roundi.c sign.c sin.c sinh.c slvq.c square.c squareRoot.c \
subtraction.c swapRealImaginary.c tan.c tanh.c toPolar.c toRect.c unitVector.c \
subtraction.c swapRealImaginary.c tan.c tanh.c toPolar.c toRect.c ulp.c unitVector.c \
wp34s.c) \
$(addprefix src/wp43s/logicalOps/, \
not.c) \
......
This diff is collapsed.
......@@ -111,6 +111,7 @@ const funcTest_t funcTestNoParam[] = {
{"fnMirror", fnMirror },
{"fnMod", fnMod },
{"fnMultiply", fnMultiply },
{"fnNeighb", fnNeighb },
{"fnNop", fnNop },
{"fnParallel", fnParallel },
{"fnPi", fnPi },
......@@ -135,6 +136,7 @@ const funcTest_t funcTestNoParam[] = {
{"fnTanh", fnTanh },
{"fnToPolar", fnToPolar },
{"fnToRect", fnToRect },
{"fnUlp", fnUlp },
{"fnUnitVector", fnUnitVector },
{"", NULL }
};
......@@ -2065,6 +2067,7 @@ void processOneFile(void) {
numTestsFile = 0;
strcpy(fileName, line);
strcat(fileName, ".txt");
sprintf(filePathName, "%s/%s", filePath, fileName);
printf("Performing tests from file %s ", filePathName);
......@@ -2152,7 +2155,7 @@ void processTests(void) {
sprintf(filePathName, "%s/testSuiteList.txt", filePath);
fileList = fopen(filePathName, "rb");
if(fileList == NULL) {
printf("Cannot open file fileList.txt!\n");
printf("Cannot open file testSuiteList.txt!\n");
exit(-1);
}
......
......@@ -48,159 +48,162 @@
;
; This file is only a list of files containing the tests to perform
initialSettings.txt
;debug.txt
changeSign.txt
sign.txt
conversionAngles.txt
addition_longInteger.txt
addition_real16.txt
addition_complex16.txt
addition_time.txt
addition_date.txt
addition_string.txt
addition_real16Matrix.txt
addition_complex16Matrix.txt
addition_shortInteger.txt
addition_real34.txt
addition_complex34.txt
subtraction_longInteger.txt
subtraction_real16.txt
subtraction_complex16.txt
subtraction_time.txt
subtraction_date.txt
subtraction_string.txt
subtraction_real16Matrix.txt
subtraction_complex16Matrix.txt
subtraction_shortInteger.txt
subtraction_real34.txt
subtraction_complex34.txt
multiplication_longInteger.txt
multiplication_real16.txt
multiplication_complex16.txt
multiplication_time.txt
multiplication_date.txt
multiplication_string.txt
multiplication_real16Matrix.txt
multiplication_complex16Matrix.txt
multiplication_shortInteger.txt
multiplication_real34.txt
multiplication_complex34.txt
division_longInteger.txt
division_real16.txt
division_complex16.txt
division_time.txt
division_date.txt
division_string.txt
division_real16Matrix.txt
division_complex16Matrix.txt
division_shortInteger.txt
division_real34.txt
division_complex34.txt
invert.txt
power_longInteger.txt
power_real16.txt
power_complex16.txt
power_time.txt
power_date.txt
power_string.txt
power_real16Matrix.txt
power_complex16Matrix.txt
power_shortInteger.txt
power_real34.txt
power_complex34.txt
parallel_longInteger.txt
parallel_real16.txt
parallel_complex16.txt
parallel_time.txt
parallel_date.txt
parallel_string.txt
parallel_real16Matrix.txt
parallel_complex16Matrix.txt
parallel_shortInteger.txt
parallel_real34.txt
parallel_complex34.txt
initialSettings
;debug
ulp
neighb
changeSign
sign
conversionAngles
addition_longInteger
addition_real16
addition_complex16
addition_time
addition_date
addition_string
addition_real16Matrix
addition_complex16Matrix
addition_shortInteger
addition_real34
addition_complex34
subtraction_longInteger
subtraction_real16
subtraction_complex16
subtraction_time
subtraction_date
subtraction_string
subtraction_real16Matrix
subtraction_complex16Matrix
subtraction_shortInteger
subtraction_real34
subtraction_complex34
multiplication_longInteger
multiplication_real16
multiplication_complex16
multiplication_time
multiplication_date
multiplication_string
multiplication_real16Matrix
multiplication_complex16Matrix
multiplication_shortInteger
multiplication_real34
multiplication_complex34
division_longInteger
division_real16
division_complex16
division_time
division_date
division_string
division_real16Matrix
division_complex16Matrix
division_shortInteger
division_real34
division_complex34
invert
power_longInteger
power_real16
power_complex16
power_time
power_date
power_string
power_real16Matrix
power_complex16Matrix
power_shortInteger
power_real34
power_complex34
parallel_longInteger
parallel_real16
parallel_complex16
parallel_time
parallel_date
parallel_string
parallel_real16Matrix
parallel_complex16Matrix
parallel_shortInteger
parallel_real34
parallel_complex34
;Answer to the Ultimate Question of Life
ultimateQuestionOfLife.txt
ultimateQuestionOfLife
rectangularToPolar.txt
polarToRectangular.txt
rectangularToPolar
polarToRectangular
ceil.txt
floor.txt
;round.txt
roundi.txt
ceil
floor
;round
roundi
idiv.txt
idivr.txt
modulo.txt
remainder.txt
idiv
idivr
modulo
remainder
mant.txt
expt.txt
mant
expt
10pow.txt
2pow.txt
minusOnePow.txt
exp.txt
log10.txt
log2.txt
ln.txt
10pow
2pow
minusOnePow
exp
log10
log2
ln
arccos.txt
arcsin.txt
arctan.txt
arccos
arcsin
arctan
cos.txt
sin.txt
tan.txt
cos
sin
tan
arccosh.txt
arcsinh.txt
arctanh.txt
arccosh
arcsinh
arctanh
cosh.txt
sinh.txt
tanh.txt
cosh
sinh
tanh
;The standard calculator performance test arcsin(arccos(arctan(tan(cos(sin(9°))))))-9
trig.txt
trig
conjugate.txt
reToCx.txt
cxToRe.txt
conjugate
reToCx
cxToRe
square.txt
squareRoot.txt
cube.txt
cubeRoot.txt
square
squareRoot
cube
cubeRoot
lnGamma.txt
gamma.txt
factorial.txt
lnGamma
gamma
factorial
fractionalPart.txt
integerPart.txt
realPart.txt
imaginaryPart.txt
swapRealImaginary.txt
fractionalPart
integerPart
realPart
imaginaryPart
swapRealImaginary
gcd.txt
lcm.txt
gcd
lcm
magnitude.txt
unitVector.txt
magnitude
unitVector
slvq.txt
agm.txt
slvq
agm
\ No newline at end of file
;*************************************************************
;*************************************************************
;** **
;** ulp **
;** **
;*************************************************************
;*************************************************************
In: FD=0 FI=0 SD=0 RM=0 IM=2compl SS=4 WS=64
Func: fnUlp
;=======================================
; ulp(Long Integer) --> Long Integer
;=======================================
In: AM=DEG SL=0 FI=0 RX=LonI:"5"
Out: EC=0 FI=0 SL=1 RL=LonI:"5" RX=LonI:"1"
In: AM=DEG SL=0 FI=0 RX=LonI:"-5"
Out: EC=0 FI=0 SL=1 RL=LonI:"-5" RX=LonI:"1"
In: AM=DEG SL=0 FI=0 RX=LonI:"0"
Out: EC=0 FI=0 SL=1 RL=LonI:"0" RX=LonI:"1"
In: AM=DEG SL=0 FI=0 RX=LonI:"566455346352121031034518455314561461426127127575698157917612769129796125"
Out: EC=0 FI=0 SL=1 RL=LonI:"566455346352121031034518455314561461426127127575698157917612769129796125" RX=LonI:"1"
In: AM=DEG SL=0 FI=0 RX=LonI:"-566455346352121031034518455314561461426127127575698157917612769129796125"
Out: EC=0 FI=0 SL=1 RL=LonI:"-566455346352121031034518455314561461426127127575698157917612769129796125" RX=LonI:"1"
;=======================================
; ulp(Real16) --> Real16
;=======================================
In: AM=DEG SL=0 FI=0 NCSD=16 RX=Re16:"0.0001"
Out: EC=0 FI=0 SL=1 RL=Re16:"0.0001" RX=Re16:"1e-19"
In: AM=DEG SL=0 FI=0 RX=Re16:"0"
Out: EC=0 FI=0 SL=1 RL=Re16:"0" RX=Re16:"1e-398"
In: AM=GRAD SL=0 FI=0 RX=Re16:"50"
Out: EC=0 FI=0 SL=1 RL=Re16:"50" RX=Re16:"1e-14"
In: AM=DEG SL=0 FI=0 RX=Re16:"899.99999"
Out: EC=0 FI=0 SL=1 RL=Re16:"899.99999" RX=Re16:"1e-13"
In: SL=0 FI=0 RX=Re16:"5.32564":DMS
Out: EC=0 FI=0 SL=1 RL=Re16:"5.32564":DMS RX=Re16:"1e-15"
In: SL=0 FI=0 RX=Re16:"-5.32564":GRAD
Out: EC=0 FI=0 SL=1 RL=Re16:"-5.32564":GRAD RX=Re16:"1e-15"
; NaN
In: SL=0 FI=0 RX=Re16:"NaN":RAD
Out: EC=1 FI=0 SL=0 RX=Re16:"NaN":RAD
In: SL=0 FI=0 RX=Re16:"NaN"
Out: EC=1 FI=0 SL=0 RX=Re16:"NaN"
; Infinity
In: SL=0 FI=0 FD=1 RX=Re16:"inf":DEG
Out: EC=1 FI=0 SL=0 RX=Re16:"inf":DEG
In: SL=0 FI=0 FD=0 RX=Re16:"inf":MULTPI
Out: EC=1 FI=0 SL=0 RX=Re16:"inf":MULTPI
In: SL=0 FI=0 FD=0 RX=Re16:"-inf":RAD
Out: EC=1 FI=0 SL=0 RX=Re16:"-inf":RAD
In: SL=0 FI=0 FD=1 RX=Re16:"inf"
Out: EC=1 FI=0 SL=0 RX=Re16:"inf"
In: SL=0 FI=0 FD=0 RX=Re16:"inf"
Out: EC=1 FI=0 SL=0 RX=Re16:"inf"
In: SL=0 FI=0 FD=0 RX=Re16:"-inf"
Out: EC=1 FI=0 SL=0 RX=Re16:"-inf"
;=======================================
; ulp(Complex16) --> Error24
;=======================================
In: AM=DEG SL=0 FI=0 NCSD=16 RX=Co16:"6.2 i -7.6"
Out: EC=24 FI=0 SL=0 RL=Co16:"6.2 i -7.6"
;=======================================
; ulp(Time) --> Error24
;=======================================
;=======================================
; ulp(Date) --> Error24
;=======================================
;=======================================
; ulp(String) --> Error24
;=======================================
In: SL=0 RX=Stri:"String test"
Out: EC=24 SL=0 RX=Stri:"String test"
;=======================================
; ulp(Real16 Matrix) --> Error24
;=======================================
;=======================================
; ulp(Complex16 Matrix) --> Error24
;=======================================
;=======================================
; ulp(Short Integer) --> Short Integer
;=======================================
In: SL=0 FI=0 RX=ShoI:"5#7"
Out: EC=0 FI=0 SL=1 RL=ShoI:"5#7" RX=ShoI:"1#7"
In: SL=0 FI=0 RX=ShoI:"-BadCafeFace#16"
Out: EC=0 FI=0 SL=1 RL=ShoI:"-BadCafeFace#16" RX=ShoI:"1#16"
;=======================================
; ulp(Real34) --> Real34
;=======================================
In: AM=DEG SL=0 FI=0 NCSD=34 RX=Re34:"0.0001"
Out: EC=0 FI=0 SL=1 RL=Re34:"0.0001" RX=Re34:"1e-37"
In: AM=DEG SL=0 FI=0 RX=Re34:"0"
Out: EC=0 FI=0 SL=1 RL=Re34:"0" RX=Re34:"1e-6176"
In: AM=GRAD SL=0 FI=0 RX=Re34:"50"
Out: EC=0 FI=0 SL=1 RL=Re34:"50" RX=Re34:"1e-32"
In: AM=DEG SL=0 FI=0 RX=Re34:"899.99999"
Out: EC=0 FI=0 SL=1 RL=Re34:"899.99999" RX=Re34:"1e-31"
In: SL=0 FI=0 RX=Re34:"5.32564":DMS
Out: EC=0 FI=0 SL=1 RL=Re34:"5.32564":DMS RX=Re34:"1e-33"
In: SL=0 FI=0 RX=Re34:"-5.32564":GRAD
Out: EC=0 FI=0 SL=1 RL=Re34:"-5.32564":GRAD RX=Re34:"1e-33"
; NaN
In: SL=0 FI=0 RX=Re34:"NaN":RAD
Out: EC=1 FI=0 SL=0 RX=Re34:"NaN":RAD
In: SL=0 FI=0 RX=Re34:"NaN"
Out: EC=1 FI=0 SL=0 RX=Re34:"NaN"
; Infinity
In: SL=0 FI=0 FD=1 RX=Re34:"inf":DEG
Out: EC=1 FI=0 SL=0 RX=Re34:"inf":DEG
In: SL=0 FI=0 FD=0 RX=Re34:"inf":MULTPI
Out: EC=1 FI=0 SL=0 RX=Re34:"inf":MULTPI
In: SL=0 FI=0 FD=0 RX=Re34:"-inf":RAD
Out: EC=1 FI=0 SL=0 RX=Re34:"-inf":RAD
In: SL=0 FI=0 FD=1 RX=Re34:"inf"
Out: EC=1 FI=0 SL=0 RX=Re34:"inf"
In: SL=0 FI=0 FD=0 RX=Re34:"inf"
Out: EC=1 FI=0 SL=0 RX=Re34:"inf"
In: SL=0 FI=0 FD=0 RX=Re34:"-inf"
Out: EC=1 FI=0 SL=0 RX=Re34:"-inf"
;=======================================
; ulp(Complex34) --> Complex34
;=======================================
In: AM=DEG SL=0 FI=0 NCSD=34 RX=Co34:"6.2 i -7.6"
Out: EC=24 FI=0 SL=0 RL=Co34:"6.2 i -7.6"
......@@ -146,7 +146,7 @@ char * getRegisterTagName(calcRegister_t regist, bool_t padWithBlanks) {
case AM_RADIAN: return "radian ";
case AM_GRAD: return "grad ";
case AM_MULTPI: return "multPi ";
case AM_NONE: return " ";
case AM_NONE: return "none ";
default: return "??? ";
}
......@@ -183,7 +183,7 @@ char * getAngularModeName(uint16_t angularMode) {
if(angularMode == AM_GRAD ) return "grad ";
if(angularMode == AM_MULTPI) return "multPi";
if(angularMode == AM_RADIAN) return "radian";
if(angularMode == AM_NONE) return " ";
if(angularMode == AM_NONE) return "none ";
return "??? ";
}
......
......@@ -136,6 +136,8 @@ typedef struct {real75_t real, imag;} complex75_t;
#define real16IsZero(source) decDoubleIsZero ((real16_t *)(source))
#define real16Minus(operand, res) decDoubleMinus ((real16_t *)(res), (real16_t *)(operand), &ctxtReal16)
#define real16Multiply(operand1, operand2, res) decDoubleMultiply ((real16_t *)(res), (real16_t *)(operand1), (real16_t *)(operand2), &ctxtReal16)
#define real16NextMinus(operand, res) decDoubleNextPlus ((real16_t *)(res), (real16_t *)(operand), &ctxtReal16)
#define real16NextPlus(operand, res) decDoubleNextPlus ((real16_t *)(res), (real16_t *)(operand), &ctxtReal16)
#define real16Plus(operand, res) decDoublePlus ((real16_t *)(res), (real16_t *)(operand), &ctxtReal16)
#define real16SetNegativeSign(operand) ((real16_t *)(operand))->bytes[7] |= 0x80
#define real16SetPositiveSign(operand) ((real16_t *)(operand))->bytes[7] &= 0x7F
......@@ -191,6 +193,8 @@ typedef struct {real75_t real, imag;} complex75_t;
#define real34IsZero(source) decQuadIsZero ((real34_t *)(source))
#define real34Minus(operand, res) decQuadMinus ((real34_t *)(res), (real34_t *)(operand), &ctxtReal34)
#define real34Multiply(operand1, operand2, res) decQuadMultiply ((real34_t *)(res), (real34_t *)(operand1), (real34_t *)(operand2), &ctxtReal34)
#define real34NextMinus(operand, res) decQuadNextPlus ((real34_t *)(res), (real34_t *)(operand), &ctxtReal34)
#define real34NextPlus(operand, res) decQuadNextPlus ((real34_t *)(res), (real34_t *)(operand), &ctxtReal34)
#define real34Plus(operand, res) decQuadPlus ((real34_t *)(res), (real34_t *)(operand), &ctxtReal34)
#define real34SetNegativeSign(operand) ((real34_t *)(operand))->bytes[15] |= 0x80
#define real34SetPositiveSign(operand) ((real34_t *)(operand))->bytes[15] &= 0x7F
......@@ -237,6 +241,7 @@ typedef struct {real75_t real, imag;} complex75_t;
#define realIsZero(source) decNumberIsZero ((real_t *)(source))
#define realMinus(operand, res, ctxt) decNumberMinus ((real_t *)(res), (real_t *)(operand), ctxt)
#define realMultiply(operand1, operand2, res, ctxt) decNumberMultiply ((real_t *)(res), (real_t *)(operand1), (real_t *)(operand2), ctxt)
#define realNextToward(from, toward, res, ctxt) decNumberNextToward ((real_t *)(res), (real_t *)(from), (real_t *)(toward), ctxt)
#define realPlus(operand, res, ctxt) decNumberPlus ((real_t *)(res), (real_t *)(operand), ctxt)
#define realPower(operand1, operand2, res, ctxt) decNumberPower ((real_t *)(res), (real_t *)(operand1), (real_t *)(operand2), ctxt)
#define realSetNegativeSign(operand) ((real_t *)(operand))->bits |= 0x80
......
......@@ -542,7 +542,7 @@ const item_t indexOfItems[] = {
/* 418 */ { itemToBeCoded, NOPARAM, "NBin" STD_SUB_e, "NBin" STD_SUB_e, CAT_FNCT, SLS_UNCHANGED},
/* 419 */ { itemToBeCoded, NOPARAM, "NBin" STD_SUP_MINUS_1, "NBin" STD_SUP_MINUS_1, CAT_FNCT, SLS_UNCHANGED},
/* 420 */ { itemToBeCoded, NOPARAM, "NBin:", "NBin:", CAT_MENU, SLS_UNCHANGED},
/* 421 */ { itemToBeCoded, NOPARAM, "NEIGHB", "NEIGHB", CAT_FNCT, SLS_UNCHANGED},
/* 421 */ { fnNeighb, NOPARAM, "NEIGHB", "NEIGHB", CAT_FNCT, SLS_ENABLED },
/* 422 */ { itemToBeCoded, NOPARAM, "NEXTP", "NEXTP", CAT_FNCT, SLS_UNCHANGED},
/* 423 */ { fnCvtNmiM, multiply, "nmi." STD_RIGHT_ARROW "m", "nmi." STD_RIGHT_ARROW "m", CAT_FNCT, SLS_ENABLED },
/* 424 */ { fnNop, NOPARAM, "NOP", "NOP", CAT_FNCT, SLS_UNCHANGED},
......@@ -763,7 +763,7 @@ const item_t indexOfItems[] = {
/* 639 */ { itemToBeCoded, NOPARAM, "TVM", "TVM", CAT_MENU, SLS_UNCHANGED},
/* 640 */ { itemToBeCoded, NOPARAM, "t:", "t:", CAT_MENU, SLS_UNCHANGED},
/* 641 */ { itemToBeCoded, NOPARAM, "t" STD_LEFT_RIGHT_ARROWS, "t" STD_LEFT_RIGHT_ARROWS, CAT_FNCT, SLS_UNCHANGED},
/* 642 */ { itemToBeCoded, NOPARAM, "ULP?", "ULP?", CAT_FNCT, SLS_UNCHANGED},
/* 642 */ { fnUlp, NOPARAM, "ULP?", "ULP?", CAT_FNCT, SLS_ENABLED },
/* 643 */ { itemToBeCoded, NOPARAM, "U" STD_SUB_n, "U" STD_SUB_n, CAT_FNCT, SLS_UNCHANGED},
/* 644 */ { fnUnitVector, NOPARAM, "UNITV", "UNITV", CAT_FNCT, SLS_ENABLED },
/* 645 */ { fnIntegerMode, SIM_UNSIGN, "UNSIGN", "UNSIGN", CAT_FNCT, SLS_UNCHANGED},
......
......@@ -21,13 +21,6 @@
#include "wp43s.h"
/********************************************//**
* \brief (c, b, a) ==> (x1, x2, r) c ==> regL
* enables stack lift and refreshes the stack
*
* \param[in] unusedParamButMandatory uint16_t
* \return void
***********************************************/
void fnAgm(uint16_t unusedParamButMandatory) {
bool_t result16=true, realInput=true;
complex39_t a, b, c;
......
......@@ -18,4 +18,4 @@
* \file agm.h
***********************************************/
void fnAgm (uint16_t unusedButMandatoryParameter);
void fnAgm(uint16_t unusedButMandatoryParameter);
......@@ -61,6 +61,7 @@
#include "minusOnePow.h"
#include "modulo.h"
#include "multiplication.h"
#include "neighb.h"
#include "parallel.h"
#include "pcg_basic.h"
#include "power.h"
......@@ -82,6 +83,7 @@
#include "tanh.h"
#include "toPolar.h"
#include "toRect.h"
#include "ulp.h"
#include "unitVector.h"
#include "wp34s.h"
/* This file is part of 43S.
*
* 43S is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 43S is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with 43S. If not, see <http://www.gnu.org/licenses/>.
*/
/********************************************//**
* \file neighb.c
***********************************************/
#include "wp43s.h"
void fnNeighb(uint16_t unusedParamButMandatory) {
uint32_t dataTypeX, dataTypeY;
real39_t x, y;
longInteger_t lgIntX, lgIntY;
dataTypeX = getRegisterDataType(REGISTER_X);
dataTypeY = getRegisterDataType(REGISTER_Y);
if( dataTypeX == dtComplex16 || dataTypeY == dtComplex16
|| dataTypeX == dtAngle || dataTypeY == dtAngle
|| dataTypeX == dtTime || dataTypeY == dtTime
|| dataTypeX == dtDate || dataTypeY == dtDate
|| dataTypeX == dtString || dataTypeY == dtString
|| dataTypeX == dtReal16Matrix || dataTypeY == dtReal16Matrix
|| dataTypeX == dtComplex16Matrix || dataTypeY == dtComplex16Matrix
|| dataTypeX == dtComplex34 || dataTypeY == dtComplex34) {
displayCalcErrorMessage(ERROR_INVALID_DATA_INPUT_FOR_OP, ERR_REGISTER_LINE, REGISTER_X);
#if (EXTRA_INFO_ON_CALC_ERROR == 1)
sprintf(errorMessage, "cannot get the NEIGHB from %s", getRegisterDataTypeName(REGISTER_X, true, false));
sprintf(errorMessage + ERROR_MESSAGE_LENGTH/2, "towards %s", getRegisterDataTypeName(REGISTER_Y, true, false));
showInfoDialog("In function fnNeighb:", errorMessage, errorMessage + ERROR_MESSAGE_LENGTH/2, NULL);
#endif
return;
}
if( (dataTypeX == dtReal16 && real16IsNaN(REGISTER_REAL16_DATA(REGISTER_X)))
|| (dataTypeX == dtReal34 && real34IsNaN(REGISTER_REAL34_DATA(REGISTER_X)))) {
displayCalcErrorMessage(ERROR_ARG_EXCEEDS_FUNCTION_DOMAIN, ERR_REGISTER_LINE, REGISTER_X);
#if (EXTRA_INFO_ON_CALC_ERROR == 1)
showInfoDialog("In function fnNeighb:", "cannot use NaN as X or Y input of NEIGHB", NULL, NULL);
#endif
return;
}
saveStack();
copySourceRegisterToDestRegister(REGISTER_X, REGISTER_L);
switch(dataTypeX) {
case dtLongInteger:
convertLongIntegerRegisterToLongInteger(REGISTER_X, lgIntX);
switch(dataTypeY) {
case dtLongInteger:
convertLongIntegerRegisterToLongInteger(REGISTER_Y, lgIntY);
intToLongInteger(longIntegerCompare(lgIntY, lgIntX) == 0 ? 0 : (longIntegerCompare(lgIntY, lgIntX) > 0 ? 1 : -1), lgIntY);
break;
case dtReal16:
convertLongIntegerRegisterToReal(REGISTER_X, (real_t *)&x, &ctxtReal39);
real16ToReal(REGISTER_REAL16_DATA(REGISTER_Y), &y);
longIntegerInit(lgIntY);
intToLongInteger(real39CompareEqual(&y, &x) ? 0 : (real39CompareGreaterThan(&y, &x) ? 1 : -1), lgIntY);
break;
case dtShortInteger:
convertShortIntegerRegisterToLongInteger(REGISTER_Y, lgIntY);
intToLongInteger(longIntegerCompare(lgIntY, lgIntX) == 0 ? 0 : (longIntegerCompare(lgIntY, lgIntX) > 0 ? 1 : -1), lgIntY);
break;
case dtReal34:
convertLongIntegerRegisterToReal(REGISTER_X, (real_t *)&x, &ctxtReal39);
real34ToReal(REGISTER_REAL16_DATA(REGISTER_Y), &y);
longIntegerInit(lgIntY);
intToLongInteger(real39CompareEqual(&y, &x) ? 0 : (real39CompareGreaterThan(&y, &x) ? 1 : -1), lgIntY);
break;
default: {}
}
longIntegerAdd(lgIntX, lgIntY, lgIntX);
convertLongIntegerToLongIntegerRegister(lgIntX, REGISTER_X);
longIntegerFree(lgIntX);
longIntegerFree(lgIntY);
break;
case dtReal16:
real16ToReal(REGISTER_REAL16_DATA(REGISTER_X), &x);
switch(dataTypeY) {
case dtLongInteger: convertLongIntegerRegisterToReal(REGISTER_Y, (real_t *)&y, &ctxtReal39); break;
case dtReal16: real16ToReal(REGISTER_REAL16_DATA(REGISTER_Y), &y); break;
case dtShortInteger: convertShortIntegerRegisterToReal(REGISTER_Y, (real_t *)&y, &ctxtReal39); break;
case dtReal34: real34ToReal(REGISTER_REAL34_DATA(REGISTER_Y), &y); break;
default: {}
}
realNextToward(&x, &y, &x, &ctxtReal16);
realToReal16(&x, REGISTER_REAL16_DATA(REGISTER_X));
break;
case dtShortInteger:
convertShortIntegerRegisterToLongInteger(REGISTER_X, lgIntX);
switch(dataTypeY) {
case dtLongInteger:
convertLongIntegerRegisterToLongInteger(REGISTER_Y,