Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Multiplying NaN*Inf returns NaN, as Inf*NaN already did. Add related test cases. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
04dad0b7c9af7dd60df9f3e2794ba9ea |
User & Date: | peterreid 2013-07-06 22:43:09.751 |
Context
2013-07-06
| ||
22:55 | Remove unused variables from sqlite4_num_mul. check-in: 1d4a5055fa user: peterreid tags: trunk | |
22:43 | Multiplying NaN*Inf returns NaN, as Inf*NaN already did. Add related test cases. check-in: 04dad0b7c9 user: peterreid tags: trunk | |
04:15 | Remove no-longer-used P4_REAL type for VdbeOp, which has been replaced by P4_NUM. check-in: 960d38f214 user: peterreid tags: trunk | |
Changes
Changes to src/math.c.
︙ | ︙ | |||
145 146 147 148 149 150 151 | sqlite4_num nan = {0, 0, SQLITE4_MX_EXP+1, 0}; unsigned char sign; /* Sign of the overall value */ unsigned char approx; /* True if the value is approximate */ short e; /* The exponent. */ sqlite4_uint64 m; /* The significant */ sqlite4_num r; | | | | < < | < | | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | sqlite4_num nan = {0, 0, SQLITE4_MX_EXP+1, 0}; unsigned char sign; /* Sign of the overall value */ unsigned char approx; /* True if the value is approximate */ short e; /* The exponent. */ sqlite4_uint64 m; /* The significant */ sqlite4_num r; if( A.e>SQLITE4_MX_EXP || B.e>SQLITE4_MX_EXP ){ r.sign = A.sign ^ B.sign; r.m = (A.m && B.m) ? 1 : 0; r.e = SQLITE4_MX_EXP+1; r.approx = 0; return r; } if( A.m==0 ) return A; if( B.m==0 ) return B; while( A.m%10==0 ){ A.m /= 10; A.e++; } while( B.m%10==0 ){ B.m /= 10; B.e++; } r.sign = A.sign ^ B.sign; r.approx = A.approx | B.approx; |
︙ | ︙ |
Changes to test/num.test.
︙ | ︙ | |||
69 70 71 72 73 74 75 76 77 78 79 80 81 82 | do_test num-4.2.1 { sqlite4_num_compare [sqlite4_num_sub 1 1] [sqlite4_num_sub -1 -1] } {equal} do_test num-5.1.1 { sqlite4_num_to_text [sqlite4_num_mul 9 8] } {72} do_test num-6.1.1 { sqlite4_num_to_text [sqlite4_num_div 6 5] } {1.2} do_test num-6.1.2 { sqlite4_num_compare 2 [sqlite4_num_div 2 1] } {equal} | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | do_test num-4.2.1 { sqlite4_num_compare [sqlite4_num_sub 1 1] [sqlite4_num_sub -1 -1] } {equal} do_test num-5.1.1 { sqlite4_num_to_text [sqlite4_num_mul 9 8] } {72} do_test num-5.1.2 { sqlite4_num_to_text [sqlite4_num_mul NaN inf] } {NaN} do_test num-5.1.3 { sqlite4_num_to_text [sqlite4_num_mul inf NaN] } {NaN} do_test num-5.1.4 { sqlite4_num_to_text [sqlite4_num_mul inf 0] } {NaN} do_test num-5.1.5 { sqlite4_num_to_text [sqlite4_num_mul inf -inf] } {-inf} do_test num-5.1.6 { sqlite4_num_to_text [sqlite4_num_mul NaN 0] } {NaN} do_test num-5.1.7 { sqlite4_num_to_text [sqlite4_num_mul NaN 1] } {NaN} do_test num-5.1.8 { sqlite4_num_to_text [sqlite4_num_mul NaN -9] } {NaN} do_test num-5.1.9 { sqlite4_num_to_text [sqlite4_num_mul NaN NaN] } {NaN} do_test num-5.1.10 { sqlite4_num_to_text [sqlite4_num_mul inf 3] } {inf} do_test num-5.1.11 { sqlite4_num_to_text [sqlite4_num_mul inf -9] } {-inf} do_test num-6.1.1 { sqlite4_num_to_text [sqlite4_num_div 6 5] } {1.2} do_test num-6.1.2 { sqlite4_num_compare 2 [sqlite4_num_div 2 1] } {equal} |
︙ | ︙ |