DECIMALS
- Posted by Jean Hendrickx <jean.hendrickx at INFOBOARD.BE> Feb 23, 1997
- 956 views
I wrote a little function to round a number to a expected number of decimals. File added. But I decouver that I cannot enter more than 5 decimals in a atom. More decimals are automaticaly rounded to 5 decimals. Are there any solution ? Thanks J Hendrickx. --RONDECI.EX -- round a number at a fixed number of decimals include get.e atom vv, i, dec vv= 2.594567894 -- the number dec=3 -- number of decimal function rondxdec(atom n, integer dec) -- (number, nber of decimals to keep) atom pivot, balance pivot =0.5*(power(10,-dec)) balance=power(10,dec) n=(floor((n + pivot) * balance))/balance return n end function clear_screen() i = rondxdec(vv,dec) ? i