BUG REPORT

Started by EMOTO Masahikoover 26 years ago1 messagesbugs
Jump to latest
#1EMOTO Masahiko
emo@nifs.ac.jp

Your name :EMOTO Masahiko
Your email address :emo@nifs.ac.jp

System Configuration
---------------------
Architecture (example: Intel Pentium) :Intel PentiumII

Operating System (example: Linux 2.0.26 ELF) :RedHat 6.0 (2.2.5-15smp)

PostgreSQL version (example: PostgreSQL-6.5.2): PostgreSQL-6.5.2

Compiler used (example: gcc 2.8.0) :egcs-2.91.66

Please enter a FULL description of your problem:
------------------------------------------------
Evaluationg following SQL cause parse error.
It seems that there's a bug parsing negative floating value
that has more than 15 digits after the period.

db1=> create table foo ( d float );
CREATE
db1=> insert into foo values ( -0.123456789012345 );
INSERT 178112 1
db1=> insert into foo values ( -0.1234567890123456 );
ERROR: Unable to convert left operator '-' from type 'unknown'
db1=> insert into foo values ( 0.1234567890123456 );
INSERT 178113 1
db1=> insert into foo values ( 0.12345678901234567 );
INSERT 178114 1

This makes another problem because Java's Double.toString(double ) methods
returns the following expression, so JDBC's PreparedStatement.setDouble(int,double)
may fail.

public class Test {
static public void main(String args[]){
double d = 1.0 / 7.0;
System.out.println(d);
}
}

% java Test
0.14285714285714285

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------