From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3991 invoked by alias); 29 Dec 2007 11:18:50 -0000 Received: (qmail 3983 invoked by uid 22791); 29 Dec 2007 11:18:50 -0000 X-Spam-Check-By: sourceware.org Received: from romy.inter.net.il (HELO romy.inter.net.il) (213.8.233.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 29 Dec 2007 11:18:44 +0000 Received: from HOME-C4E4A596F7 (IGLD-84-229-120-75.inter.net.il [84.229.120.75]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id JTD80652 (AUTH halo1); Sat, 29 Dec 2007 13:18:22 +0200 (IST) Date: Sat, 29 Dec 2007 11:21:00 -0000 Message-Id: From: Eli Zaretskii To: Thiago Jung Bauermann CC: gdb-patches@sourceware.org In-reply-to: <1198705277.12907.39.camel@localhost.localdomain> (message from Thiago Jung Bauermann on Wed, 26 Dec 2007 19:41:17 -0200) Subject: Re: [patch 2/2] Wrap-up expression support for DFP. Reply-to: Eli Zaretskii References: <20071220054926.148275471@br.ibm.com> <20071220055107.194393592@br.ibm.com> <1198705277.12907.39.camel@localhost.localdomain> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-12/txt/msg00446.txt.bz2 > From: Thiago Jung Bauermann > Cc: gdb-patches@sourceware.org > Date: Wed, 26 Dec 2007 19:41:17 -0200 > > Actually, these numbers refer to the double representation in the target > system, not to the decimal float representation used in libdecnumber. By > the way, since libiberty also has an implementation for asprintf, I > could do away with these estimates and just use this function instead. > > > > + /* We cannot use snprintf here because it is defined only in C99. > > > > We have portable substitutes for snprintf, I think. Take a look at > > libiberty, for example. > > Yes, it is there. I didn't find any .h, though, so I don't really know > the proper way to use them. There's include/libiberty.h, where all libiberty functions are declared, conditioned by corresponding preprocessor defines. Those preprocessor defines should be defined by the configure script for platforms that don't have those functions in their native libraries. > > > + /* This is an ugly way to do the conversion, but libdecnumber does > > > + not offer a direct way to do it. */ > > > + decimal_to_string (from, len, buffer); > > > + return atof (buffer); > > > > Isn't strtold better here? > > It's C99 and not in libiberty. Then how about using strtod?