X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AEE7F3968C3F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1618854817; bh=SKAjr7rmWKcvUgAh0eufiaLig3lJpZrqf7hLMw0nFdU=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=knObSaHbgDu1KccTRXUJn7enhCE7HOdC9EBWWRBo11tBiluWWsrz3FSM2X1yEAnzY BztBgah4NaUxkIkWwMRc89heBEw3+AugWdU/csqbjHRknRB6vNQDPYal70tGMnQdVk 7VGEw5Fxz8Gu8toCafoaHNYwqmd3rHO+V1hIsfNc= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2C42F3851C1B Date: Mon, 19 Apr 2021 19:53:24 +0200 To: cygwin AT cygwin DOT com Subject: Re: should scanf be getting built supporting hexadecimal float Message-ID: Mail-Followup-To: cygwin AT cygwin DOT com References: <189e0004-0cee-0e1d-2c2f-0acd7d8ca2fb AT SystematicSw DOT ab DOT ca> <91cf4bdd-9a97-6d6b-73af-01e891c22182 AT SystematicSw DOT ab DOT ca> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <91cf4bdd-9a97-6d6b-73af-01e891c22182@SystematicSw.ab.ca> X-Provags-ID: V03:K1:Q+GgaKwNCeO9wEkXqv226zHOJVOJam0NhCmvJ9KFuhJha5WYxQh HHuvS9vP9xK7r2HLT71lpn6gIRZ0P2Sej8Yrwvzc+0e6zDclpykum/3VrUCzEaj0TGTcP83 d2HIcL3JboXWMnS0JKiskdLHRrI9XtShy9po+sYeAgeCW0uVrd8cDQavo96cJp3wLe59ct1 NNImQ7pZh1pnufJJCbSvw== X-UI-Out-Filterresults: notjunk:1;V03:K0:MfVBAuuUuQw=:s8zSOjeHbziw+LPB5XLTKW NqkJ+KsWByr8OVj4bX12qUG08fm9EVI6P3WXFeIHG9A4oCSXKTbbGXu3Yw6GZbgWATOQ8gfJk lAx5ZdS51x9ZdMztgDPQKc0HGYjFWX1jQYdpahgpnPXUpNqJIaSP3mQvDprXD6DNYu9Y3ytja gKUgPiTOKx3+USeY5nObSHf+jWOMHGY0oVGrv9JNkACelV+OD/yBbExtY91ajOFSfiwB8SF0H 3rhWQTiWl8Mf/rpmY8Ucn6+N5r1LQDcQ97flqT12VBuSfzTL2TBIcv+fXDbCXZQB0zbtEXfg+ dQz29woxfYhsZ/jEc3Ztrfw/96kV7wzc2d6yW3eQEPvw1Hy8tdurT2f2DuXsx1uKnsKhM4htg VwN8EiO6zNPS2X0TEcMJdd5gJIIhECRAQTJfD44aGOpIsWanpmAEAdOA9djGuoOcJEsoI3vPD 7gL5/m7x+J19wJouAh0hS3VYRpQ+6VOOIa2XcX/kbik7rB7w7yJKOve3s562V4gmatnqN/Gum xndKr2/8ZZHQXIDvQTquYo= X-Spam-Status: No, score=-100.2 required=5.0 tests=BAYES_00, GOOD_FROM_CORINNA_CYGWIN, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, 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 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" On Apr 19 09:17, Brian Inglis wrote: > On 2021-04-19 09:07, Brian Inglis wrote: > > On 2021-04-18 22:09, Keith Thompson via Cygwin wrote: > > > The *scanf() functions don't handle hexadecimal floating-point input > > > (for example "0x1p+0" representing 1.0). > > > 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. > > > This seems like an oversight as gdtoa-gethex.c was added about 2006 and > > scanf and strtod support it. > > See augmented STC with strtod added attached: > > > > $ gcc -o hexfloat-scanf-test{,.c} > > $ ./hexfloat-scanf-test > > sscanf returned 2, unscanned 'x1p+0', x = 0 (expected 1), FAILED > > strtod unscanned '', x = 1, PASSED > > Should the Cygwin newlib build be enabling hex float support? Unfortunately, newlib's scanf code does not support hex floats at all yet. Scanf collects and validates the input stream snippet which is supposed to be given to strtod/strtold, and neither x nor p are valid chars in that piece of code yet. I'll look into adding this code, which shouldn't be too complicated, but I wouldn't be offended by patches either. Thanks, Corinna -- 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