Article View: comp.std.c
Article #3761Re: Casting float to int - standard bug?
From: James Kanze US/ESC 60/3/141 #407...
Date: Thu, 17 Aug 1995 09:13
Date: Thu, 17 Aug 1995 09:13
19 lines
1401 bytes
1401 bytes
In article <40uau1$pl0@solutions.solon.com> seebs@solutions.solon.com
(Peter Seebach) writes:
|> In article <40t18j$e50@kruuna.helsinki.fi>,
|> Lars Wirzenius <wirzeniu@cc.Helsinki.FI> wrote:
|> >Re: the difficulty in checking whether a float value fits into an int.
|> >Couldn't sprintf+strtol be used for this? strtol has well-defined behaviour
|> >for overflows.
|> Well, yes, but *technically* I don't know for sure how much space I need
|> to give sprintf() for the float.
Couldn't you use DBL_MAX_10_EXP to get this information?
--
James Kanze Tel.: (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils en informatique industrielle --
-- Beratung in industrieller Datenverarbeitung
Technical Details
Message-ID:
<KANZE.95Aug17111303@slsvhdt.lts.sel.alcatel.de>Path:
arc1-ca.pugleaf.net!xlink.net!slsv6bt!newsReferences:
<40rjdn$jof@solutions.solon.com> <KANZE.95Aug16134320@slsvhdt.lts.sel.alcatel.de> <40t18j$e50@kruuna.helsinki.fi> <40uau1$pl0@solutions.solon.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!xlink.net!slsv6bt!news From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763) Subject: Re: Casting float to int - standard bug? In-Reply-To: seebs@solutions.solon.com's message of 16 Aug 1995 21:52:48 -0500 Message-ID: <KANZE.95Aug17111303@slsvhdt.lts.sel.alcatel.de> Sender: news@lts.sel.alcatel.de Organization: SEL References: <40rjdn$jof@solutions.solon.com> <KANZE.95Aug16134320@slsvhdt.lts.sel.alcatel.de> <40t18j$e50@kruuna.helsinki.fi> <40uau1$pl0@solutions.solon.com> Date: 17 Aug 1995 09:13:03 GMT