Jump to content

Recommended Posts

  • Moderators
Posted (edited)

grzesiek,

Does this give you a hint as to why it does not?

Local $v = (24.60 * 1.3) / 1.23
ConsoleWrite($v & @CRLF)
ConsoleWrite(VarGetType($v) & @CRLF)
ConsoleWrite(IsInt($v) & @CRLF)
ConsoleWrite(Hex($v) & @CRLF)
ConsoleWrite(@CRLF)

Local $w = 31.98 / 1.23
ConsoleWrite($w & @CRLF)
ConsoleWrite(VarGetType($w) & @CRLF)
ConsoleWrite(IsInt($w) & @CRLF)
ConsoleWrite(Hex($w) & @CRLF)
ConsoleWrite(@CRLF)

ConsoleWrite(($v = $w) & @CRLF)

M23

Edited by Melba23
Wrong button - too soon

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (edited)

Floating point maths is not always 100% accurate - it's just fast. There is a margin of error which is normally very small. Using Int() will force an integer, but you can only do that if you know the result is an integer. I have spent time looking into this and written a library of functions to do simple calculations of this type using fractions:  https://www.autoitscript.com/forum/topic/165558-fraction/

It's more bother to use fractions, but wildly more accurate than floats are ever likely to be, either now or in the future.

Edited by czardas
Posted

you can always asc / 2

Local $v = (24.60 * 1.3) / 1.23
Local $frmt = Asc(Hex($v)) / 2
msgbox(0, '' , $frmt & @LF & VarGetType($frmt) & @LF & IsInt($frmt))

 

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Posted (edited)

26 - double - 1   what exactly is not working?

unless your issue was with *always*, and i would concede that there may be edge cases

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Posted (edited)

cmon!  every answer is 52 :)

I expected a right proper dismantling

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

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
×
×
  • Create New...