You need to sign in to do that
Don't have an account?
mdinatale
Round like php does
Im trying to round a decimal number just like php does but im having different outcomes with different numbers. I just need the standard round function like php. Ive tried these. Thanks foryour help
bpm = math.ceil(bpm); bpm = math.round(bpm); bpm = bpm.setscale(2); bpm = math.roundToLong(bpm);
I think that you should use setScale, but providing 2 parameters, the scale and the type of round you want to perform, (System.RoundingMode.HALF_UP I believe, if not, use the following link )
it would be something like the following
(IF bpm is a decimal type)
Regards
Refer following links. It will be helpful for your requirement
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_decimal.htm
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_math.htm
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.