goldenix Posted April 20, 2009 Posted April 20, 2009 (edited) Is ther an easier way? a built in func?How do you determine is X 1 or 2 if the value is 0,5 ? is there maybe a standard or something?$x = '1.9' $array = StringSplit($x, '.', 1) If $array[2] >= 5 Then $x = $array[1] + 1 ConsoleWrite($x & @CRLF)EDIT: Solution is ROUND($X,0) because I want no decimal places Edited April 20, 2009 by goldenix My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
weaponx Posted April 20, 2009 Posted April 20, 2009 Here is one way to separate the integer and fraction parts of a number. $x = 1.9 $Integer = Int($x) $Fraction = $x-$Integer MsgBox(0,"","Integer: " & $Integer & @CRLF & "Fraction: " & $Fraction)
NBJ Posted April 20, 2009 Posted April 20, 2009 (edited) @goldenix are you looking to round up your numbers?try: Ceiling Returns a number rounded up to the next integer.Ceiling ( expression )eg $x = Ceiling(1.9) ConsoleWrite($x & @CRLF)You can also look at Round(), Floor(), Int()Hope thats what you are afterCheersNBJedit: reference to Floor() Round() Int()edit: after re reading again i I think you are after : ROUND($X,0) Edited April 20, 2009 by NBJ
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