# Thread: Half adjust for numeric variables

1. ## Half adjust for numeric variables

Is there any functions to perform a half adjust on the numeric value.

For example,

NumA = 0.153698712 --> 0.1537
NumB = 0.153661282 --> 0.1537

If the requirement is to check the accuracy up to 4 decimal places, the above two number should be treated the same.

Is there any functions/operators to achieve cutting & adjusting a numeric value into another variable with a specified decimal places?

2. ## Re: Half adjust for numeric variables

Use int():

NumARounded = int(NumA*1000 + 0.5) / 1000;

Regards,
Juergen

3. ## Re: Half adjust for numeric variables

sprintf() is good too.

4. ## Re: Half adjust for numeric variables

Thanks to bru and Peter. I have tried and it is working now.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 11:06 PM.