[Solved]_5,9 == 6

Recommended Posts

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 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]

Share on other sites

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)```

Share on other sites

@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 after

Cheers

NBJ

edit: reference to Floor() Round() Int()

edit: after re reading again i I think you are after :

ROUND(\$X,0)

Edited by NBJ

Create an account

Register a new account