[Gambas-user] If x <> +Inf Then [Error]

Jussi Lahtinen jussi.lahtinen at gmail.com
Wed Apr 19 03:31:24 CEST 2023


Yes, good point I completely forgot to address. I guess he meant something
like "If x <> ((2 ^ 31) - 1) Then".


Jussi

On Wed, Apr 19, 2023 at 4:25 AM Benoit Minisini <
benoit.minisini at gambas-basic.org> wrote:

> Le 18/04/2023 à 23:17, Martín a écrit :
> > Hi,
> >
> > There maybe are an error in the evaluation of expression:
> >
> > If x <> +Inf Then ...
> >
> > To reproduce the error you can use this code (it occurs in 3.18.2 &
> > 3.18.90 but not in 3.18.0)
> >
> > Public Sub Form_Open()
> >
> >    Dim i As Integer
> >    'Dim inFinito As Integer = (2 ^ 31) - 1
> >    Dim inFinito As Integer = +Inf
> >    Dim a As New Integer[]
> >
> >    For i = 0 To 9
> >      a.Add(Rand(0, inFinito))
> >    Next
> >
> >    For i = 0 To 9
> >      'If a[i] <> +Inf Then ' it doesn't works
> >      If a[i] <> inFinito Then ' it works
> >
> >        Print "Continua jugando"
> >      Else
> >        Print "Fin del juego"
> >      Endif
> >    Next
> >
> > End
> >
> >
> > Best regards
> >
> > Martin.
> >
>
> It should be fixed by last commit.
>
> Anyway, it makes no sense for me to compare an integer to '+Inf', which
> is a floating point constant that represents positive infinity.
>
> Regards,
>
> --
> Benoît Minisini.
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230419/87f36ab8/attachment.htm>


More information about the User mailing list