delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/04/19/16:12:43

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E9E7B396B405
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1618863158;
bh=q+sty7Dr9sx5DadW1Ann+SpEwkjZzoFqm7c8Rw8cGaI=;
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=LAwOG74geObIx0K10ULdAna363oXmqb84sJA4pnBF3SDTfzFROHO42n9cv3GZgWpj
DMqXm9J8RpzoL3ASieKpad+rHSZBaTGa0KJvx+M3ahTXDngBCEk0QEn+AMc0iODSWJ
0dVJV2O2XtzSEQfmEXJQns2SrALXdqZpqowIUpXI=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2E1463891C35
Date: Mon, 19 Apr 2021 22:12:23 +0200
To: cygwin AT cygwin DOT com
Subject: Re: should scanf be getting built supporting hexadecimal float
Message-ID: <YH3kJ1oSpDhpKfRc@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CAAHpriMYTdJo5qFkN1y97wZVdx-ZkuggNrxHijiZdROwY_OEFg AT mail DOT gmail DOT com>
<189e0004-0cee-0e1d-2c2f-0acd7d8ca2fb AT SystematicSw DOT ab DOT ca>
<91cf4bdd-9a97-6d6b-73af-01e891c22182 AT SystematicSw DOT ab DOT ca>
<YH3DlGS5dTWAcA2d AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <YH3DlGS5dTWAcA2d@calimero.vinschen.de>
X-Provags-ID: V03:K1:KBDwKIspaIEM4h9E4m3q4PwyYrJ/nwyCmYNzLiE8zmVSczzuWHM
i4McwwLyrlP26hP2sVuXpPSUtxvMKEHErctk0Np/7Tfau2l2zqupWgsgQaxHw0p7w+OycvT
fKgGRZzIoDYlR/edok+8OkIskgLFOoekdMOE4WclA4TjszRbc/oQqu99hdY3MynbH8LxXMV
PBW+WiLDxdYCfHkFG7i2w==
X-UI-Out-Filterresults: notjunk:1;V03:K0:Kia+Rwl8fUQ=:eJt0vWfGO5Da2QkADCUiH9
sIePDH5KHtdcZ9bDruZ+yBGOMXpixqBdhaMd/aqj346t7Oj6wyTDaNlNu9qbq4113163NvIiv
lYJ7Kypx14WOtAckRzi71g00+IisBakz24ctxY+1OekTlgSgmrDg9WliBBPIzbKT+9ibPCBii
USCvMkfz82PGCVpSevcyq5H+MKGtxWA8nIISYOiCs1upT7fRM289fq6mBQE1PGfCeS02ZBXAc
RDvrA3WNMrp88cqo23bblZ9SAQA0HgS57wA73dMFZLYBdv524Yy7ilhXmeyvV+fu8eMkxogyw
TDWJj9l+D1ZXmJvTvo4wUNm7hyA24ELvv1kfgS61ccwvpPPnyGPJoZNV0M8ugRoru0ES30oTP
gBG2la6reoxsY14GcdSV2NnSFNsgp7erkLbjQJyhD4cvJcoUsT3BGsmFHYLC+kg1Lkw7nRB6K
UXkxQNCEmfRo7NWckkCwNGZk859KITQPDPUHbcA2okdxb11l2KVP6xVM8rN2DxE4D+yCKN5ZI
bdpZMblwHL9qkU72Oa0HC8=
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, 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
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
Errors-To: cygwin-bounces AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

On Apr 19 19:53, Corinna Vinschen via Cygwin wrote:
> 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.

I pushed a patch which hopefully does the trick

https://sourceware.org/git/?p=newlib-cygwin.git;a=commitdiff;h=9c6c2fb0f697

I also uploaded new developer snapshots to https://cygwin.com/snapshots/

Please give it a try.


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019