Modify

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#1881 closed Bug (No Bug)

_VersionCompare

Reported by: hunt Owned by: Gary
Milestone: Component: Standard UDFs
Version: 3.3.6.1 Severity: None
Keywords: Cc:

Description

$Version1 = "1.9.1"

$Version2 = "1.10"
MsgBox(0,"",_VersionCompare($Version1, $Version2)) ==
returns 1 but must -1

$Version1 = "1.9.b"

$Version2 = "1.10"
MsgBox(0,"",_VersionCompare($Version1, $Version2)) ==
returns 1 but must -1

$Version1 = "1.9b"

$Version2 = "1.10"
MsgBox(0,"",_VersionCompare($Version1, $Version2)) ==
returns 1 but must -1

Attachments (0)

Change History (4)

comment:1 Changed 13 years ago by mvg

Documented (well kinda) Function limitation. (No bug)

  • All these compares are done in lexicographical mode.
  • Ergo: 1.9xxx > 1.1xxx and/or 9xxx > 1xxx.

DOC
Remarks
This will try to use a numerical comparison but fall back on a lexicographical comparison.
See @extended for details about which type was performed.

comment:2 Changed 13 years ago by Jpm

  • Resolution set to No Bug
  • Status changed from new to closed

comment:3 Changed 13 years ago by anonymous

If UBound($aVersion1) <> UBound($aVersion2) Then will lexicographical comparison without numerical comparison but this is WRONG.

comment:4 Changed 13 years ago by mvg

No. Nothing wrong with that.

  • Its stated that it will try to do a numerical compare.

    This will try to use a numerical comparison but fall back on a lexicographical comparison.

If you like it to behave differently recode your local copy.
Or provide the function with (better matching) version strings that will be compared in numerical mode.

(case closed for me. Ergo: not commenting on it anymore. (try forum for additional feedback/talking on this))

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Gary.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.