Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-7005

msvcrt: long double problem in scanf

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 0.3.17
    • CRT

    Description

      The problem is scanf's incorrect behavior with %Lf format specifier. Problem is that mingw's long double is 12 bytes long, when msvs's is 8. So, if compiled with mingw, scanf after conversion return 80-bit fp value instead of 64-bit. Solution is to use double instead of long double, which are equal to msvs's long double on both compilers. This solution doesnt look perfect, but mingw doesnt support "-mlong-double-64" option (at least my attempts to use this param has failed), which is better solution, i think. There is a patch in attachment which implements solution.

      Problem accroding to testman:
      scanf.c:111: Test failed: Got -0.000000, expected 32.715000

      at:

      34 double double_res;
      ...
      109 ret = sscanf(buffer, "%Lf", &double_res);
      110 ok(ret == 1, "expected 1, got %u\n", ret);
      111 ok(double_res == 32.715, "Got %lf, expected %lf\n", double_res, 32.715);

      After applying patch test is passed successfully.

      PS. This is my first attempt to do something good for ReactOS, so if something is wrong - please don't be angry at me Thanks for your attention.

      Attachments

        1. p3.txt
          0.7 kB
          dmitry216
        2. patchbot.patch
          20 kB
          AmineKhaldi

        Activity

          People

            AmineKhaldi AmineKhaldi
            dmitry216 dmitry216
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: