All, I am using the function below to convert a continuous variable to a binned value. Sometimes a value other than zero is passed through the query. For example -.5 result value is passed to the query result. The basic of the query is below.
select incentivebin(wac, rate, .25) from my_table where incentivebin(was, rate, .25) = 0 I have checked the function works correctly and the raw values match those values expected from simple subtraction and are in the correct bin. I am not sure why some values would be allowed through the query. Any ideas would be appreciated. Best, Glenn CREATE or REPLACE FUNCTION embs_owner.IncentiveBin(IN "Gwac" double precision, IN "MtgRate" double precision, IN "BinSize" double precision) RETURNS double precision LANGUAGE 'sql' PARALLEL SAFE AS 'select ceiling(($1 - $2)/$3) *$3'; ALTER FUNCTION embs_owner.IncentiveBin(double precision, double precision, double precision) OWNER TO embs_owner;