Skip to content

Commit 841e63a

Browse files
committed
fixing buildfiles use
1 parent 636f3f5 commit 841e63a

16 files changed

+63
-72
lines changed

SRC/constructCode.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,14 +438,14 @@ FunctionResult HandleRelation(char* word1,char* op, char* word2,bool output,int&
438438
else if (*op == '<') result = (stricmp(arg1, arg2) < 0) ? NOPROBLEM_BIT : FAILRULE_BIT;
439439
else result = FAILRULE_BIT;
440440
}
441-
// handle float ops
441+
// handle double ops
442442
else if ((strchr(val1,'.') && val1[1]) || (strchr(val2,'.') && val2[1])) // at least one arg is float
443443
{
444444
char* comma = 0;
445445
while ((comma = strchr(val1,','))) memmove(comma,comma+1,strlen(comma+1)); // remove embedded commas
446446
while ((comma = strchr(val2,','))) memmove(comma,comma+1,strlen(comma+1)); // remove embedded commas
447-
float v1f = Convert2Float(val1);
448-
float v2f = Convert2Float(val2);
447+
double v1f = Convert2Float(val1);
448+
double v2f = Convert2Float(val2);
449449
if (*op == '=') result = (v1f == v2f) ? NOPROBLEM_BIT : FAILRULE_BIT;
450450
else if (*op == '<')
451451
{

SRC/dictionarySystem.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,8 +1102,8 @@ void ShowStats(bool reset)
11021102

11031103
unsigned int diff = (unsigned int) (ElapsedMilliseconds() - volleyStartTime);
11041104
unsigned int mspl = (inputSentenceCount) ? (diff/inputSentenceCount) : 0;
1105-
float fract = (float)(diff/1000.0); // part of seccond
1106-
float time = (float)(tokenCount/fract);
1105+
double fract = (double)(diff/1000.0); // part of seccond
1106+
double time = (double)(tokenCount/fract);
11071107
Log(ECHOSTDTRACELOG,(char*)"\r\nRead: %d sentences (%d tokens) in %d ms = %d ms/l or %f token/s\r\n",inputSentenceCount,tokenCount, diff,mspl,time);
11081108

11091109
Log(ECHOSTDTRACELOG,(char*)"used: rules=%d dict=%d fact=%d text=%d mark=%d\r\n",ruleCount,dictUsed,factUsed,textUsed,xrefCount);
@@ -3347,11 +3347,11 @@ char* FindCanonical(char* word, int i,bool notNew)
33473347
char word1[MAX_WORD_SIZE];
33483348
if (strchr(word,'.') || strlen(word) > 9) // big numbers need float
33493349
{
3350-
float y;
3350+
double y;
33513351
if (*word == '$') y = Convert2Float(word+1);
33523352
else y = Convert2Float(word);
33533353
int x = (int)y;
3354-
if (((float) x) == y) sprintf(word1,(char*)"%d",x); // use int where you can
3354+
if (((double) x) == y) sprintf(word1,(char*)"%d",x); // use int where you can
33553355
else sprintf(word1,(char*)"%1.2f", Convert2Float(word));
33563356
}
33573357
else if (GetCurrency((unsigned char*) word,number)) sprintf(word1,(char*)"%d",atoi(number));

SRC/english.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ uint64 GetPosData( int at, char* original,WORDP& revise, WORDP &entry,WORDP &can
567567
{
568568
int x = atoi(number);
569569
int y = atoi(fraction+1);
570-
float val = (float)((float)x / (float)y);
570+
double val = (double)((double)x / (double)y);
571571
val += basenumber;
572572
sprintf(number,(char*)"%1.2f",val);
573573
properties = ADJECTIVE|NOUN|ADJECTIVE_NUMBER|NOUN_NUMBER;
@@ -599,7 +599,7 @@ uint64 GetPosData( int at, char* original,WORDP& revise, WORDP &entry,WORDP &can
599599
entry = StoreWord(original,properties);
600600
if (at > 1 && start != at && IsNumber(wordStarts[at-1])) // fraction not place
601601
{
602-
float val = 1.0 / Convert2Integer(original);
602+
double val = 1.0 / Convert2Integer(original);
603603
sprintf(number, (char*)"%1.2f", val);
604604
}
605605
else sprintf(number,(char*)"%d",(int)Convert2Integer(original));
@@ -609,7 +609,7 @@ uint64 GetPosData( int at, char* original,WORDP& revise, WORDP &entry,WORDP &can
609609
else if (kind == FRACTION_NUMBER && strchr(original,'%'))
610610
{
611611
int64 val1 = atoi(original);
612-
float val = (float)(val1 / 100.0);
612+
double val = (double)(val1 / 100.0);
613613
sprintf(number,(char*)"%1.2f",val );
614614
properties = ADJECTIVE|NOUN|ADJECTIVE_NUMBER|NOUN_NUMBER;
615615
entry = StoreWord(original,properties);
@@ -625,13 +625,13 @@ uint64 GetPosData( int at, char* original,WORDP& revise, WORDP &entry,WORDP &can
625625
*br = 0;
626626
int64 val1 = Convert2Integer(original);
627627
int64 val2 = Convert2Integer(br+1);
628-
float val;
628+
double val;
629629
if (IsNumber(original) == FRACTION_NUMBER) // half-dozen
630630
{
631-
val = (float)(1.0 / (float) val1);
632-
val *= (float)val2; // one-half
631+
val = (double)(1.0 / (double) val1);
632+
val *= (double)val2; // one-half
633633
}
634-
else val = (float)((float)val1 / (float)val2); // one-half
634+
else val = (double)((double)val1 / (double)val2); // one-half
635635
sprintf(number,(char*)"%1.2f",val );
636636
properties = ADJECTIVE|NOUN|ADJECTIVE_NUMBER|NOUN_NUMBER;
637637
*br = c;
@@ -649,8 +649,8 @@ uint64 GetPosData( int at, char* original,WORDP& revise, WORDP &entry,WORDP &can
649649
unsigned char* currency = GetCurrency((unsigned char*)copy,value);
650650
if (currency > (unsigned char*)value) *currency = 0; // remove trailing currency
651651
int64 n = Convert2Integer(value);
652-
float fn = Convert2Float(value);
653-
if ((float)n == fn)
652+
double fn = Convert2Float(value);
653+
if ((double)n == fn)
654654
{
655655
#ifdef WIN32
656656
sprintf(number,(char*)"%I64d",n);
@@ -672,26 +672,26 @@ uint64 GetPosData( int at, char* original,WORDP& revise, WORDP &entry,WORDP &can
672672
else if (kind == FRACTION_NUMBER)
673673
{
674674
int64 val = Convert2Integer(original);
675-
float val1 = (float)1.0 / (float)val;
675+
double val1 = (double)1.0 / (double)val;
676676
sprintf(number,(char*)"%f",val1);
677677
properties = ADJECTIVE|NOUN|ADJECTIVE_NUMBER|NOUN_NUMBER | (baseflags & (PREDETERMINER|DETERMINER));
678678
}
679-
else // ordinary int, float and percent
679+
else // ordinary int, double and percent
680680
{
681681
len = strlen(original);
682682
bool percent = original[len - 1] == '%';
683683
if (percent) original[len - 1] = 0;
684684

685685
if (strchr(original,'.')) // floating
686686
{
687-
float val = Convert2Float(original);
687+
double val = Convert2Float(original);
688688
if (percent) val /= 100;
689689
sprintf(number,(char*)"%1.2f",val);
690690
}
691691
else if (percent)
692692
{
693693
int64 val = Convert2Integer(original);
694-
float val1 = ((float)val) / 100.0;
694+
double val1 = ((double)val) / 100.0;
695695
sprintf(number, (char*)"%1.2f", val1);
696696
}
697697
else

SRC/englishTagger.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,8 @@ static void SetCanonicalValue(int start,int end)
360360
if (IsUpperCase(*original)) canonicalUpper[i] = can;
361361
else canonicalLower[i] = can;
362362
}
363-
364-
if (canonicalLower[i] && originalLower[i])
363+
if (canonicalLower[i] && IsDigit(*canonicalLower[i]->word)) wordCanonical[i] = canonicalLower[i]->word; // leave numbers alone
364+
else if (canonicalLower[i] && originalLower[i])
365365
{
366366
if (posValues[i] & NOUN_SINGULAR && !(allOriginalWordBits[i] & NOUN_GERUND) && stricmp(canonicalLower[i]->word,(char*)"unknown-word")) // saw does not become see, it stays original - but singing should still be sing and "what do you think of dafatgat" should remain
367367
{

SRC/factSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,7 @@ void SortFacts(char* set, int alpha, int setpass) // sort low to high ^sort(@1
15091509
if (!kind) kind = 's';
15101510
int i;
15111511
int size = FACTSET_COUNT(n);
1512-
float floatValues[MAX_FIND+1];
1512+
double floatValues[MAX_FIND+1];
15131513
char* wordValues[MAX_FIND+1];
15141514

15151515
// load the actual array to compare
@@ -1532,7 +1532,7 @@ void SortFacts(char* set, int alpha, int setpass) // sort low to high ^sort(@1
15321532
for (i = 1; i <= size-1; ++i)
15331533
{
15341534
char* word = wordValues[i];
1535-
float tmp = floatValues[i];
1535+
double tmp = floatValues[i];
15361536
if (alpha == 1 && strcmp(word,wordValues[i+1]) > 0) {;}
15371537
else if (alpha == 2 && (char*)factSet[n] > (char*)factSet[n+1]) {;}
15381538
else if (alpha == 0 && tmp > floatValues[i+1]) {;}

SRC/functionExecute.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3089,9 +3089,9 @@ static FunctionResult ComputeCode(char* buffer)
30893089

30903090
{
30913091
FLOAT:
3092-
float fvalue = (float) NOT_A_NUMBER;
3093-
float number1 = (strchr(arg1,'.')) ? Convert2Float(arg1) : (float)Convert2Integer(arg1);
3094-
float number2 = (strchr(arg2,'.')) ? Convert2Float(arg2) : (float)Convert2Integer(arg2);
3092+
double fvalue = (double) NOT_A_NUMBER;
3093+
double number1 = (strchr(arg1,'.')) ? Convert2Float(arg1) : (double)Convert2Integer(arg1);
3094+
double number2 = (strchr(arg2,'.')) ? Convert2Float(arg2) : (double)Convert2Integer(arg2);
30953095
// we must test case insenstive because arg2 might be capitalized (like add and ADD for attention deficit disorder)
30963096
if (*op == '+' || !stricmp(op,(char*)"plus") || !stricmp(op,(char*)"add")|| !stricmp(op,(char*)"and")) fvalue = number1 + number2;
30973097
else if (!stricmp(op,(char*)"minus") || !stricmp(op,(char*)"subtract")|| !stricmp(op,(char*)"deduct")|| !stricmp(op,(char*)"take away") || *op == '-' ) fvalue = number1 - number2;
@@ -3115,7 +3115,7 @@ static FunctionResult ComputeCode(char* buffer)
31153115
ReportBug((char*)"illegal random op in float")
31163116
return FAILRULE_BIT;
31173117
}
3118-
else if (!stricmp(op,(char*)"root") || !stricmp(op,(char*)"square_root") ) fvalue = (float) sqrt(number1);
3118+
else if (!stricmp(op,(char*)"root") || !stricmp(op,(char*)"square_root") ) fvalue = (double) sqrt(number1);
31193119
else if (!stricmp(op,(char*)"^") || !stricmp(op,(char*)"^^") ||!stricmp(op,(char*)"power") || !stricmp(op,(char*)"exponent"))
31203120
{
31213121
int power = (int)Convert2Integer(arg2);
@@ -3131,7 +3131,7 @@ static FunctionResult ComputeCode(char* buffer)
31313131
{
31323132
long x = (long) fvalue;
31333133

3134-
if ((float)x == fvalue)
3134+
if ((double)x == fvalue)
31353135
{
31363136
#ifdef WIN32
31373137
sprintf(buffer,(char*)"%I64d",(long long int) x);
@@ -5453,11 +5453,11 @@ static FunctionResult POSCode(char* buffer)
54535453
char* period = strchr(arg2,'.');
54545454
if (period)
54555455
{
5456-
float val = Convert2Float(arg2);
5456+
double val = Convert2Float(arg2);
54575457
*period = 0;
54585458
int64 vali;
54595459
ReadInt64(arg2,vali);
5460-
if ((float) vali == val) strcpy(buffer,arg2);
5460+
if ((double) vali == val) strcpy(buffer,arg2);
54615461
}
54625462
return NOPROBLEM_BIT;
54635463
}
@@ -8268,7 +8268,7 @@ SystemFunctionInfo systemFunctionSet[] =
82688268
{ (char*)"^wordAtIndex",WordAtIndexCode,2,SAMELINE,(char*)"1st arg original canonical, Get word at index" },
82698269
{ (char*)"\r\n---- Numbers",0,0,0,(char*)""},
82708270
{ (char*)"^compute",ComputeCode,3,SAMELINE,(char*)"perform a numerical computation"},
8271-
{ (char*)"^isnumber",IsNumberCode,1,SAMELINE,(char*)"is this an integer or float number or currency"},
8271+
{ (char*)"^isnumber",IsNumberCode,1,SAMELINE,(char*)"is this an integer or double number or currency"},
82728272
{ (char*)"^timefromseconds",TimeFromSecondsCode,VARIABLE_ARG_COUNT,SAMELINE,(char*)"given time/date in seconds, return the timeinfo string corresponding to it"},
82738273
{ (char*)"^timeinfofromseconds",TimeInfoFromSecondsCode,1,SAMELINE,(char*)"given time/date in seconds, returning a sequence of 6 matchvariables (sec min hr date mo yr)"},
82748274
{ (char*)"^timetoseconds",TimeToSecondsCode,VARIABLE_ARG_COUNT,SAMELINE,(char*)"given time/date a series of 6 values (sec min hr date mo yr), return the timeinfo string corresponding to it"},

SRC/markSystem.cpp

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -712,29 +712,34 @@ void MarkAllImpliedWords()
712712
if (IsDigit(*wordStarts[i]) && IsDigit(wordStarts[i][1]) && IsDigit(wordStarts[i][2]) && IsDigit(wordStarts[i][3]) && !wordStarts[i][4]) MarkFacts(ucase,MakeMeaning(FindWord((char*)"~yearnumber")),i,i);
713713
}
714714

715-
if (IsDigit(*wordStarts[i]))
715+
if (IsNumber(wordStarts[i]))
716716
{
717717
if (!wordCanonical[i][1] || !wordCanonical[i][2]) // 2 digit or 1 digit
718718
{
719719
int n = atoi(wordCanonical[i]);
720720
if (n > 0 && n < 32 && *wordStarts[i] != '$') MarkFacts(ucase, MakeMeaning(FindWord((char*)"~daynumber")), i, i);
721721
}
722722

723-
}
724-
725-
if (IsDigit(wordCanonical[i][0])) // cannot trust postag of ADJECTIVE_NUMBER or NOUN_NUMBER
726-
{
727723
if (IsDigit(*wordStarts[i]) && IsDigit(wordStarts[i][1]) && IsDigit(wordStarts[i][2]) && IsDigit(wordStarts[i][3]) && !wordStarts[i][4]) MarkFacts(ucase,MakeMeaning(FindWord((char*)"~yearnumber")),i,i);
728724

729725
MarkFacts(ucase,Mnumber,i,i);
730726

727+
// let's mark kind of number also
728+
if (strchr(wordCanonical[i], '.')) MarkFacts(ucase, MakeMeaning(StoreWord("~float")), i, i, true);
729+
else
730+
{
731+
MarkFacts(ucase, MakeMeaning(StoreWord("~integer")), i, i, true);
732+
if (*wordStarts[i] != '-') MarkFacts(ucase, MakeMeaning(StoreWord("~positiveInteger")), i, i, true);
733+
else MarkFacts(ucase, MakeMeaning(StoreWord("~negativeinteger")), i, i, true);
734+
}
735+
731736
// handle finding fractions as 3 token sequence mark as placenumber
732737
if (i < wordCount && *wordStarts[i+1] == '/' && wordStarts[i+1][1] == 0 && IsDigitWord(wordStarts[i+2]) )
733738
{
734739
MarkFacts(ucase,MakeMeaning(Dplacenumber),i,i);
735740
if (trace & TRACE_PREPARE || prepareMode == PREPARE_MODE) Log(STDTRACELOG,(char*)"=%s/%s \r\n",wordStarts[i],wordStarts[i+2]);
736741
}
737-
else if (IsDigit(*wordStarts[i]) && IsPlaceNumber(wordStarts[i])) // finalPosValues[i] & (NOUN_NUMBER | ADJECTIVE_NUMBER)
742+
else if (IsPlaceNumber(wordStarts[i])) // finalPosValues[i] & (NOUN_NUMBER | ADJECTIVE_NUMBER)
738743
{
739744
MarkFacts(ucase,MakeMeaning(Dplacenumber),i,i);
740745
}
@@ -847,20 +852,6 @@ void MarkAllImpliedWords()
847852
// mark upper case canonical
848853
StdMark(MakeTypedMeaning(CU,0, NOUN), i, i,true);
849854

850-
// canonical word is a number (maybe we didn't register original right) eg. "how much is 24 and *seven"
851-
if ((IsDigit(*wordCanonical[i]) || *wordCanonical[i] == '-') && IsNumber(wordCanonical[i]))
852-
{
853-
MarkFacts(ucase,Mnumber,i,i,true);
854-
// let's mark kind of number also
855-
if (strchr(wordStarts[i],'.')) MarkFacts(ucase,MakeMeaning(StoreWord("~float")),i,i,true);
856-
else
857-
{
858-
MarkFacts(ucase,MakeMeaning(StoreWord("~integer")),i,i,true);
859-
if (*wordStarts[i] != '-') MarkFacts(ucase,MakeMeaning(StoreWord("~positiveInteger")),i,i,true);
860-
else MarkFacts(ucase,MakeMeaning(StoreWord("~negativeinteger")),i,i,true);
861-
}
862-
}
863-
864855
if (trace & TRACE_PREPARE || prepareMode == PREPARE_MODE) Log(STDTRACELOG,(char*)" "); // close canonical form uppercase
865856
markLength = 0;
866857

SRC/os.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,7 @@ unsigned int Log(unsigned int channel,const char * fmt, ...)
16641664
else if (*ptr == 'p') sprintf(at,(char*)"%p",va_arg(ap,char*)); // ptr
16651665
else if (*ptr == 'f')
16661666
{
1667-
float f = (float)va_arg(ap,double);
1667+
double f = (double)va_arg(ap,double);
16681668
sprintf(at,(char*)"%f",f); // float
16691669
}
16701670
else if (*ptr == 's') // string

SRC/outputSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ char* StdIntOutput(int n)
433433
return answer;
434434
}
435435

436-
char* StdFloatOutput(float n)
436+
char* StdFloatOutput(double n)
437437
{
438438
char buffer[50];
439439
static char answer[50];

SRC/outputSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern unsigned int maxOutputUsed;
2727

2828
// styles of output
2929
char* StdIntOutput(int n);
30-
char* StdFloatOutput(float n);
30+
char* StdFloatOutput(double n);
3131
void ReformatString(char starter,char* word,char*& buffer,FunctionResult& result,unsigned int controls = 0,char* space = NULL);
3232

3333
// output buffer management

0 commit comments

Comments
 (0)