dbTalk Databases Forums  

[Info-Ingres] round(), trunc() functions...is this a bug?

comp.databases.ingres comp.databases.ingres


Discuss [Info-Ingres] round(), trunc() functions...is this a bug? in the comp.databases.ingres forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martin Bowes
 
Posts: n/a

Default [Info-Ingres] round(), trunc() functions...is this a bug? - 03-30-2010 , 05:29 AM






Hi All,



The round() function in 9.2 has got me stumped to the point I think it's
a buggy version....



Has anyone got a quick primer with examples on what it should return?



If I do...

select round(1.99,-1), round(1.99, 0), round(1.99,1)

Why do I get 0, 1, 1 as the results?



Why are the data types of the answers all decimal(16,0)?



BTW. I get similar sorts of weirdness for trunc()



Martin Bowes

Reply With Quote
  #2  
Old   
Karl Schendel
 
Posts: n/a

Default Re: [Info-Ingres] round(), trunc() functions...is this a bug? - 03-30-2010 , 05:46 AM






On Mar 30, 2010, at 6:29 AM, Martin Bowes wrote:

Quote:
Hi All,

The round() function in 9.2 has got me stumped to the point I think it’s a buggy version….

Has anyone got a quick primer with examples on what it should return?

If I do…
select round(1.99,-1), round(1.99, 0), round(1.99,1)
Why do I get 0, 1, 1 as the results?
I get 0, 2, 2 which I think is correct.

Quote:
Why are the data types of the answers all decimal(16,0)?
Mine are all decimal(4,2).

I'm running in main (10.0), so yes, I'd say you have a buggy
version. Funny thing is that I don't see any fixes in the edit
histories, though. You wouldn't have an OME round function
defined by any chance?

Karl

Reply With Quote
  #3  
Old   
Martin Bowes
 
Posts: n/a

Default Re: [Info-Ingres] round(), trunc() functions...is this a bug? - 03-30-2010 , 06:17 AM



Hi Karl,

I'd agree with 0,2,2

I'd accept decimal 4,2 for all as well.

And no, I don't have an OME round() function...nice suggestion though!
It brings up a curious point I'll have to investigate.

Marty

-----Original Message-----
From: Karl Schendel [mailto:schendel (AT) kbcomputer (DOT) com]
Sent: 30 March 2010 11:47
To: Ingres and related product discussion forum
Subject: Re: [Info-Ingres] round(), trunc() functions...is this a bug?


On Mar 30, 2010, at 6:29 AM, Martin Bowes wrote:

Quote:
Hi All,

The round() function in 9.2 has got me stumped to the point I think
it's a buggy version....

Has anyone got a quick primer with examples on what it should return?

If I do...
select round(1.99,-1), round(1.99, 0), round(1.99,1)
Why do I get 0, 1, 1 as the results?
I get 0, 2, 2 which I think is correct.

Quote:
Why are the data types of the answers all decimal(16,0)?
Mine are all decimal(4,2).

I'm running in main (10.0), so yes, I'd say you have a buggy
version. Funny thing is that I don't see any fixes in the edit
histories, though. You wouldn't have an OME round function
defined by any chance?

Karl



_______________________________________________
Info-Ingres mailing list
Info-Ingres (AT) kettleriverconsulting (DOT) com
http://ext-cando.kettleriverconsulti...fo/info-ingres

Reply With Quote
  #4  
Old   
Martin Bowes
 
Posts: n/a

Default Re: [Info-Ingres] round(), trunc() functions...is this a bug? - 03-30-2010 , 06:40 AM



Hi Karl,

What do you get for:
create table xx as
select trunc(1.99,-1) as a, trunc(1.99, 0) as b, trunc(1.99,1) as c;

Marty

-----Original Message-----
From: Karl Schendel [mailto:schendel (AT) kbcomputer (DOT) com]
Sent: 30 March 2010 11:47
To: Ingres and related product discussion forum
Subject: Re: [Info-Ingres] round(), trunc() functions...is this a bug?


On Mar 30, 2010, at 6:29 AM, Martin Bowes wrote:

Quote:
Hi All,

The round() function in 9.2 has got me stumped to the point I think
it's a buggy version....

Has anyone got a quick primer with examples on what it should return?

If I do...
select round(1.99,-1), round(1.99, 0), round(1.99,1)
Why do I get 0, 1, 1 as the results?
I get 0, 2, 2 which I think is correct.

Quote:
Why are the data types of the answers all decimal(16,0)?
Mine are all decimal(4,2).

I'm running in main (10.0), so yes, I'd say you have a buggy
version. Funny thing is that I don't see any fixes in the edit
histories, though. You wouldn't have an OME round function
defined by any chance?

Karl



_______________________________________________
Info-Ingres mailing list
Info-Ingres (AT) kettleriverconsulting (DOT) com
http://ext-cando.kettleriverconsulti...fo/info-ingres

Reply With Quote
  #5  
Old   
Martin Bowes
 
Posts: n/a

Default Re: [Info-Ingres] round(), trunc() functions...is this a bug? - 03-30-2010 , 07:38 AM



Thanks Karl,

I've raised this as an Issue with the Corp as well.

I'll add the select d, ceil(d) stuff as well.

Marty

-----Original Message-----
From: Karl Schendel [mailto:schendel (AT) kbcomputer (DOT) com]
Sent: 30 March 2010 13:35
To: Martin Bowes
Subject: Re: [Info-Ingres] round(), trunc() functions...is this a bug?


On Mar 30, 2010, at 7:40 AM, Martin Bowes wrote:

Quote:
Hi Karl,

What do you get for:
create table xx as
select trunc(1.99,-1) as a, trunc(1.99, 0) as b, trunc(1.99,1) as
c;

0.00, 1.00, 1.90

I get the right answers for floor and ceil as well, but there
is something very fishy going on in main ... if I create a
table with a decimal(4,2) and insert -1.99 and 1.99,
select d from t1 returns -1.99 and 1.99,
but select d,ceil(d) from t1 returns
(-1.00, -1) and (1.99,2)
with similar garblings when floor is involved.
I'm going to take a look at this.

Karl

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.