Number parsing should be continuous Topic is solved

Report problems with documented functionality
JMPSequeira
Posts: 7
Joined: 08 Nov 2021, 19:04

Number parsing should be continuous

Post by JMPSequeira » 06 Sep 2023, 07:25

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?

just me
Posts: 9508
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Number parsing should be continuous

Post by just me » 07 Sep 2023, 03:56

Code: Select all

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

JMPSequeira
Posts: 7
Joined: 08 Nov 2021, 19:04

Re: Number parsing should be continuous

Post by JMPSequeira » 07 Sep 2023, 13:08

I see.
So does the string conversion of the first "2" cause the float conversion?

lexikos
Posts: 9626
Joined: 30 Sep 2013, 04:07
Contact:

Re: Number parsing should be continuous

Post by lexikos » 10 Sep 2023, 06:52

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

joefiesta
Posts: 498
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Re: Number parsing should be continuous

Post by joefiesta » 10 Sep 2023, 10:50

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

lexikos
Posts: 9626
Joined: 30 Sep 2013, 04:07
Contact:

Re: Number parsing should be continuous

Post by lexikos » 10 Sep 2023, 16:52

@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.

User avatar
thqby
Posts: 417
Joined: 16 Apr 2021, 11:18
Contact:

Re: Number parsing should be continuous

Post by thqby » 10 Sep 2023, 19:22

Code: Select all

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

lexikos
Posts: 9626
Joined: 30 Sep 2013, 04:07
Contact:

Re: Number parsing should be continuous

Post by lexikos » 10 Sep 2023, 21:03

No, that's a bug. (a := 2.) would show the effect I intended.

lexikos
Posts: 9626
Joined: 30 Sep 2013, 04:07
Contact:

Re: Number parsing should be continuous  Topic is solved

Post by lexikos » 24 Sep 2023, 00:31

The line continuation bug is fixed by v2.0.10.

Post Reply

Return to “Bug Reports”