--- gforth/Attic/primitives 1995/01/19 19:43:48 1.31 +++ gforth/Attic/primitives 1995/01/24 17:31:23 1.32 @@ -911,7 +911,7 @@ w2 = (Cell)fopen(cstr(c_addr, u, 1), fil wior = FILEEXIST(w2 == NULL); create-file c_addr u ntype -- w2 wior file create_file -Cell fd; +int fd; fd = creat(cstr(c_addr, u, 1), 0644); if (fd > -1) { #ifdef __osf__ @@ -1102,10 +1102,10 @@ else represent r c_addr u -- n f1 f2 float char *sig; -Cell flag; -Cell decpt; +int flag; +int decpt; sig=ecvt(r, u, &decpt, &flag); -n=decpt; +n=(Cell)(r==0 ? 1 : decpt); f1=FLAG(flag!=0); f2=FLAG(isdigit(sig[0])!=0); memmove(c_addr,sig,u); @@ -1115,33 +1115,33 @@ memmove(c_addr,sig,u); Float r; char *number=cstr(c_addr, u, 1); char *endconv; -while(isspace(number[u-1])) u--; -switch(number[u-1]) +while(isspace(number[--u]) && u>0); +switch(number[u]) { - case 'd': - case 'D': - case 'e': - case 'E': u--; break; - default: break; + case 'd': + case 'D': + case 'e': + case 'E': break; + default : u++; break; } number[u]='\0'; r=strtod(number,&endconv); if((flag=FLAG(!(Cell)*endconv))) { - IF_FTOS(fp[0] = FTOS); - fp += -1; - FTOS = r; + IF_FTOS(fp[0] = FTOS); + fp += -1; + FTOS = r; } else if(*endconv=='d' || *endconv=='D') { - *endconv='E'; - r=strtod(number,&endconv); - if((flag=FLAG(!(Cell)*endconv))) - { - IF_FTOS(fp[0] = FTOS); - fp += -1; - FTOS = r; - } + *endconv='E'; + r=strtod(number,&endconv); + if((flag=FLAG(!(Cell)*endconv))) + { + IF_FTOS(fp[0] = FTOS); + fp += -1; + FTOS = r; + } } fabs r1 -- r2 float-ext @@ -1217,24 +1217,39 @@ r2 = sqrt(r1); ftan r1 -- r2 float-ext r2 = tan(r1); +: + fsincos f/ ; fsinh r1 -- r2 float-ext r2 = sinh(r1); +: + fexpm1 fdup fdup 1. d>f f+ f/ f+ f2/ ; fcosh r1 -- r2 float-ext r2 = cosh(r1); +: + fexp fdup 1/f f+ f2/ ; ftanh r1 -- r2 float-ext r2 = tanh(r1); +: + f2* fexpm1 fdup 2. d>f f+ f/ ; fasinh r1 -- r2 float-ext r2 = asinh(r1); +: + fdup fdup f* 1. d>f f+ fsqrt f/ fatanh ; facosh r1 -- r2 float-ext r2 = acosh(r1); +: + fdup fdup f* 1. d>f f- fsqrt f+ fln ; fatanh r1 -- r2 float-ext r2 = atanh(r1); +: + fdup f0< >r fabs 1. d>f fover f- f/ f2* flnp1 f2/ + r> IF fnegate THEN ; \ The following words access machine/OS/installation-dependent ANSI \ figForth internals