meta data for this page
  •  

F_RAPPENRUNDUNG

function from adhoc

Entrypoint softround compatible with UTF-8


Inputs/Outputs

   Input      DOUBLE      floatingpoint to be round
   Output     INTEGER     floatingpoint rounded as rule Rappenrundung

Syntax

   Own translation from Wikipedia [[http://de.wikipedia.org/wiki/Rundung#Rappenrundung]]
   A special form of rounding in Switzerland is the so called Rappenrundung. In Switzerland people allways count with Rappen (the smaller denomination of a swiss franc, a hundredth of a franc) but amounts of less than 5 Rappen where not paid or bring to account. By this the amounts have to been rounded. The commercial procedure is as follows:
   Importend for the way of rounding is the middle between 0 and 5 Rappen (or between 5 and 10 Rappen). If the value is greater or equal to the middle, you must round up, otherwise round down.
   TestSQL
   SELECT '1.00' AS ISCORRECT, F_RAPPENRUNDUNG(1.000) FROM RDB$DATABASE;
   SELECT '1.00' AS ISCORRECT, F_RAPPENRUNDUNG(1.024) FROM RDB$DATABASE;
   SELECT '1.05' AS ISCORRECT, F_RAPPENRUNDUNG(1.025) FROM RDB$DATABASE;
   SELECT '1.05' AS ISCORRECT, F_RAPPENRUNDUNG(1.074) FROM RDB$DATABASE;
   SELECT '1.10' AS ISCORRECT, F_RAPPENRUNDUNG(1.075) FROM RDB$DATABASE;
   SELECT '1.10' AS ISCORRECT, F_RAPPENRUNDUNG(1.099) FROM RDB$DATABASE;
   SELECT NULL AS ISCORRECT, F_RAPPENRUNDUNG(NULL) FROM RDB$DATABASE;