version 1.6, 2000/12/13 10:54:09 |
version 1.12, 2001/03/15 05:52:12 |
|
|
* OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY |
* OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* $OpenXM: OpenXM_contrib2/asir2000/io/spexpr.c,v 1.5 2000/11/08 08:02:51 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/io/spexpr.c,v 1.11 2001/03/13 01:10:27 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "al.h" |
#include "al.h" |
Line 104 extern char DFORMAT[BUFSIZ]; |
|
Line 104 extern char DFORMAT[BUFSIZ]; |
|
extern int hex_output; |
extern int hex_output; |
extern int fortran_output; |
extern int fortran_output; |
extern int double_output; |
extern int double_output; |
|
extern int real_digit; |
|
|
#define TAIL while ( *OUT ) OUT++; |
#define TAIL while ( *OUT ) OUT++; |
#define PUTS(s) strcat(OUT,s) |
#define PUTS(s) strcat(OUT,s) |
|
|
P p; |
P p; |
{ |
{ |
if ( NUM(p) ) |
if ( NUM(p) ) |
|
#if defined(INTERVAL) |
|
if ( NID(p) != N_IP && compnum(CO,(Num)p,0) < 0 ) |
|
#else |
if ( compnum(CO,(Num)p,0) < 0 ) |
if ( compnum(CO,(Num)p,0) < 0 ) |
|
#endif |
return ( 1 ); |
return ( 1 ); |
else |
else |
return ( 0 ); |
return ( 0 ); |
|
|
void printbf(a) |
void printbf(a) |
BF a; |
BF a; |
{ |
{ |
sor(a->body,'g',-1,0); |
sor(a->body,double_output ? 'f' : 'g',-1,0); |
} |
} |
#endif |
#endif |
#endif |
#endif |
|
|
} |
} |
|
|
#if PARI |
#if PARI |
|
#include "genpari.h" |
|
|
|
void myoutbrute(g) |
|
GEN g; |
|
{ |
|
bruteall(g,'f',-1,1); |
|
} |
|
|
void sprintbf(a) |
void sprintbf(a) |
BF a; |
BF a; |
{ |
{ |
char *str; |
char *str; |
char *GENtostr(); |
char *GENtostr(); |
|
char *GENtostr0(); |
|
|
str = GENtostr(a->body); |
if ( double_output ) { |
|
str = GENtostr0(a->body,myoutbrute); |
|
} else { |
|
str = GENtostr(a->body); |
|
} |
TAIL PRINTF(OUT,"%s",str); |
TAIL PRINTF(OUT,"%s",str); |
free(str); |
free(str); |
} |
} |
|
|
} |
} |
} |
} |
|
|
|
extern int printmode; |
|
|
void PRINTNUM(q) |
void PRINTNUM(q) |
Num q; |
Num q; |
{ |
{ |
|
char real_format[20]; |
|
|
if ( !q ) { |
if ( !q ) { |
PUTS("0"); |
PUTS("0"); |
return; |
return; |
|
|
} |
} |
break; |
break; |
case N_R: |
case N_R: |
TAIL PRINTF(OUT,double_output?"%f":"%g",BDY((Real)q)); |
switch (printmode) { |
|
case PRINTF_E: |
|
#if defined(INTERVAL) |
|
case MID_PRINTF_E: |
|
#endif |
|
TAIL PRINTF(OUT,"%.15e",BDY((Real)q)); |
|
break; |
|
case PRINTF_G: |
|
#if defined(INTERVAL) |
|
case MID_PRINTF_G: |
|
#endif |
|
default: |
|
if ( real_digit ) { |
|
sprintf(real_format, |
|
double_output?"%%.%df":"%%.%dg",real_digit); |
|
TAIL PRINTF(OUT,real_format,BDY((Real)q)); |
|
} else { |
|
TAIL PRINTF(OUT,double_output?"%f":"%g",BDY((Real)q)); |
|
} |
|
break; |
|
} |
break; |
break; |
case N_A: |
case N_A: |
PUTS("("); PRINTR(ALG,(R)BDY((Alg)q)); PUTS(")"); |
PUTS("("); PRINTR(ALG,(R)BDY((Alg)q)); PUTS(")"); |
|
|
case N_B: |
case N_B: |
PRINTBF((BF)q); break; |
PRINTBF((BF)q); break; |
#endif |
#endif |
|
#if defined(INTERVAL) |
|
case N_IP: |
|
case N_IF: |
|
PUTS("["); |
|
PRINTNUM(INF((Itv)q)); |
|
PUTS(","); |
|
PRINTNUM(SUP((Itv)q)); |
|
PUTS("]"); |
|
break; |
|
case N_ID: |
|
switch (printmode) { |
|
case PRINTF_E: |
|
TAIL PRINTF(OUT, "[%.16e,%.16e]",INF((ItvD)q),SUP((ItvD)q)); |
|
#if defined(ITVDEBUG) |
|
printbin(INF((ItvD)q)); |
|
printbin(SUP((ItvD)q)); |
|
#endif |
|
break; |
|
case MID_PRINTF_G: |
|
TAIL PRINTF(OUT, "<%g,%g>", (SUP((ItvD)q)+INF((ItvD)q))*0.5,(SUP((ItvD)q)-INF((ItvD)q))*0.5); |
|
break; |
|
case MID_PRINTF_E: |
|
TAIL PRINTF(OUT, "<%.16e,%.16e>", (SUP((ItvD)q)+INF((ItvD)q))*0.5,(SUP((ItvD)q)-INF((ItvD)q))*0.5); |
|
break; |
|
case PRINTF_G: |
|
default: |
|
TAIL PRINTF(OUT, "[%g,%g]",INF((ItvD)q),SUP((ItvD)q)); |
|
break; |
|
} |
|
break; |
|
#endif |
case N_C: |
case N_C: |
PRINTCPLX((C)q); break; |
PRINTCPLX((C)q); break; |
case N_M: |
case N_M: |
|
|
case N_GFPN: |
case N_GFPN: |
PRINTUP((UP)(((GFPN)q)->body)); |
PRINTUP((UP)(((GFPN)q)->body)); |
break; |
break; |
|
case N_GFS: |
|
TAIL PRINTF(OUT,"@_%d",CONT((GFS)q)); break; |
} |
} |
} |
} |
|
|
Line 629 BYTEARRAY array; |
|
Line 704 BYTEARRAY array; |
|
unsigned char *b; |
unsigned char *b; |
|
|
len = array->len; |
len = array->len; |
b =array->body; |
b = array->body; |
PUTS("|"); |
PUTS("|"); |
for ( i = 0; i < len-1; i++ ) { |
for ( i = 0; i < len-1; i++ ) { |
TAIL PRINTF(OUT,"%02x ",b[i]); |
TAIL PRINTF(OUT,"%02x ",(unsigned int)b[i]); |
} |
} |
TAIL PRINTF(OUT,"%02x",b[i]); |
TAIL PRINTF(OUT,"%02x",(unsigned int)b[i]); |
PUTS("|"); |
PUTS("|"); |
} |
} |
|
|