helpGNU libunistring - Support: sr #106998, u32_strtod_l

 
 

sr #106998: u32_strtod_l

Submitted by:  None
Submitted on:  Wed 26 Aug 2009 01:39:24 PM UTC  
Votes:  1  
 
Category: NonePriority: 5 - Normal
Severity: 1 - WishStatus: Confirmed
Privacy: PublicAssigned to: Bruno Haible <haible>
Originator Email: -unavailable-Open/Closed: Open
Operating System: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 05 Apr 2010 05:53:13 PM UTC, comment #3:

Plese note my last comment is ill-founded, since making source-code locale-dependent breaks source-code compatibility. Ugh. What a mess.

Linas Vepstas <linas>
Mon 05 Apr 2010 05:35:37 PM UTC, comment #2:

Something that is locale-compatible would be nice. Currently, with guile-1.8.7 in the de_DE.utf8 locale, the C snippet
double x = M_PI; setlocale(LC_ALL, ""), printf ("%f", x); will print 3,14159 using a comma as the decimal separator, as appropriate for this locale (and most European locales). However, scm_eval_string() doesn't understand this format at all, causing compatibility headaches. This can be confirmed at the guile command line:

guile> (+ 0,2 0,2)

will fail in the de_DE locale, but

guile> (+ 0.2 0.2)

unexpectedly works.

Linas Vepstas <linas>
Thu 27 Aug 2009 07:16:05 AM UTC, comment #1:

> unicode-string->integer and unicode-string->double conversion functions


Yes, this would be useful. You can implement such a function
yourself, roughly like this:
1) Decide what kinds of decimal point character, decimal
grouping character, exponent marker, sign character,
and digit scripts you want to support in that conversion.
2) Verify that all digits in the input are from the same
script.
3) Convert the digits to their numerical value using the
uc_digit_value function.
4) Build up a 'char *' string with the corresponding ASCII
digits and sign, and without grouping characters.
5) Pass that string to strtol or strtod.

Such a function will not be in libunistring in the near term,
because the decisions in 1) are not clear to me yet, how to
do them right.

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Wed 26 Aug 2009 01:39:24 PM UTC, original submission:

Hi-

It would be neat to have unicode-string->integer and unicode-string->double conversion functions according to the rules of the locale.

Keep up the good work.

-Mike Gran

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by linas (Posted a comment)
  • -unavailable- added by linas (Voted in favor of this item)
  • -unavailable- added by haible (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 1 encouragement so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 05 Apr 2010 05:28:18 PM UTClinasCarbon-Copy-=>Added linas
    Thu 27 Aug 2009 07:16:05 AM UTChaibleStatusNone=>Confirmed
      Assigned toNone=>haible

    Back to the top


    Powered by Savane 3.1-cleanup