When I try:

select cast( 141.70 * 100 as integer)

I get 0.69, but should get 0.70

What's the problem? Seems like a bug.

I tried some other numbers in place of 141.70, and they worked OK, though I imagine there are others that have the bug that I just haven't tried.

The above is the isolated buggy part of a formula I use to round of real amounts to two fixed decimal places:

select
        substr(
                '      $' || cast( Total as integer ) || '.'
                        || substr( cast( Total * 100 + 100 as integer ), -2, 2 )
                , -10, 10
        )
from ( select 141.70 as Total )
;

which gives $141.69 but should give $141.70

Is there a more reliable way, using only SQLite?

Thanks,
Tom


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to