Jump to content

Possible bug in subtraction.


Recommended Posts

Can someone tell me why the following script outputs the wrong answer?

If you input 1234567 in the first inputbox and 1 in the second inputbox the output is 1.23457e+006

But in beta v3.1.1.127 the output was 1234566 (which was/is correct).

I saw this at:

http://www.autoitscript.com/forum/index.ph...st&p=136074

Fixed : Conversion from floating point to string now shows less precision to prevent displaying unexpected values. (by Valik)

I am not sure if that is what caused this problem, but I hope it will be fixed.

Or better yet, I hope it is something I am overlooking.

taurus905

#include <GUIConstants.au3>
GUICreate( "Subtraction Example", 300, 300, -1, -1, $WS_OVERLAPPEDWINDOW)

$Seven_Digits = GuiCtrlCreateLabel("Seven Digit Number:", 60, 60, 100, 20)
$Seven_Digits = GuiCtrlCreateInput("", 160, 55, 80, 20)

$One_Digit = GuiCtrlCreateLabel("One Digit Number:", 60, 120, 100, 20)
$One_Digit = GuiCtrlCreateInput("", 160, 115, 60, 20)

$Subtract_Button = GUICtrlCreateButton("Subtract", 120, 160, 80, 30)

GuiSetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Subtract_Button
        $Result = GUICtrlRead($Seven_Digits) - GUICtrlRead($One_Digit)
        $lblResult = GuiCtrlCreateLabel("Result:", 60, 220, 100, 20)
        GuiCtrlCreateInput($Result, 160, 215, 100, 20)
    EndSelect
WEnd
Exit

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

  • Developers

Can someone tell me why the following script outputs the wrong answer?

If you input 1234567 in the first inputbox and 1 in the second inputbox the output is 1.23457e+006

But in beta v3.1.1.127 the output was 1234566 (which was/is correct).

I saw this at:

http://www.autoitscript.com/forum/index.ph...st&p=136074

Fixed : Conversion from floating point to string now shows less precision to prevent displaying unexpected values. (by Valik)

I am not sure if that is what caused this problem, but I hope it will be fixed.

There is an issue in the 3.1.1.128 ..... will very likely be fixed/reverted in 3.1.1.129.

:D

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

There is an issue in the 3.1.1.128 ..... will very likely be fixed/reverted in 3.1.1.129.

:D

Thank you JdeB. That is good to know.

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...