LC converts phone number to scientific notation

Klaus major-k klaus at major-k.de
Sat Sep 10 12:48:29 EDT 2022


Hi Mark,

> Am 10.09.2022 um 08:55 schrieb Mark Waddingham via use-livecode <use-livecode at lists.runrev.com>:
> 
> On 2022-09-09 11:40, Klaus major-k via use-livecode wrote:
>> Hi Panos,
>>> Am 09.09.2022 um 12:27 schrieb panagiotis m via use-livecode <use-livecode at lists.runrev.com>:
>>> Hello Klaus,
>>> I guess what happens here is that if you fetch item X of line Y and use it
>>> directly, LC treats it as a number and displays it in scientific notation.
>> obviously!
> 
> Panos isn't correct here...
> None of the code you posted would cause a string to be converted to a number - the engine only does that when you pass a string to something which expects a number (and returns one).
> Specifically the 'item' chunk is a string chunk - it just manipulates fetches or stores sequences of characters into other sequences of characters.
> So the problem you are having is elsewhere - and not in the code which reorders the strings of the lines you have imported.
> It is either happening when you import the data, or when you are displaying it.

Well, the imported (dropped) file does not contain these strings then I am only
setting the text of a field to the collected lines (tNewLine) after the repeat loop:
...
put item 9 of tLine into item 6 of tNewLine
...

> Indeed, LCS doesn't use scientific notation when converting numbers to strings implicitly - you need to use `format()` to get numbers in that string form.

Hm, the debugger also has this problem and the bug does not seem to be fixed yet:
<https://quality.livecode.com/show_bug.cgi?id=17533>
<https://quality.livecode.com/show_bug.cgi?id=20731>

OK, anyway, do you have a hint on how to debug this with my 60000 lines file?
I checked the "item 9" (see above) and even "item 6 of tNewLine" after the line above for scientific notation, 
no dice, I can only see this behavior in the field after I filled in the new data?

Will keep on exploring...

> However, LCB *does* use scientific format when converting numbers to strings (currently at least - we've got an item on the todo list to improve that behavior). For example, the variable viewer in the SE is a treeview widget, so if a variable holds a number that will display in scientific notation if it has above a certain number of significant digits.

Thanks for chiming in!

> Warmest Regards,
> 
> Mark.
> 
> -- 
> Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
> LiveCode: Everyone can create apps

Best

Klaus

--
Klaus Major
https://www.major-k.de
https://www.major-k.de/bass
klaus at major-k.de




More information about the use-livecode mailing list