Article View: comp.std.c
Article #3757Re: Casting float to int - standard bug?
From: Peter Seebach
Date: Thu, 17 Aug 1995 02:52
Date: Thu, 17 Aug 1995 02:52
23 lines
1383 bytes
1383 bytes
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. >(It's not elegant, of course.) I think the whole thing is inelegant; as long as overflow is undefined, it's very ugly to test for overflow. Similarly, I would like it if I could write -2...8 (-2^31) instead of -2...7 - 1 and have the preprocessor not geek out. -s -- Peter Seebach - seebs@solon.com || seebs@intran.xerox.com --- C/Unix proto-wizard -- C/Unix questions? Send mail for help. No, really! Copyright 1995 Peter Seebach. Not for distribution through Microsoft Network. The *other* C FAQ - ftp taniemarie.solon.com /pub/c/afq
Technical Details
Message-ID:
<40uau1$pl0@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<40rjdn$jof@solutions.solon.com> <KANZE.95Aug16134320@slsvhdt.lts.sel.alcatel.de> <40t18j$e50@kruuna.helsinki.fi>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: seebs@solutions.solon.com (Peter Seebach) Newsgroups: comp.std.c Subject: Re: Casting float to int - standard bug? Date: 16 Aug 1995 21:52:48 -0500 Organization: Usenet Fact Police (Undercover) Message-ID: <40uau1$pl0@solutions.solon.com> References: <40rjdn$jof@solutions.solon.com> <KANZE.95Aug16134320@slsvhdt.lts.sel.alcatel.de> <40t18j$e50@kruuna.helsinki.fi> NNTP-Posting-Host: solutions.solon.com