| 7 |
|
* 2/2/95 Greg Ward |
| 8 |
|
*/ |
| 9 |
|
|
| 10 |
– |
#include <stdio.h> |
| 10 |
|
#include <stdlib.h> |
| 12 |
– |
#include <string.h> |
| 11 |
|
#include <math.h> |
| 12 |
|
#include <ctype.h> |
| 15 |
– |
#include <sys/types.h> |
| 13 |
|
|
| 14 |
|
#include "rtprocess.h" /* getpid() */ |
| 15 |
|
#include "rtmath.h" |
| 17 |
|
|
| 18 |
|
#define isdelim(c) (isspace(c) || (c)==',') |
| 19 |
|
|
| 20 |
< |
#define MAXTAB 1024 /* maximum number of data rows */ |
| 21 |
< |
#define MAXLINE 4096 /* maximum line width (characters) */ |
| 20 |
> |
#define MAXTAB 8192 /* maximum number of data rows */ |
| 21 |
> |
#define MAXLINE 16384 /* maximum line width (characters) */ |
| 22 |
|
#define OUTFMT "%.7g" /* output format conversion string */ |
| 23 |
|
|
| 24 |
|
int interpolate = 0; |
| 156 |
|
printf("X`%s(i):select(i,", locID); |
| 157 |
|
putlist(abscissa, tabsize, 20); |
| 158 |
|
puts(");"); |
| 159 |
< |
if (increasing) { |
| 159 |
> |
if (increasing) |
| 160 |
> |
printf("fx2`%s(x,i):if(x-X`%s(i),\n", locID, locID); |
| 161 |
> |
else |
| 162 |
> |
printf("fx2`%s(x,i):if(X`%s(i)-x,\n", locID, locID); |
| 163 |
> |
printf("\ti+(x-X`%s(i))/(X`%s(i+1)-X`%s(i)),\n", |
| 164 |
> |
locID, locID, locID); |
| 165 |
> |
printf("\tfx2`%s(x,i-1));\n", locID); |
| 166 |
> |
if (increasing) |
| 167 |
|
printf("fx`%s(x):if(x-%g,if(%g-x,fx2`%s(x,%d),%d),1);\n", |
| 168 |
|
locID, abscissa[0], abscissa[tabsize-1], |
| 169 |
|
locID, tabsize, tabsize); |
| 170 |
< |
printf("fx2`%s(x,i):if(x-X`%s(i),\n", locID, locID); |
| 167 |
< |
} else { |
| 170 |
> |
else |
| 171 |
|
printf("fx`%s(x):if(%g-x,if(x-%g,fx2`%s(x,%d),%d),1);\n", |
| 172 |
|
locID, abscissa[0], abscissa[tabsize-1], |
| 173 |
|
locID, tabsize, tabsize); |
| 171 |
– |
printf("fx2`%s(x,i):if(X`%s(i)-x,\n", locID, locID); |
| 172 |
– |
} |
| 173 |
– |
printf("\ti+(x-X`%s(i))/(X`%s(i+1)-X`%s(i)),\n", |
| 174 |
– |
locID, locID, locID); |
| 175 |
– |
printf("\tfx2`%s(x,i-1));\n", locID); |
| 174 |
|
sprintf(ourexp, "fx`%s(x)", locID); |
| 175 |
|
} |
| 176 |
|
return(ourexp); |