I am having issues with how decimals are rounded… I have investment products where fee charges are calculated as ‘account value * 0.01 / 4’ for some products, and breakpoints that may equal value * .008 / 4.
The issues is when these values are retrieved from the database they may equal 0.00999 or 0.00812… when a client has million dollar plus accounts these small differences in rates make large differences in fee charges.

I have tried ceil, multiplying by 1000, ceil and round, dividing by 1000 and doing the fee calc, but the results are still wrong. I can’t have client fees being wrong.

How do I get a decimal limited to 0.08 or 0.085 if needed?

Never use doubles in accounting / financial software. This has been conventional wisdom for more than 40 years. Use Int64 values with a fixed number of decimals. Use integers for all internal calcualtions and then divide out the number of decimals for display only.

What Database? What kind of column? If such column is a floating point kind of column, as double, you may have small amount differences.

Most DBMS have proper decimal (numeric) fields to handle such kind of values with fixed decimals. That’s not the case of simple engines as SQLite (Numbers are Integers or Doubles). In Xojo, internally, we handle those values as Currency (fixed 4 decimals) but all intermediate calculations are done as doubles, so be careful anyway.