dbkaynor Posted February 4, 2008 Posted February 4, 2008 Is there a function to convert scientific notation to a decimal number? I am using GUICtrlCreateInput to get a value to use in calculations. It works fine with decimal numbers but with scientific notation the read value is correct in string form but wrong when converted to a number ;----- Sample code ------ #include <GUIConstants.au3> Global $Form1 = GUICreate(@ScriptName, 250, 220, 10, 10) Global $ButtonTest = GUICtrlCreateButton("Test", 10, 10, 70, 20) Local $InputTest = GUICtrlCreateInput("1", 90, 10, 150, 20, -1) GUISetState(@SW_SHOW) While 1 Local $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $ButtonTest local $T = GUICtrlRead($InputTest) Local $msg = "In:" & $T & " Out:" & $T * 1 MsgBox(0, "test", $msg) EndSwitch WEnd
erezlevi Posted February 4, 2008 Posted February 4, 2008 Is there a function to convert scientific notation to a decimal number? I am using GUICtrlCreateInput to get a value to use in calculations. It works fine with decimal numbers but with scientific notation the read value is correct in string form but wrong when converted to a number;----- Sample code ------#include <GUIConstants.au3>Global $Form1 = GUICreate(@ScriptName, 250, 220, 10, 10)Global $ButtonTest = GUICtrlCreateButton("Test", 10, 10, 70, 20)Local $InputTest = GUICtrlCreateInput("1", 90, 10, 150, 20, -1)GUISetState(@SW_SHOW)While 1 Local $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $ButtonTest local $T = GUICtrlRead($InputTest) Local $msg = "In:" & $T & " Out:" & $T * 1 MsgBox(0, "test", $msg) EndSwitchWEndHi,can you send the numbers that you try to convert to and from?
weaponx Posted February 4, 2008 Posted February 4, 2008 You can use Execute() #include <GUIConstants.au3> Global $Form1 = GUICreate(@ScriptName, 250, 220, 10, 10) Global $ButtonTest = GUICtrlCreateButton("Test", 10, 10, 70, 20) Local $InputTest = GUICtrlCreateInput("10e3", 90, 10, 150, 20, -1) GUISetState(@SW_SHOW) While 1 Local $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $ButtonTest local $T = GUICtrlRead($InputTest) Local $msg = "In:" & $T & " Out:" & Execute($T) MsgBox(0, "test", $msg) EndSwitch WEnd
erezlevi Posted February 4, 2008 Posted February 4, 2008 You can use Execute() #include <GUIConstants.au3> Global $Form1 = GUICreate(@ScriptName, 250, 220, 10, 10) Global $ButtonTest = GUICtrlCreateButton("Test", 10, 10, 70, 20) Local $InputTest = GUICtrlCreateInput("10e3", 90, 10, 150, 20, -1) GUISetState(@SW_SHOW) While 1 Local $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $ButtonTest local $T = GUICtrlRead($InputTest) Local $msg = "In:" & $T & " Out:" & Execute($T) MsgBox(0, "test", $msg) EndSwitch WEnd Nice!
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