T0M50N Posted August 4, 2013 Share Posted August 4, 2013 For example: 6.3 = 6 BUT 6.8 = 6 This means I can't simply use Round. Is there any way of doing this without having to convert it to a string? I have a feeling there is a mathematical function that already does this. Link to comment Share on other sites More sharing options...
Solution FireFox Posted August 4, 2013 Solution Share Posted August 4, 2013 Hi,Take a look at the Floor or Int function.Br, FireFox. Link to comment Share on other sites More sharing options...
T0M50N Posted August 4, 2013 Author Share Posted August 4, 2013 Worked thanks. Link to comment Share on other sites More sharing options...
FireFox Posted August 4, 2013 Share Posted August 4, 2013 You're welcome.Next time, look at the helpfile. You will see the related functions.Br, FireFox. Link to comment Share on other sites More sharing options...
T0M50N Posted August 4, 2013 Author Share Posted August 4, 2013 (edited) I looked and found the int function but without looking at the example It isn't obvious that it works in that way. Actually scratch that I misread "Fractional portions are truncated, so Int(1.999999) returns 1" Edited August 4, 2013 by T0M50N Link to comment Share on other sites More sharing options...
jchd Posted August 4, 2013 Share Posted August 4, 2013 Remark that Int() and Floor() are not identical functions over the reals: ConsoleWrite(Int(1.9876) & " " & Floor(1.9876) & @LF) ConsoleWrite(Int(-1.9876) & " " & Floor(-1.9876) & @LF) This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Belini Posted August 4, 2013 Share Posted August 4, 2013 can use StringMid and StringInStr too. $number = "6.3" $extract = StringMid($number, 1, StringInStr($number, ".", 2, 1) -1) MsgBox(4096, "test", $extract) My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
FireFox Posted August 4, 2013 Share Posted August 4, 2013 @BeliniThe OP said:Is there any way of doing this without having to convert it to a string? Link to comment Share on other sites More sharing options...
Belini Posted August 4, 2013 Share Posted August 4, 2013 Sorry, did not pay attention to this. My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
jchd Posted August 4, 2013 Share Posted August 4, 2013 Anyway a numeric string can be lead to contradictory results: $number = "1.9999999999999999999" $extract = StringMid($number, 1, StringInStr($number, ".", 2, 1) -1) MsgBox(4096, "test", $extract) This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with 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