×

In celebration of the 50th anniversary of Apollo 11's Moon Walk, we are offering \$50 off our SparkFun Inventor's Kit for RedBot and the Arduino Engineering Kit while supplies last! Use promo code APOLLO11 at checkout until 11:59 p.m. MT to get yours today!

# Member #1181579

Member Since: October 19, 2017

Country: Albania

• Thank you for your quick reply and for solution !

I found a solution but your solution is the right.

this is my solution: double B = (int) (currentReading * 1000.0 ) / setting_division_value ;

double C = (B * 1000.0 + 0.5) / 1000.0 ;

double D = (C / 1000.0) * setting_division_value ;

double R = (D * 1000.0 + 0.5) / 1000.0 ;

"setting_division_value" is saved in the memory by the user.

Regards,

• Can anyone help me to solve this problem. I want to round three decimals with the number assigned by a graduator 2 gr ,5 gr, 10 gr, 50 gr ,100 gr. For example, if we have currentReading 1.251 kg and we want the accuracy of 5 gr the total weight must be displayed 1.250 and if we have currentReading 1.253 kg weight must be displayed 1.255 and so on.. Thanks in advance!

No public wish lists :(

In 2003, CU student Nate Seidle fried a power supply in his dorm room and, in lieu of a way to order easy replacements, decided to start his own company. Since then, SparkFun has been committed to sustainably helping our world achieve electronics literacy from our headquarters in Boulder, Colorado.

No matter your vision, SparkFun's products and resources are designed to make the world of electronics more accessible. In addition to over 2,000 open source components and widgets, SparkFun offers curriculum, training and online tutorials designed to help demystify the wonderful world of embedded electronics. We're here to help you start something.