Changeset 2217


Ignore:
Timestamp:
Dec 31, 2006, 12:44:38 AM (14 years ago)
Author:
yura
Message:

Was error with '-0.1'. But still error in Refal with eIn1 in
QFromString \{

eIn1 '.' eIn2 =
{eIn1 : /*empty*/, '0'; eIn1;} :: eIn1,

...
eIn1 is '0' in any case.

Location:
to-imperative/trunk/samples/Rational
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/samples/Rational/Rational.rf

    r2216 r2217  
    55$use Convert;
    66$use Compare;
    7 $use StdIO;
    87
    98$func QSimplify s s = t;
     
    5352
    5453QFromString \{
    55   eIn1 '.' eIn2 = <WriteLN eIn1 <Length eIn1>>,
    56   {eIn1 : /*empty*/, <PrintLN "!"> '0'; eIn1;} :: eIn1,
     54  eIn1 '.' eIn2 =
     55  {eIn1 : /*empty*/, '0'; eIn1;} :: eIn1,
    5756  <Length eIn2> 1
    5857  $iter <"-" sN 1> <"*" sM 10> ::
    5958  sN sM, sN : 0 =
    60   <QAdd <To-Int eIn1> <QDiv <To-Int eIn2> sM>>;
     59  \{
     60    eIn1 : e '-' e = <QSub <To-Int eIn1> <QDiv <To-Int eIn2> sM>>;
     61    <QAdd <To-Int eIn1> <QDiv <To-Int eIn2> sM>>;
     62  };
    6163
    6264  /*empty*/ = (0 1);
  • to-imperative/trunk/samples/Rational/test.out

    r2215 r2217  
    22(0 1)
    33(0 1)
    4 (0 1)
     4(10 1)
    55(1 10)
    66(1 10)
     7(0 1)
     8(-10 1)
     9(-1 10)
    7100
    8110.3
    9120.3333333333
     13-2
     14-2.3
     15-2.3333333333
    10160
    11170.2
    12180.25
     19-1
     20-1.7
     21-1.75
  • to-imperative/trunk/samples/Rational/test.rf

    r2215 r2217  
    1111  <WriteLN <QFromString '0.10'>>,
    1212  <WriteLN <QFromString '.10'>>,
     13  <WriteLN <QFromString '-0.0'>>,
     14  <WriteLN <QFromString '-10.00'>>,
     15  <WriteLN <QFromString '-0.10'>>,
    1316  <PrintLN <QToString 0 (1 3)>>,
    1417  <PrintLN <QToString 1 (1 3)>>,
    1518  <PrintLN <QToString 10 (1 3)>>,
     19  <PrintLN <QToString 0 (-7 3)>>,
     20  <PrintLN <QToString 1 (-7 3)>>,
     21  <PrintLN <QToString 10 (-7 3)>>,
    1622  <PrintLN <QToString 0 (1 4)>>,
    1723  <PrintLN <QToString 1 (1 4)>>,
    18   <PrintLN <QToString 10 (1 4)>>;
     24  <PrintLN <QToString 10 (1 4)>>,
     25  <PrintLN <QToString 0 (-7 4)>>,
     26  <PrintLN <QToString 1 (-7 4)>>,
     27  <PrintLN <QToString 10 (-7 4)>>;
Note: See TracChangeset for help on using the changeset viewer.