-0
Is -0 a meaningful output ?
SQL> set numf 9
SQL> select -.1 from dual;
-.1
---
-0
not really
Is -0 a meaningful output ?
SQL> set numf 9
SQL> select -.1 from dual;
-.1
---
-0
not really
Put your code in <code> and </code> tags
December 21st, 2006 at 16:54
Having in mind that you have set numf to 9, yes it is meaningful
December 21st, 2006 at 20:06
is round(-.1) = 0 or -0 ? I think it is a bug
December 21st, 2006 at 23:08
You are right. I think it is a bug too.
December 21st, 2006 at 23:16
But NUMF isn’t rounding, it is the display of digits.
And, to quote Dicken’s Micawber..
“Annual income twenty pounds, annual expenditure nineteen nineteen six, result happiness. Annual income twenty pounds, annual expenditure twenty pounds ought and six, result misery.”
So yes, sometimes the -0 may be meaningful.
December 22nd, 2006 at 10:14
> But NUMF isn’t rounding
are you sure?
SQL> set numf 9
SQL> select 0.4 from dual;
0.4
—
0
SQL> select 0.6 from dual;
0.6
—
1
December 22nd, 2006 at 17:36
The same issue occurs when trying to specify column format
December 22nd, 2006 at 19:16
> is round(-.1) = 0 or -0 ?
0 == -0, so round(-.1) = 0 AND round(-.1) = -0
We happen to be used to represent the number zero as 0, but it seems perfectly legitime to represent it as -0 as well. Not that I like it, though….
December 22nd, 2006 at 20:26
select to_char(-0.1,’9′),round(-0.1),trunc(-0.1),ceil(-0.1) from duaL
-0 0 0 0
December 22nd, 2006 at 20:27
yes rené, but 1+1=+2, I rather say that 1+1=2
January 4th, 2007 at 23:58
“yes rené, but 1+1=+2, I rather say that 1+1=2″
I’m glad you wrote that, that was my spam protection question.