View Issue Details

IDProjectCategoryView StatusLast Update
0025061FPCDocumentationpublic2015-11-28 14:40
ReporterBart BroersmaAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.6.2Product Build 
Target Version3.0.0Fixed in Version3.0.0 
Summary0025061: Documentation on RomanToInt is wrong w.r.t. "invalid characters".
DescriptionDocs say: "RomanToInt returns the decimal equivalent of the Roman numerals in the string S. Invalid characters are dropped from S".

Dropped would suggest that the characters were not "translated", so e.g. 'MCAZ' would be treated as 'MC'.

In fact any illegal character in S will make the function return 0 (zero).
Steps To Reproduceprogram test;
{$mode objfpc}
{$H+}
uses
  StrUtils;
begin
  writeln('RomanToInt(''MCA'') = ',RomanToInt('MCA'));
end.

C:\Users\Bart\LazarusProjecten\ConsoleProjecten>fpc test.pas
Free Pascal Compiler version 2.6.2 [2013/02/12] for i386
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling test.pas
Linking test.exe
14 lines compiled, 2.7 sec , 59712 bytes code, 12796 bytes data

C:\Users\Bart\LazarusProjecten\ConsoleProjecten>test
RomanToInt('MCA') = 0
Additional Information"RomanToInt returns the decimal equivalent of the Roman numerals" is open for interpretation as well.
The equivalent of 'MIIM' should by all means be: "this is not a valid Roman numeral" and not 2000 (calcutated as 1000 + 1 + (1000 - 1)).
TagsNo tags attached.
Fixed in Revision1065
FPCOldBugId
FPCTarget
Attached Files

Activities

Bart Broersma

2013-09-29 23:25

reporter   ~0070446

After applying the patch from issue 0025112, probably the docs need a little bit more rewriting?

Michael Van Canneyt

2014-01-24 15:46

administrator   ~0072637

Fixed, thanks for reporting.

Issue History

Date Modified Username Field Change
2013-09-20 18:43 Bart Broersma New Issue
2013-09-20 18:43 Bart Broersma Status new => assigned
2013-09-20 18:43 Bart Broersma Assigned To => Michael Van Canneyt
2013-09-29 23:25 Bart Broersma Note Added: 0070446
2014-01-24 15:46 Michael Van Canneyt Fixed in Revision => 1065
2014-01-24 15:46 Michael Van Canneyt Note Added: 0072637
2014-01-24 15:46 Michael Van Canneyt Status assigned => resolved
2014-01-24 15:46 Michael Van Canneyt Fixed in Version => 2.7.1
2014-01-24 15:46 Michael Van Canneyt Resolution open => fixed
2014-01-24 15:46 Michael Van Canneyt Target Version => 2.8.0
2015-11-28 14:40 Bart Broersma Status resolved => closed