🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.os.linux.mandrake
Article #519

Re: Problems with float variables in C

#519
From: Edward Rosten
Date: Sat, 08 Sep 2001 00:22
34 lines
2536 bytes
> When checking for possible difficulty with division by zero, if you don't
> wish to get into trapping overflow and the like, you should check at least
> for small non-zero numbers.  If all your numerators have absolute value < 4,
> you could safely do
> #include <float.h>
> if(fabs(y)>FLT_MIN)
>     proceed with division by y
> else
>     treat as error

I'm not trying to be pedantic, I'm genuinely curious, but isn't

fabs(y) > FLT_MIN

equivalent to

f != 0

Since 0 can be represented exactly and FLT_MIN is the smallest
possible float greater than zero?

-Ed

(You can't go wrong with psycho-rats.)      
(u98ejr)(@)(ecs.ox)(.ac.uk)

/d{def}def/f{/Times findfont s scalefont setfont}d/s{10}d/r{roll}d f
5/m
{moveto}d -1 r 230 350 m 0 1 179{1 index show 88 rotate 4 mul 0
rmoveto}
for /s 15 d f pop 240 420 m 0 1 3 { 4 2 1 r sub -1 r show } for
showpage
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net
Technical Details
Message-ID: <clcm-20010907-0010@plethora.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-xfer.siscom.net!news-out.visi.com!hermes.visi.com!gemini.plethora.net.POSTED!not-for-mail
References: <clcm-20010905-0003@plethora.net> <clcm-20010905-0016@plethora.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,898a7d80327816b3
X-Google-Attributes: gid11318c,public
X-Google-Thread: f8a83,898a7d80327816b3
X-Google-Attributes: gidf8a83,public
X-Google-Thread: f65d0,898a7d80327816b3
X-Google-Attributes: gidf65d0,public
X-Google-Thread: 108717,898a7d80327816b3
X-Google-Attributes: gid108717,public
X-Google-Thread: 100850,77ebfbc06b0f9856
X-Google-Attributes: gid100850,public
X-Google-ArrivalTime: 2001-09-07 17:22:15 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-xfer.siscom.net!news-out.visi.com!hermes.visi.com!gemini.plethora.net.POSTED!not-for-mail
X-Old-trace: posting.google.com 999861967 19321 127.0.0.1 (7 Sep 2001 11:26:07 GMT)
Subject: Re: Problems with float variables in C
Approved: clc@plethora.net
Content-Transfer-encoding: 8bit
References: <clcm-20010905-0003@plethora.net> <clcm-20010905-0016@plethora.net>
From: u98ejr@ecs.ox.ac.uk (Edward Rosten)
Organization: http://groups.google.com/
Return-Path: <news@google.com>
Content-Type: text/plain; charset=ISO-8859-1
X-Old-complaints-to: groups-abuse@google.com
Newsgroups: alt.os.linux.mandrake,comp.lang.c.moderated,comp.programming,gnu.gcc,gnu.gcc.help
Message-ID: <clcm-20010907-0010@plethora.net>
Originator: clcm@plethora.net (Comp Lang C'Moderated)
Date: 08 Sep 2001 00:22:14 GMT
Lines: 34
NNTP-Posting-Host: 3981ee61.news.plethora.net
X-Trace: 999908534 gemini.plethora.net 317 clcm@205.166.146.1
X-Complaints-To: abuse@plethora.net