ROUND malfunction...!?!



Please correct me or explain me how this works or otherwise it seems quite like a really bad bug.

Here is an example of query where I am summing two numbers and rounding the number two digits after the decimal point:


select round(sum(x.some_number),2.0) round_sum,
           round((0.2440 + 0.0010),2.0) other_number,
          (0.2440 + 0.0010) just_number,
          round(0.2450,2.0) other_round_number
 from (select 0.2440 as some_number
            union all
            select 0.0010 as some_number) x;

the result for all of these calculations are:

round_sum  other_number just_number  other_round_number

0.24                      0.24                      0.2450                          0.24


All of these results are incorrect except “just_number”.

I have double checked with calculator, excel or whatever other tool which is smart enough to round numbers. And all of these give out result: 0.25!!! Which is correct. :)

How can you explain that? :)


And it is on v7.1


  • Hi!

    For me looks like a bug. My explanation why its look like a bug:
    daniel=> select round(1.005, 2.0), round(1.105, 2.0), round(1.205, 2.0), round(1.305, 2.0);
    round | round | round | round
    1 | 1.1 | 1.21 | 1.3
    (1 row)
    Lets check its not a problem of inexact values of floats and implicitly will convert all values to money data type [witch is NUMERIC(18,4)]
    daniel=> select round(1.005::money, 2.0), round(1.105::money, 2.0), round(1.205::money, 2.0), round(1.305::money, 2.0);
    round | round | round | round
    1 | 1.1 | 1.21 | 1.3
    (1 row)

  • Hi mr. „id10t”! :)

    Thanks for your replay and for that you confirmed my assumption that this is a bug.
    And it is quite bad bug – basically it means if I have some kind of calculations and out coming number has more than one digit after decimal point, which is important to me, they are all wrong if I use ROUND function. :(

    Perhaps you know – is there a way to report the bug to HP Vertica? Or this post is the only way to drag the attention of support team and hope that they will fix it?

  • Hi!

    Any way I will post an answer ;)

    Sorry Im not an EE customer, I can't open a ticket, I just tried to investigate from my point of view. Also Im not a Vertica employee so I can't declare that is a bug, only Vertica engineers/employees can do it.
    Perhaps you know – is there a way to report the bug to HP Vertica?
    Only EE customers can open a ticket and there are 2 ways - and mail. From obvious reasons I can't post rules for mail reports, but if you are enterprise customer you can contact with your sales agent.

    I'm sorry, that was useless.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file