Sign in to follow this  
Followers 0
MaximusCZ

Rounding behind decimal dot

4 posts in this topic

Hi, I have a problem. I am coppying one string from one textbox to another. Second textbox automaticly round it, but I need to check if It was pasted right (sometimes it fails, not problem of autoit, dont bother)

Well, I got situation, when I have to copy 50.20490. When I copy it, It will round to 50.20 (thats OK) but once I select it from first form and round it by autoit function, I got 50.2, but I need 50.20

$A = 50.20490

$B = Round ($A, 2)

$B = 50.2

I need $B = 50.20

Thanks for your help

Share this post


Link to post
Share on other sites



Never mind. I figured it out.. I Rounded that first var, so now im not comparing 50.20 with 50.2, but 50.2 to 50.2... Thanks for quick reply all of you;)

And I dont see the point of not being able to edit my own posts, when there are no posts under it

Share this post


Link to post
Share on other sites

Hi, I have a problem. I am coppying one string from one textbox to another. Second textbox automaticly round it, but I need to check if It was pasted right (sometimes it fails, not problem of autoit, dont bother)

Well, I got situation, when I have to copy 50.20490. When I copy it, It will round to 50.20 (thats OK) but once I select it from first form and round it by autoit function, I got 50.2, but I need 50.20

$A = 50.20490

$B = Round ($A, 2)

$B = 50.2

I need $B = 50.20

Thanks for your help

$A = 50.20490
$B = stringformat("%0.2f",$A)
ConsoleWrite($B & @CRLF)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Never mind. I figured it out.. I Rounded that first var, so now im not comparing 50.20 with 50.2, but 50.2 to 50.2... Thanks for quick reply all of you;)

And I dont see the point of not being able to edit my own posts, when there are no posts under it

You should be able to edit your own posts, but maybe there is a restriction that you have to have 5 posts or some number first.

Welcome to the AutoIt forums :mellow:.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0