Re: [BUGS] BUG #2846: inconsistent and confusing handling of underflows,

From: Roman Kononov <kononov195-pgsql(at)yahoo(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #2846: inconsistent and confusing handling of underflows,
Date: 2006-12-27 21:43:49
Message-ID: 4592E915.4050901@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2006-12-27 21:43:54 Re: [BUGS] BUG #2846: inconsistent and confusing
Previous Message Stephen Frost 2006-12-27 21:41:08 Re: pg_hba.conf hostname todo

Browse pgsql-patches by date

  From Date Subject
Next Message Joshua D. Drake 2006-12-27 21:43:54 Re: [BUGS] BUG #2846: inconsistent and confusing
Previous Message Simon Riggs 2006-12-27 21:36:23 Re: WIP patch for "operator families"