Remove REAL_HALF as it doesn't actually implement a half precision float
authorSam Moore <[email protected]>
Fri, 11 Apr 2014 09:31:41 +0000 (17:31 +0800)
committerSam Moore <[email protected]>
Fri, 11 Apr 2014 09:31:41 +0000 (17:31 +0800)
More to it than just masking bits because the sizes of the exponent differ.
Could just mask bits in the mantissa but I have horrible plans involving VFPU...

.gitignore
src/real.h
src/tests/vfpufloat.cpp

index 365a631..da6ac03 100644 (file)
@@ -5,3 +5,4 @@
 *.test
 *.out
 *.err
 *.test
 *.out
 *.err
+*.vcd
index 5703671..73aca6d 100644 (file)
@@ -16,41 +16,7 @@ namespace IPDF
 #elif defined REAL_DOUBLE
        typedef double Real;
        inline double Float(Real r) {return r;}
 #elif defined REAL_DOUBLE
        typedef double Real;
        inline double Float(Real r) {return r;}
-#elif defined REAL_HALF
-       struct Real
-       {
-               Real() = default;
-               Real(double r) : value(r) 
-               {
-                       int & a = *((int*)(&value)); // um...
-                       // mask out extra bits in exponent
-                        //1000 1111 1000 0000 0000 0011 1111 1111
-                       // Endianness matters
-                       a &= 0xFFC001F1; //0x8F8003FF;
-
-               }       
-       
-               Real operator+(float f) const {return Real(value+f);}
-               Real operator-(float f) const {return Real(value+f);}
-               Real operator/(float f) const {return Real(value/f);}
-               Real operator*(float f) const {return Real(value*f);}
-               Real operator+(const Real & r) const {return Real(this->value + r.value);}
-               Real operator-(const Real & r) const {return Real(this->value - r.value);}
-               Real operator*(const Real & r) const {return Real(this->value * r.value);}
-               Real operator/(const Real & r) const {return Real(this->value / r.value);}
-               Real & operator+=(const Real & r) {this->value += r.value; return *this;}
-               Real & operator-=(const Real & r) {this->value -= r.value; return *this;}
-               Real & operator/=(const Real & r) {this->value /= r.value; return *this;}
-               Real & operator*=(const Real & r) {this->value *= r.value; return *this;}
-
-               float value;
-       };
-       inline float Float(Real r) {return r.value;}
-
-       inline std::ostream & operator<<(std::ostream & os, Real & r) {return os << r.value;} // yuk
-
-#endif //REAL_HALF
-
+#endif
 }
 
 #endif //_REAL_H
 }
 
 #endif //_REAL_H
index 5f89a66..dae457b 100644 (file)
@@ -6,7 +6,10 @@ using namespace std;
 
 int main(int argc, char ** argv)
 {
 
 int main(int argc, char ** argv)
 {
-       VFPU::Start();
+       if (argc > 1)
+               VFPU::Start(argv[1]);
+       else
+               VFPU::Start();
        float result = VFPU::Exec(25,10, VFPU::SUB);
        Debug("%f\n", result);
        VFPU::Halt();
        float result = VFPU::Exec(25,10, VFPU::SUB);
        Debug("%f\n", result);
        VFPU::Halt();

UCC git Repository :: git.ucc.asn.au