Changeset a4cef35 in tol


Ignore:
Timestamp:
Jul 10, 2011, 12:39:30 PM (15 years ago)
Author:
Jorge Pérez <josp.jorge@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
8683c44
Parents:
d445cda
Message:

closes #1004, la representación Text de los infinitos 1/0 y -1/0 es evaluable en la gramática Real dando como resultado el Real correspondiente.

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@3683 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/bmath/mathobjects/dat.cpp

    rd445cda ra4cef35  
    11191119//--------------------------------------------------------------------
    11201120{
    1121   BText txt, bformat_out;
    1122   char format_in[80], format_out[80], str_in[1024], str_out[1024];
    11231121  if(Known())
    11241122  {
    1125     int i,j;
    1126     setlocale( LC_NUMERIC, TOL_lc_numeric());
    1127     strcpy(format_in, format.String());
    1128     for(i=0, j=0; format_in[i]!='\0'; i++)
    1129     {
    1130       if(format_in[i]!='\'')
    1131       { format_out[j++] = format_in[i]; }
     1123    if ( IsFinite() ) {
     1124      BText txt, bformat_out;
     1125      char format_in[80], format_out[80], str_in[1024], str_out[1024];
     1126      int i,j;
     1127      setlocale( LC_NUMERIC, TOL_lc_numeric());
     1128      strcpy(format_in, format.String());
     1129      for(i=0, j=0; format_in[i]!='\0'; i++)
     1130        {
     1131          if(format_in[i]!='\'')
     1132            { format_out[j++] = format_in[i]; }
     1133        }
     1134      format_out[j++] = '\0';
     1135      bformat_out = format_out;
     1136      //txt.Copy(Value(), format.String());
     1137      txt.Copy(Value(), bformat_out);
     1138      strcpy(str_in, txt.Buffer());
     1139      markThousands(str_out, str_in);
     1140      txt = str_out;
     1141      setlocale( LC_NUMERIC, "C");
     1142      //  if(Value()==floor(Value())) { txt.Copy(BInt(Value())); }
     1143      return txt;
     1144    } else if ( IsPosInf() ) {
     1145      return "1/0";
     1146    } else if ( IsNegInf() ) {
     1147      return "-1/0";
     1148    } else {
     1149      return "?";
    11321150    }
    1133     format_out[j++] = '\0';
    1134     bformat_out = format_out;
    1135     //txt.Copy(Value(), format.String());
    1136     txt.Copy(Value(), bformat_out);
    1137     strcpy(str_in, txt.Buffer());
    1138     markThousands(str_out, str_in);
    1139     txt = str_out;
    1140     setlocale( LC_NUMERIC, "C");
    1141     //  if(Value()==floor(Value())) { txt.Copy(BInt(Value())); }
    1142   }
    1143   else { txt="?"; }
    1144   return(txt);
     1151  }
     1152  else { return "?"; }
    11451153}
    11461154
Note: See TracChangeset for help on using the changeset viewer.