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


Groups > comp.lang.c > #23600

Re: What shall return "0.0 ? 1 : 0" ?

From Ike Naar <ike@sverige.freeshell.org>
Newsgroups comp.lang.c
Subject Re: What shall return "0.0 ? 1 : 0" ?
Date 2012-07-23 06:49 +0000
Organization A noiseless patient Spider
Message-ID <slrn3vfsk0pt00.lad.ike@sverige.freeshell.org> (permalink)
References <jubm08$k38$1@news.httrack.net> <0.6d2945813f4b17e7e5be.20120720145751BST.87r4s6a61s.fsf@bsb.me.uk> <kfn8vec4wus.fsf@x-alumni2.alumni.caltech.edu> <jugk4s$f07$1@usenet.stanford.edu> <0.429927d9c3de3565a5c8.20120722142541BST.877gtw6i7e.fsf@bsb.me.uk>

Show all headers | View raw


On 2012-07-22, Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
> That aside, 0.0 == 0 is interesting.  On a machine that has an exact
> floating zero, 0 must convert to it, but 0.0 need not (surely this is
> unintended?).  On one that does not have an exact floating zero, very
> similar wording is used in 6.3.1.4 p2 (for the conversion) as is used in
> 6.4.4.2 p3 (for the representation of the constant):
>
>   "the result is either the nearest representable value, or the larger
>   or smaller representable value immediately adjacent to the nearest
>   representable value, chosen in an implementation-defined manner."
>
>   "the result is either the nearest higher or nearest lower
>   representable value, chosen in an implementation-defined manner"
>
> but there's nothing to say that the implementation must choose in the
> same way in both cases.  A perverse implementation could "round" 0.0 up
> and convert 0 by going the other way!

That also raises the question: in

  static double d;

what would be the initial value of d?
0 or 0.0 ?

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

What shall return "0.0 ? 1 : 0" ? Xavier Roche <xroche@free.fr.NOSPAM.invalid> - 2012-07-20 15:21 +0200
  Re: What shall return "0.0 ? 1 : 0" ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-07-20 14:57 +0100
    Re: What shall return "0.0 ? 1 : 0" ? Tim Rentsch <txr@alumni.caltech.edu> - 2012-07-21 14:39 -0700
      Re: What shall return "0.0 ? 1 : 0" ? Ralf Damaschke <rwspam@gmx.de> - 2012-07-21 23:31 +0000
        Re: What shall return "0.0 ? 1 : 0" ? Tim Rentsch <txr@alumni.caltech.edu> - 2012-07-21 21:57 -0700
          Re: What shall return "0.0 ? 1 : 0" ? Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-07-22 17:27 +0300
            Re: What shall return "0.0 ? 1 : 0" ? Tim Rentsch <txr@alumni.caltech.edu> - 2012-09-07 11:15 -0700
          Re: What shall return "0.0 ? 1 : 0" ? Martin Shobe <martin.shobe@yahoo.com> - 2012-07-22 18:43 +0000
            Re: What shall return "0.0 ? 1 : 0" ? Tim Rentsch <txr@alumni.caltech.edu> - 2012-09-07 10:14 -0700
          Re: What shall return "0.0 ? 1 : 0" ? Ralf Damaschke <rwspam@gmx.de> - 2012-07-22 22:43 +0000
            Re: What shall return "0.0 ? 1 : 0" ? Tim Rentsch <txr@alumni.caltech.edu> - 2012-09-07 10:59 -0700
      Re: What shall return "0.0 ? 1 : 0" ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-07-22 02:43 +0100
        Re: What shall return "0.0 ? 1 : 0" ? Tim Rentsch <txr@alumni.caltech.edu> - 2012-07-21 22:05 -0700
      Re: What shall return "0.0 ? 1 : 0" ? Seungbeom Kim <musiphil@bawi.org> - 2012-07-22 03:20 -0700
        Re: What shall return "0.0 ? 1 : 0" ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-07-22 14:25 +0100
          Re: What shall return "0.0 ? 1 : 0" ? "Bill Leary" <Bill_Leary@msn.com> - 2012-07-22 18:56 -0400
            Re: What shall return "0.0 ? 1 : 0" ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-07-23 01:37 +0100
              Re: What shall return "0.0 ? 1 : 0" ? "Bill Leary" <Bill_Leary@msn.com> - 2012-07-23 07:27 -0400
            Re: What shall return "0.0 ? 1 : 0" ? Ike Naar <ike@sverige.freeshell.org> - 2012-07-23 06:45 +0000
              Re: What shall return "0.0 ? 1 : 0" ? "Bill Leary" <Bill_Leary@msn.com> - 2012-07-23 07:37 -0400
          Re: What shall return "0.0 ? 1 : 0" ? Ike Naar <ike@sverige.freeshell.org> - 2012-07-23 06:49 +0000
            Re: What shall return "0.0 ? 1 : 0" ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-07-23 12:42 +0100
  Re: What shall return "0.0 ? 1 : 0" ? Noob <root@127.0.0.1> - 2012-07-20 15:58 +0200
    Re: What shall return "0.0 ? 1 : 0" ? Xavier Roche <xroche@free.fr.NOSPAM.invalid> - 2012-07-20 16:02 +0200
      Re: What shall return "0.0 ? 1 : 0" ? Noob <root@127.0.0.1> - 2012-07-20 16:22 +0200
        Re: What shall return "0.0 ? 1 : 0" ? Xavier Roche <xroche@free.fr.NOSPAM.invalid> - 2012-07-20 16:26 +0200
          Re: What shall return "0.0 ? 1 : 0" ? Kenneth Brody <kenbrody@spamcop.net> - 2012-07-20 15:11 -0400
          Re: What shall return "0.0 ? 1 : 0" ? Robert Miles <milesrf@Usenet-News.net> - 2012-08-25 00:16 -0500
      Re: What shall return "0.0 ? 1 : 0" ? Kenneth Brody <kenbrody@spamcop.net> - 2012-07-20 15:10 -0400
  Re: What shall return "0.0 ? 1 : 0" ? jacob navia <jacob@spamsink.net> - 2012-07-20 18:15 +0200
  Re: What shall return "0.0 ? 1 : 0" ? Keith Thompson <kst-u@mib.org> - 2012-07-20 09:51 -0700
    Re: What shall return "0.0 ? 1 : 0" ? pete <pfiland@mindspring.com> - 2012-07-20 20:29 -0400
      Re: What shall return "0.0 ? 1 : 0" ? Keith Thompson <kst-u@mib.org> - 2012-07-20 20:25 -0700
        Re: What shall return "0.0 ? 1 : 0" ? Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-07-21 22:22 +0300
        Re: What shall return "0.0 ? 1 : 0" ? Tim Rentsch <txr@alumni.caltech.edu> - 2012-07-21 14:54 -0700
    Re: expressions, evaluations, and values (was: What shall return "0.0 ? 1 : 0" ?) Tim Rentsch <txr@alumni.caltech.edu> - 2012-07-21 14:52 -0700
  Re: What shall return "0.0 ? 1 : 0" ? Keith Thompson <kst-u@mib.org> - 2012-07-20 10:08 -0700

csiph-web