SQLite

Check-in [d45f7a013f]
Login

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

Overview
Comment:Move variable declaration to fix compilation with MSVC.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | floating-point-conversions
Files: files | file ages | folders
SHA1: d45f7a013f05fe7603d5e6d02df0e6bab2c7ffd8
User & Date: mistachkin 2012-06-19 04:36:48.907
Context
2012-06-21
15:02
Disable the atof1.test module when compiling on MSVC. (Closed-Leaf check-in: 0f706acfc7 user: drh tags: floating-point-conversions)
2012-06-19
04:36
Move variable declaration to fix compilation with MSVC. (check-in: d45f7a013f user: mistachkin tags: floating-point-conversions)
03:59
Fix an incorrect testcase for the round() function. All tests are passing now, including new real->text->real round-trip tests. (check-in: 963eb24f73 user: drh tags: floating-point-conversions)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/func.c.
861
862
863
864
865
866
867
868
869

870
871
872
873
874
875
876
*/
static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  assert( argc==1 );
  UNUSED_PARAMETER(argc);
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_FLOAT: {
      double r1, r2;
      r1 = sqlite3_value_double(argv[0]);
      char zBuf[50];

      sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.15g", r1);
      sqlite3AtoF(zBuf, &r2, 20, SQLITE_UTF8);
      if( r1!=r2 ){
        sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.20e", r1);
      }
      sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
      break;







<

>







861
862
863
864
865
866
867

868
869
870
871
872
873
874
875
876
*/
static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  assert( argc==1 );
  UNUSED_PARAMETER(argc);
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_FLOAT: {
      double r1, r2;

      char zBuf[50];
      r1 = sqlite3_value_double(argv[0]);
      sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.15g", r1);
      sqlite3AtoF(zBuf, &r2, 20, SQLITE_UTF8);
      if( r1!=r2 ){
        sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.20e", r1);
      }
      sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
      break;