From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11472 Path: news.gmane.org!.POSTED!not-for-mail From: Florian Weimer Newsgroups: gmane.linux.lib.musl.general Subject: Re: Different behavior (strtod) between musl and glibc Date: Wed, 14 Jun 2017 15:44:34 +0200 Message-ID: <87d1a63cql.fsf@oldenburg.str.redhat.com> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1497447893 27977 195.159.176.226 (14 Jun 2017 13:44:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 14 Jun 2017 13:44:53 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cc: musl@lists.openwall.com To: Xiaowei Zhan Original-X-From: musl-return-11485-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jun 14 15:44:49 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dL8bH-00071d-PV for gllmg-musl@m.gmane.org; Wed, 14 Jun 2017 15:44:47 +0200 Original-Received: (qmail 20398 invoked by uid 550); 14 Jun 2017 13:44:49 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 20380 invoked from network); 14 Jun 2017 13:44:48 -0000 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 964E0C0010A3 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=fweimer@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 964E0C0010A3 In-Reply-To: (Xiaowei Zhan's message of "Tue, 13 Jun 2017 09:43:42 -0500") X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 14 Jun 2017 13:44:36 +0000 (UTC) Xref: news.gmane.org gmane.linux.lib.musl.general:11472 Archived-At: Xiaowei Zhan writes: > I notice that when pass a non-numeric char to strtod, musl will set > errno to non-zero, but glibc will set errno to zero. I am curious why > this difference exists, and whether it is necessary to make strtod in > musl behave similarly to glibc. I think glibc leaves errno at zero; it does not set it. For input which cannot be converted, this seems to be the behavior mandated by C11. POSIX describes the EINVAL value as an extension to the C standard. glibc does not appear to implement this extension. So both behaviors are correct. Florian