Page 1 of 1

Number parsing should be continuous

Posted: 06 Sep 2023, 07:25
by JMPSequeira

Code: Select all

a := 2. 2 ; 2.02
b := 2.
2 ; 2.02
It seems that numbers are parsed in the same fashion as concatenation and continuation operators, just a guess.
From a user stand point 2. 2 is not a number and if it is it's 2.2 and not 2.02.
Is this intended?

Re: Number parsing should be continuous

Posted: 07 Sep 2023, 03:56
by just me

Code: Select all

A := 2. ""
MsgBox(A) ; -> 2.0
A := 2. 2
MsgBox(Type(A) . " - " . A) ; -> String - 2.02

Re: Number parsing should be continuous

Posted: 07 Sep 2023, 13:08
by JMPSequeira
I see.
So does the string conversion of the first "2" cause the float conversion?

Re: Number parsing should be continuous

Posted: 10 Sep 2023, 06:52
by lexikos
There is no difference between 2., 2.0, 2.0000 and 0.2e1; they are all the same value.

Conversion of float to string always produces a string with at least one digit after the decimal point.

In this instance, you cause conversion to string by using concatenation. Passing the value to MsgBox would also do it.

Code: Select all

A := 2.
MsgBox(A) ; -> 2.0

Re: Number parsing should be continuous

Posted: 10 Sep 2023, 10:50
by joefiesta
As just an aside:

I find it absolutely amazing that V1 and V2 work differently with these two examples.
No wander I don't want to migrate. Is there any documentation that points out such tremendous differnces in operation of the 2 ahks?

In v1:

a := 2. 2 ; 2.2
MsgBox %a% ; -> 2.
A := 2. ""
MsgBox %a% ; -> 2.
A := 2. 2
MsgBox %a% ; -> 2.2
exitapp

Re: Number parsing should be continuous

Posted: 10 Sep 2023, 16:52
by lexikos
@joefiesta
Tremendous difference? :roll: 2. is a string in v1. If you do 2. * 1 you will get 2.0.

Changes from v1.1 to v2.0 documents this and all other changes.

Re: Number parsing should be continuous

Posted: 10 Sep 2023, 19:22
by thqby

Code: Select all

a := 2.
MsgBox a
The decimal point will also make the line continue, which is intentional?

Re: Number parsing should be continuous

Posted: 10 Sep 2023, 21:03
by lexikos
No, that's a bug. (a := 2.) would show the effect I intended.

Re: Number parsing should be continuous  Topic is solved

Posted: 24 Sep 2023, 00:31
by lexikos
The line continuation bug is fixed by v2.0.10.