pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Roman Kononov <kononov195-pgsql@yahoo.com>
To: Bruce Momjian <bruce@momjian.us>
Cc: PostgreSQL-patches <pgsql-patches@postgresql.org>
Subject: Re: [BUGS] BUG #2846: inconsistent and confusing handling of underflows,
Date: Wed, 27 Dec 2006 15:43:49 -0600
Message-ID: <4592E915.4050901@yahoo.com> (raw)
In-Reply-To: <200612272123.kBRLNdg05533@momjian.us>
References: <200612272123.kBRLNdg05533@momjian.us>

On 12/27/2006 03:23 PM, Bruce Momjian wrote:
> Are you sure?  As I remember, computation automatically upgrades to
> 'double'.  See this program and output:

This is platform- and compiler- dependent:

~>uname -a
Linux rklinux 2.6.15-27-amd64-generic #1 SMP PREEMPT Fri Dec 8 17:50:54 UTC 2006 x86_64 GNU/Linux
~>gcc --version
gcc (GCC) 4.3.0 20061213 (experimental)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

~>cat test.c
#include <stdio.h>
#include <stdlib.h>

int
main(int argc, char *argv[])
{
    float a = 1e30, b = 1e30;
    double c;

    c = a * b;

    printf("%e\n", c);
    return 0;
}
~>gcc test.c
~>./a.out
inf
~>gcc -march=i386 -m32 test.c
~>./a.out
1.000000e+60

Roman



view thread (12+ messages)  latest in thread

Message-ID: <4592E915.4050901@yahoo.com>
Permalink:  ../4592E915.4050901@yahoo.com/
Also on:    postgresql.org/message-id/4592E915.4050901@yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: kononov195-pgsql@yahoo.com, bruce@momjian.us, pgsql-patches@postgresql.org
  Subject: Re: [BUGS] BUG #2846: inconsistent and confusing handling of underflows,
  In-Reply-To: <4592E915.4050901@yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox