caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Shawn Wagner <shawnw@speakeasy.org>
To: caml-list@inria.fr
Subject: Re: [Caml-list] string_of_float -> float_of_string locale dependency bug
Date: Mon, 14 Jun 2004 09:27:14 -0700	[thread overview]
Message-ID: <20040614162714.GN595@speakeasy.org> (raw)
In-Reply-To: <20040614180420.C28810@pauillac.inria.fr>

On Mon, Jun 14, 2004 at 06:04:20PM +0200, Xavier Leroy wrote:
> > Another approach: write own strtod function which doesn't depend on
> > the LC_NUMERIC locale.
> 
> Of course, having our own string <-> float conversions would work
> around this issue and other issues as well, such as the inability of
> the C library functions to print a float *exactly* (i.e. with just
> enough decimals that it reads back to the very same float).
> 
> This is no small undertaking, however, and one has a feeling of
> reinventing the wheel.
> 
> The ANSI C standard library is quite small to begin with, but the
> addition of locales managed to render it even less useful...
> 

While I agree that LC_NUMERIC makes converting floats into strings that are
intended to be converted back into floats by other programs a major pain,
locales aren't all bad. Adding locale support and ctype.h routines was one
of the first things I did for annexlib. Being able to do things like case
conversion according to the user's character set is very nice.

*braces for people griping about how that's fundamentally broken too*

-- 
Shawn Wagner
shawnw@speakeasy.org

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2004-06-14 16:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-13 13:30 Evgeny Chukreev
2004-06-13 15:05 ` Yamagata Yoriyuki
2004-06-14  9:54 ` Xavier Leroy
2004-06-14 12:00   ` Evgeny Chukreev
2004-06-14 15:23   ` Yamagata Yoriyuki
2004-06-14 15:57     ` Evgeny Chukreev
2004-06-14 16:04       ` Xavier Leroy
2004-06-14 16:27         ` Shawn Wagner [this message]
2004-06-14 15:58     ` Xavier Leroy
2004-06-14 21:51       ` Yamagata Yoriyuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040614162714.GN595@speakeasy.org \
    --to=shawnw@speakeasy.org \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).