SQLite4
Check-in [13d342510f]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Num comparison says that +0 = -0. Before, 1-1 > (-1)-(-1).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | num_work
Files: files | file ages | folders
SHA1:13d342510f4feee2b6a98cfef91935f0e60a7677
User & Date: peterreid 2013-02-11 04:09:19
Context
2013-02-11
14:03
Add test fixture functions for sqlite4_num_isinf and sqlite4_num_isnan, and some related test cases. check-in: 58a9cfcb39 user: peterreid tags: num_work
04:09
Num comparison says that +0 = -0. Before, 1-1 > (-1)-(-1). check-in: 13d342510f user: peterreid tags: num_work
2013-02-10
22:03
Add sqlite4_num_add/sub/mul/div to testfixture and some tests that use them. check-in: 91bfc9e7d7 user: peterreid tags: num_work
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/math.c.

251
252
253
254
255
256
257

258
259
260
261
262
263
264
    return A.sign ? 1 : 3;
  }
  if( B.e>SQLITE4_MX_EXP ){
    if( B.m==0 ) return 0;
    return B.sign ? 3 : 1;
  }
  if( A.sign!=B.sign ){

    return A.sign ? 1 : 3;
  }
  adjustExponent(&A, &B);
  if( A.sign ){
    sqlite4_num t = A;
    A = B;
    B = t;







>







251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
    return A.sign ? 1 : 3;
  }
  if( B.e>SQLITE4_MX_EXP ){
    if( B.m==0 ) return 0;
    return B.sign ? 3 : 1;
  }
  if( A.sign!=B.sign ){
    if ( A.m==0 && B.m==0 ) return 2;
    return A.sign ? 1 : 3;
  }
  adjustExponent(&A, &B);
  if( A.sign ){
    sqlite4_num t = A;
    A = B;
    B = t;

Changes to test/num.test.

46
47
48
49
50
51
52



53
54
55
56
57
58
59
60
61
62
63
64
65

do_test num-4.1.1 {
  sqlite4_num_to_text [sqlite4_num_sub 9 3]
} {6}
do_test num-4.1.2 {
  sqlite4_num_to_text [sqlite4_num_sub 5 12]
} {-7}




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}




finish_test







>
>
>













46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

do_test num-4.1.1 {
  sqlite4_num_to_text [sqlite4_num_sub 9 3]
} {6}
do_test num-4.1.2 {
  sqlite4_num_to_text [sqlite4_num_sub 5 12]
} {-7}
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}




finish_test