ShadowElf Posted November 26, 2009 Share Posted November 26, 2009 I want to format a number to limit it at 2 zecimals as in example if I have $x=1234.568 $y=1234.562 format($x) to return $x=1234.57 because 8>5 format($y) to return $y=1234.56 because 2<5 exist what I want? or I have to do one? I like IT: php, mysql, codeingiter, css, jquery and AUTOIT Link to comment Share on other sites More sharing options...
Mison Posted November 26, 2009 Share Posted November 26, 2009 Round Hi ;) Link to comment Share on other sites More sharing options...
funkey Posted November 26, 2009 Share Posted November 26, 2009 (edited) $x = 1234.568 $y = 1234.562 $z = 1234.003 ConsoleWrite(StringFormat("%.2f", $x) & @LF) ConsoleWrite(StringFormat("%.2f", $y) & @LF) ConsoleWrite(StringFormat("%.2f", $z) & @LF) ConsoleWrite(Round($x, 2) & @LF) ConsoleWrite(Round($y, 2) & @LF) ConsoleWrite(Round($z, 2) & @LF) Edited November 26, 2009 by funkey Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
omikron48 Posted November 26, 2009 Share Posted November 26, 2009 (edited) $x=1234.568 $y=1234.562 MsgBox(0x2000, "", "x = " & Round($x, 2)) MsgBox(0x2000, "", "x = " & Round($y, 2)) Check the help file. EDIT: Wow. Split second postings... x_x Edited November 26, 2009 by omikron48 Link to comment Share on other sites More sharing options...
ShadowElf Posted November 26, 2009 Author Share Posted November 26, 2009 thx all, strigformat do what I want I like IT: php, mysql, codeingiter, css, jquery and AUTOIT Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now