[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
Solved

# Using the Round function in Sybase 12.5

Posted on 2006-03-27
Medium Priority
5,640 Views
If I have the following table:

Table
---------
ID(integer)   Cost(float)
2                1.1499999999999999

and then run the following update:

update Table
set Cost = round((Cost + 1),2)
where  ID=2

the result is:

Table
---------
ID(integer)   Cost(float)
2                2.1499999999999999

Why isn't Round rounding and what do I achieve the desired affect (where Cost is rounded to 2.15)?

0
Question by:-Pollo-
1 Comment

LVL 2

Accepted Solution

ID: 16303865
Well, it is. The "problem" is this: the base-10 real number 2.15 (and many others) has no exact representation in the floating-point scheme used by Sybase for type float (because it's not base-10, it's base 2 or 16 -- can't remember which). 2.14999999999999 is as good as it gets. Should this worry you? Probably not. Unless you are really concered with precision down to like the 15th position you can safely use floats -- but people will be confused if they are viewing them with many decimal digits.

0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Will the future of mobile app development include the same trends as those most relevant today? Find out by checking out the 7 trends of the future.
Applications for our next round of the Experts Exchange Scholarship Contest are starting to roll in. It made us wonder what our past winners are up to these days. Here's a look at what four winners experienced with the contest and what they're doing…
Integration Management Part 2
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
###### Suggested Courses
Course of the Month19 days, 1 hour left to enroll