X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 65BDE3851C22 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1618805380; bh=UdRKZ64QpP21VACijg82W8AzU8t8jSVPfOxeIR3SDk4=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=hOREGkDc0z5lw6xPQFpHgCLGHfxmPGLxXlp/d9vZX/ZzTni9DBNer4xlSBnKmdhmP phOOluDJYYYcsw4j0uKSGzCPtyR5JGnNN4ljH95rwsACzIaBRga5zSwaVlgOdYlBHy 4iA4SLIAvaaaY5mvNbPNjhnEn03FlNyGWwNUGt84= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C5D8D3851C22 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=Bi76JvylMSXL6p6mkV/0XpX9M5R3BENTO0qDXM/Pj7c=; b=NRNvfiluOrR7TVHcg0OxXc+fG3RN6zGV+1rH5c2MQFMPGwBt2k49LYx2zUrppKKE+f 5yFigd7lOc4r1T4eR3nxFpEnaVbQN8/+gu75a8awQsVNrzfjgP+7A3SHqG/6YJF+Qw2o iuEi4HgMidZ7A23taEhDK1WMvXIfS6N+gAqTFJ7wzBFmB4PR7OsOeu1mubigfcUmVTbA WcWiV2d/ib/1LOjebJvXR7wff2smhA74Cd1IlPXbjQBrB6NyOdEyB4ChuF+2QoUrOmZt wiY7+CsEB4eMkcMiNJZ4Z4saQoq1kg5xBGTztyOEOdpIftAcDEKfgcTzUEzoL2Cz3ud/ X7JA== X-Gm-Message-State: AOAM530nVpslcAA8IztY9G8re9Y9Qupr1M3FpjNxvmj9SVy/0+0kdXoe idNifMXBO0TjdxnKECAneGzFEwqk5vwxStveDgtvIurj2sr/NQ== X-Google-Smtp-Source: ABdhPJzEst9nJLL/tvL+/HH4OUqqwszVekIc/GP1VvKE4LRcm2fQaZ2j6AACebd8d7JJ0APxoHOKTLW0ebD3qcC4G5Y= X-Received: by 2002:a05:6402:430c:: with SMTP id m12mr23907004edc.138.1618805366696; Sun, 18 Apr 2021 21:09:26 -0700 (PDT) MIME-Version: 1.0 Date: Sun, 18 Apr 2021 21:09:15 -0700 Message-ID: Subject: sscanf doesn't handle hexadecimal floating-point input To: cygwin AT cygwin DOT com X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Keith Thompson via Cygwin Reply-To: Keith Thompson Cc: Keith Thompson Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Cygwin" The *scanf() functions don't handle hexadecimal floating-point input (for example "0x1p+0" representing 1.0). A test program: #include int main(void) { int ok = 1; float x = -1.0; int result = sscanf("0x1p+0", "%f", &x); const float expected_x = 1.0; const int expected_result = 1; printf("sscanf returned %d", result); if (result != expected_result) { ok = 0; printf(" (expected %d)", expected_result); } printf(", x = %g", x); if (x != expected_x) { ok = 0; printf(" (expected %g)", expected_x); } puts(ok ? ", PASSED" : ", FAILED"); } On Cygwin, the output (compiled with gcc or clang) is: sscanf returned 1, x = 0 (expected 1), FAILED On Ubuntu, the output is: sscanf returned 1, x = 1, PASSED Looking through the newlib sources (git://sourceware.org/git/newlib-cygwin.git), this might be related to the _WANT_IO_C99_FORMATS macro, but I haven't looked into the details. The test case passes on Cygwin when compiled with i686-w64-mingw32-gcc or x86_64-w64-mingw32-gcc. -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple