Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello everybody, I'm trying to

Status
Not open for further replies.

PERO101

Programmer
May 21, 2003
1
US
Hello everybody,
I'm trying to convert two values and ceil it but my result is zero. Could anyone shed some light on this issue.

Example
SELECT CEIL(4/60), CEIL(0.06)
FROM SYSIBM.SYSDUMMY1

MY RESULT SET WAS 0, 1.0

Could anyone explain why I'm getting dive in ceil when i divide 4/6. I tried this in DB2 FOR OS/390 vERSION 6.1

Thanks in advance!
 
should that be
SELECT CEIL(60/4), CEIL(0.06)
FROM SYSIBM.SYSDUMMY1

as I'm reading it CEIL(4/60) is going to equate to 0 being the correct value it should. per 0.0666666 applied to the CEIL function will result in 0

let me know if I'm way off. haven't the exp. of most in this field.

_________________________________________________________
$str = "sleep is good for you. sleep gives you the energy you need to function";
$Nstr = ereg_replace("sleep","coffee",$str); echo $Nstr;

onpnt2.gif
[/sub]
 
Ceil function does not work properly with more than 15 digits. Decimal values are converted to double, so internally 4/60 is possibly handled like
0.066666666666666666666666666666666666666667 and ceil function will fail to work properly.
What happens if you cast the 4/60 with limited scale?



T. Blom
Information analyst
tbl@shimano-eu.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top