Subversion Repositories HelenOS

Rev

Rev 264 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 264 Rev 266
Line 47... Line 47...
47
    int counter;
47
    int counter;
48
    int exponent,exponenttmp;
48
    int exponent,exponenttmp;
49
    unsigned char buf[DEFAULT_DOUBLE_BUFFER_SIZE];
49
    unsigned char buf[DEFAULT_DOUBLE_BUFFER_SIZE];
50
    unsigned long in1,in2; 
50
    unsigned long in1,in2; 
51
   
51
   
52
    /*
52
 
53
    if (fmath_is_nan(num)) {
53
    if (fmath_is_nan(num)) {
54
        print_str("NaN");
54
        print_str("NaN");
55
        return;
55
        return;
56
    }
56
    }
57
    */
-
 
58
   
57
   
59
    if (fmath_is_negative(num)) {
58
    if (num<0.0) {
60
        putchar('-');
59
        putchar('-');
-
 
60
        num=num*-1.0;
-
 
61
        }
-
 
62
 
-
 
63
 
-
 
64
    if (fmath_is_infinity(num)) {
-
 
65
        print_str("Inf");
-
 
66
        return;
61
        }
67
        }
62
   
-
 
63
    num=fmath_abs(num);
-
 
64
 
68
 
65
    if ((modifier=='E')||(modifier=='e')) {
69
    if ((modifier=='E')||(modifier=='e')) {
66
        intval2=fmath_fint(fmath_get_decimal_exponent(num),&intval);
70
        intval2=fmath_fint(fmath_get_decimal_exponent(num),&intval);
67
        exponent=intval;
71
        exponent=intval;
68
        if ((intval2<0.0)&&(exponent<0)) exponent--;
72
        if ((intval2<0.0)&&(exponent<0)) exponent--;
Line 76... Line 80...
76
            }
80
            }
77
        print_number(exponent,10);
81
        print_number(exponent,10);
78
        return;
82
        return;
79
        }
83
        }
80
       
84
       
81
 
-
 
82
    /*
-
 
83
    if (fmath_is_infinity(num)) {
-
 
84
        print_str("Inf");
-
 
85
        }
-
 
86
    */
-
 
87
    //TODO: rounding constant - when we got fraction >= 0.5, we must increment last printed number 
85
    //TODO: rounding constant - when we got fraction >= 0.5, we must increment last printed number 
88
 
86
 
89
    /* Here is problem with cumulative error while printing big double values -> we will divide
87
    /* Here is problem with cumulative error while printing big double values -> we will divide
90
    the number with a power of 10, print new number with better method for small numbers and then print decimal point at correct position */
88
    the number with a power of 10, print new number with better method for small numbers and then print decimal point at correct position */
91
   
89