have to go back over a decade, but I remember issues with converting scientific notation to decimal with excel and other data. WB made the conversion easy. Below is a stab from the past
;uncomment each to test
;sci = "5.7303333333e+02"
sci = "9.87E-02"
;sci = "6.022E23" ;too large will fail, but can be done with MSScriptControl.ScriptControl
num = sci + 0 ;convert to decimal
Message("Result", sci:@lf:num)
;for very large values, like the one above that fails
sci = "6.022E23"
oS = CreateObject("MSScriptControl.ScriptControl")
oS.Language = "VBScript"
oS.AllowUI = @FALSE
num=oS.Eval(: 'FormatNumber(%sci%,0,,-1)')
oS = 0
Message("Result", sci:@lf:num)
Exit
You can do the same thing with a HughMath extender. A conversion UDF can be found here.
https://docs.winbatch.com/mergedProjects/HUGEMATH/HUGEMATH/HUGEMATH_U__001.htm
You can convert to a comma seperated integer using the HugeMath options function:
AddExtender("WWHUG44I.DLL", 0 , "WWHUG64I.DLL")
fnum=6.022E23
num=UDFCvtFloatToHuge(fnum)
huge_SetOptions (1, 0, 0, 1, 0, 0, 0)
num=huge_Add(num,0)
Pause(fnum,num)
exit
Admittedly, the "MSScriptControl.ScriptControl" solution is simpler. Just throwing up an alternative to avoid doing any real work this morning.
It is worth considering how the optional parameters for NumberFormat work. The first parm should consider the number of decimal places to the right, the last, if -1 will include the negative number in parenthesis.
if sci = "6.022E-06"
num=oS.Eval(: 'FormatNumber(%sci%,0,,0)') ; gives 0
num=oS.Eval(: 'FormatNumber(%sci%,6,,0)') ; gives 0.000006
;Parentheses only visible with actual negative numbers, so
;if sci = "-6.022E-06"
num=oS.Eval(: 'FormatNumber(%sci%,6,0,-1)') ; gives (.000006)
One final note: the MS scriptcontrol will only run in 32 bit. There is a 64-bit alternative: https://tablacus.github.io/scriptcontrol_en.html
I downloaded, ran setup and simply changed the code I posted
;oS = CreateObject("MSScriptControl.ScriptControl")
oS = CreateObject("ScriptControl")
and it ran in both 32/64 bit WB
Interesting that someone would take the time to create the 64-bit version. Or at least prompt an AI agent to create one.