Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #5844

Re: implicit promotion

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date Mon, 30 May 2011 14:23:52 -0500
From Pete Becker <pete@versatilecoding.com>
Organization Roundhouse Consulting, Ltd.
Newsgroups comp.lang.c++
Date Mon, 30 May 2011 09:23:52 -1000
Message-ID <2011053009235252042-pete@versatilecodingcom> (permalink)
References <irusp0$6pi$1@reader1.panix.com> <Xns9EF5E0E419D65myfirstnameosapriee@216.196.109.131>
MIME-Version 1.0
Content-Type text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding 8bit
Subject Re: implicit promotion
User-Agent Unison/2.1.4
Lines 33
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-TLJYtP3kM5dI+ifve9rsmPMJnnEw/DJLoPPskfUb04rJl5POV/XmaU2BT07YKR+xwFUUL2lgPqp7L8R!+NUDdpnVpbmhu+EyAkv+pwzT33ruBxwH9O6wizBLBcwR+U5isjoHsnHfBiTnFkziKWtAGSg=
X-Complaints-To abuse@giganews.com
X-DMCA-Notifications http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2428
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:5844

Show key headers only | View raw


On 2011-05-30 09:06:28 -1000, Paavo Helde said:

> Juha Nieminen <nospam@thanks.invalid> wrote in
> news:4de3dfee$0$2848$7b1e8fa0@news.nbl.fi:
> 
>> Paavo Helde <myfirstname@osa.pri.ee> wrote:
>>> As far as I can see from 5/9, no, float-int are converted to
>>> float-float.
>> 
>> Isn't that bad? An int might not be representable as a float, even
>> though
>> it may be as a double. The result of the division may be representable
>> with a float even though the int might not.
>> 
> 
> An int is quite surely representable as a float, up to some precision.

Well, yes, up to some precision. But it's often the case that the 
largest value that can be represented as an int cannot be represented 
exactly as a float. 32-bit ints and 32-bit doubles, for example.

In any case, the problem here is one of my favorite rants: programmers 
aren't taught how floating-point math works, so they end up treating it 
as magic. Nobody's bothered by 3*(1/3) not being 1, but somehow there's 
a perception that there's something unsavory about 10*(1.0/10.0) not 
having to be 1, even though it's exactly the same issue.

-- 
  Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The 
Standard C++ Library Extensions: a Tutorial and Reference 
(www.petebecker.com/tr1book)

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

implicit promotion Ruben Safir <ruben@mrbrklyn.com> - 2011-05-30 01:44 +0000
  Re: implicit promotion red floyd <no.spam.here@its.invalid> - 2011-05-29 20:35 -0700
    Re: implicit promotion ruben safir <ruben@mrbrklyn.com> - 2011-05-30 00:01 -0400
      Re: implicit promotion Ian Collins <ian-news@hotmail.com> - 2011-05-30 16:08 +1200
        Re: implicit promotion Paavo Helde <myfirstname@osa.pri.ee> - 2011-05-30 01:18 -0500
          Re: implicit promotion Juha Nieminen <nospam@thanks.invalid> - 2011-05-30 11:45 +0000
            Re: implicit promotion Öö Tiib <ootiib@hot.ee> - 2011-05-30 05:49 -0700
              Re: implicit promotion Pete Becker <pete@versatilecoding.com> - 2011-05-30 08:58 -1000
                Re: implicit promotion Öö Tiib <ootiib@hot.ee> - 2011-05-30 12:01 -0700
                Re: implicit promotion Öö Tiib <ootiib@hot.ee> - 2011-05-30 12:07 -0700
                Re: implicit promotion Pete Becker <pete@versatilecoding.com> - 2011-05-30 09:07 -1000
                Re: implicit promotion Öö Tiib <ootiib@hot.ee> - 2011-05-30 12:13 -0700
                Re: implicit promotion Pete Becker <pete@versatilecoding.com> - 2011-05-30 09:27 -1000
            Re: implicit promotion Paavo Helde <myfirstname@osa.pri.ee> - 2011-05-30 10:17 -0500
              Re: implicit promotion Juha Nieminen <nospam@thanks.invalid> - 2011-05-30 18:20 +0000
                Re: implicit promotion Paavo Helde <myfirstname@osa.pri.ee> - 2011-05-30 14:06 -0500
                Re: implicit promotion Pete Becker <pete@versatilecoding.com> - 2011-05-30 09:23 -1000
                Re: implicit promotion Pete Becker <pete@versatilecoding.com> - 2011-05-30 09:29 -1000
                Re: implicit promotion Ruben Safir <ruben@mrbrklyn.com> - 2011-05-31 01:24 +0000
                Re: implicit promotion Ian Collins <ian-news@hotmail.com> - 2011-05-31 13:30 +1200
                Re: implicit promotion ruben safir <ruben@mrbrklyn.com> - 2011-05-31 00:52 -0400
                Re: implicit promotion Pete Becker <pete@versatilecoding.com> - 2011-05-30 17:36 -1000
              Re: implicit promotion Öö Tiib <ootiib@hot.ee> - 2011-05-30 11:39 -0700
                Re: implicit promotion Pete Becker <pete@versatilecoding.com> - 2011-05-30 09:02 -1000

csiph-web