I would not be misunderstood. I had understood that Alex wanted a forced increase "Round".
To recap: Dim n As Float = 26.6601666666666 Dim b As Byte Print Int(n * 100) / 100 ' Normal truncate, as already mentioned by other Print Round(n, -2) ' Normal round, as already mentioned by other If Len(CStr(Frac(n))) > 4 Then b = Val(Mid(CStr(Frac(n)), 5, 1)) If b >= 5 Then Print Round(n, -2) Else Print Round(n + 0.01, -2) ' Forced increase round, as proposed by me Endif Endif Regards Gianluigi 2017-07-13 17:31 GMT+02:00 PICCORO McKAY Lenz <mckaygerh...@gmail.com>: > 2017-07-13 1:46 GMT-04:00 bb <adamn...@gmail.com>: > > > I always round i.e. Print Round(26.6601666666666,-2) --> > > the digits see -> .660 > > > > which is 26.66 by the way, not 26.67! (I have no idea how you got that.) > > > due 660 and -2 said the firts two digits, the round will take effect only > in last digit.. due the last no have another mayor than 5, then let in "6" > > sorry i dont know how to explain, i deal with this several months ago and > solve it in that way > > > > > > > > > b > > > > > > > > > > On 13/07/17 15:09, alexchernoff wrote: > > > >> Peace to all, > >> > >> this might a bit silly but what is the best way to format float values > >> like > >> 26.6601666666666 into having two digits AND/OR with rounding them? > >> > >> e.g. > >> > >> 26.6601666666666 becomes 26.66 shortened > >> 26.6601666666666 becomes 26.67 rounded > >> > >> cheers! > >> > >> > >> > >> > >> > >> -- > >> View this message in context: http://gambas.8142.n7.nabble.c > >> om/Best-ways-to-format-float-values-tp59733.html > >> Sent from the gambas-user mailing list archive at Nabble.com. > >> > >> ------------------------------------------------------------ > >> ------------------ > >> Check out the vibrant tech community on one of the world's most > >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot > >> _______________________________________________ > >> Gambas-user mailing list > >> Gambas-user@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/gambas-user > >> > >> > > > > ------------------------------------------------------------ > > ------------------ > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > _______________________________________________ > > Gambas-user mailing list > > Gambas-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/gambas-user > > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user