Re: Why don't we accept exponential format for integers?

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why don't we accept exponential format for integers?
Date: 2010-12-17 20:27:09
Message-ID: 1292617629.28145.22.camel@jd-desktop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2010-12-17 at 14:35 -0500, Tom Lane wrote:
> Josh Berkus <josh(at)agliodbs(dot)com> writes:
> > postgres=# select '1e+01'::Integer
> > postgres-# ;
> > ERROR: invalid input syntax for integer: "1e+01"
>
> I have never heard of any programming system anywhere that accepts
> such
> a syntax for integers (assuming it distinguishes integers from other
> numbers at all). I'm not excited about being the first. Why does
> this
> error surprise you? It doesn't seem particularly different from
> arguing
> that 1.000 should be considered an integer, which strikes me as a
> seriously bad idea.
>
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print int(1e+01)
10
>>>

Sincerely,

Joshua D. Drake

> regards, tom lane
--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering
http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-12-17 20:30:51 Re: Why don't we accept exponential format for integers?
Previous Message Tom Lane 2010-12-17 20:24:14 Re: Why don't we accept exponential format for integers?