Show
Ignore:
Timestamp:
08/21/09 16:05:08 (3 months ago)
Author:
jmaessen
Message:

[compiler, library, tests] Work on getting RR64 to run
(seems OK so far except for the usual warts that also hold for ZZ32;
eg literals don't support asString due to dotted method inheritance
bugs). Note that ZZ32 and RR64 arithmetic can't be commingled at all
at the moment.

Moved desugaring of loops and generalized if/while to occur before
type checking. This makes these constructs work the same way as
comprehensions and reductions, which had previously been shifted
earlier in compilation. Adjusted the desugarings to generate
_RewriteFnApp or MethodApplication? nodes rather than TightJuxts?. This
should improve future reliability of desugared code.

Added test of floating-point printing. Adjusted Compiled7fo to work
around obvious shortcomings in code generation. Codegen now crashes
on this program, probably due to an outstanding bug that's been
lurking for a long time. Addressing this is probably the next thing
to be done.

Location:
trunk/ProjectFortress/LibraryBuiltin
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/ProjectFortress/LibraryBuiltin/CompilerBuiltin.fsi

    r4089 r4112  
    6565end 
    6666 
    67 trait RR64 extends Number 
     67trait RR64 extends Number comprises { RR32 } 
    6868    asString(): String 
    6969    opr |self| : RR64 
     
    8080    opr /(self, other:RR64): RR64 
    8181    opr ^(self, other:RR64): RR64 
     82    opr ^(self, other:ZZ32): RR64 
    8283end 
    8384 
    84 trait RR32 extends RR64 
     85trait RR32 extends RR64 comprises { FloatLiteral } 
    8586end 
    8687 
  • trunk/ProjectFortress/LibraryBuiltin/CompilerBuiltin.fss

    r4089 r4112  
    9797end 
    9898 
    99 trait RR64 extends Number 
     99trait RR64 extends Number comprises { RR32 } 
    100100    asString(): String = jDoubleToString(self) 
    101101    opr |self| : RR64 = jDoubleAbs(self) 
     
    112112    opr /(self, other:RR64): RR64 = jDoubleDiv(self,other) 
    113113    opr ^(self, other:RR64): RR64 = jDoublePow(self,other) 
     114    opr ^(self, other:ZZ32): RR64 = 
     115        if other > 0 then 
     116            mid = other DIV 2 
     117            if (mid + mid) = other then 
     118                (self self)^mid 
     119            else 
     120                self (self^(mid-1)) 
     121            end 
     122        elif other = 0 then 1.0 
     123        else 1.0 / (self^(-other)) 
     124        end 
    114125end 
    115126 
    116 trait RR32 extends RR64 
     127trait RR32 extends RR64 comprises {FloatLiteral} 
    117128end 
    118129