octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #59314] [octave forge] (mapping) str2angle fai


From: Rafael Laboissiere
Subject: [Octave-bug-tracker] [bug #59314] [octave forge] (mapping) str2angle fail to parse sgring with UTF-8 degree (°) character
Date: Wed, 21 Oct 2020 11:06:20 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?59314>

                 Summary: [octave forge] (mapping) str2angle fail to parse
sgring with UTF-8 degree (°) character
                 Project: GNU Octave
            Submitted by: rlaboiss
            Submitted on: Wed 21 Oct 2020 03:06:18 PM UTC
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: other
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

In version 1.4.1 of the mapping package, the str2angle function fails to parse
strings containing the degree (°) symbol.  For instance :


> pkg load mapping
> str2angle ("22°52'44.25\"")
ans =  Inf


With the patch attached to this bug report, we get this result:


> str2angle str2angle ("22°52'44.25\"")
ans =  22.879


This is the reason the unit tests are failing:


octave:5> test str2angle
***** shared tst, res
 tst = '191E21''3.1"\n12e 22''33.24"\n13E 23'' 33.344"\n14w24'' 33.4444"\n';
 tst = [tst '15S25''33.54444"\n16W26''33.644444''''\n17s27''33.7444444"\n'];
 tst = [tst
'18N28''33.84444444"\n19d29m33.944444444s\n20D20M33.04444444Se\n'];
 tst = [tst '21°51''4.1"\n22°52''44.25"\n23° 53''33.34"\n24°54''
33.44"N\n'];
 tst = [tst '25° 55'' 33.544"\n26°56''33.644''''S\n27°57'' 33.744''''\n'];
 tst = [tst '28°58''33.844"w'];
 tst = strrep (tst, '\n', char(10));
 res = [191.351, 12.376, 13.393, -14.409, -15.426, -16.443, -17.459, 18.476,
...
        19.493, 20.343, 21.851, 22.879, 23.893, 24.909, 25.926, 26.943, ...
        27.959, -28.976];
 assert (str2angle (tst), res, 1e-3);
!!!!! test failed
ASSERT errors for:  assert (str2angle (tst),res,1e-3)

  Location  |  Observed  |  Expected  |  Reason
     .         O(1x10)      E(1x18)      Dimensions don't match
shared variables   scalar structure containing the fields:

    tst = [](0x0)
    res = [](0x0)





    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 21 Oct 2020 03:06:18 PM UTC  Name:
str2angle-accept-degree-symbol.patch  Size: 794B   By: rlaboiss

<http://savannah.gnu.org/bugs/download.php?file_id=50035>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59314>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]