开发者

Is there a round off function in J2ME?

开发者 https://www.devze.com 2023-02-08 23:58 出处:网络
I need roundoff function in J2ME. Math.round() does n开发者_如何学编程ot seem to exist. Please provide some assistance!Or you can use another approach:

I need roundoff function in J2ME. Math.round() does n开发者_如何学编程ot seem to exist. Please provide some assistance!


Or you can use another approach:

float value;
int base; //base to round

int round_down=(int )((int )(value/base))*base;
int round_up=(int )((int )(value/base+0.5))*base;


Math.ceil() or Math.floor() probably but these again are available only for CLDC 1.1 :)

0

精彩评论

暂无评论...
验证码 换一张
取 消