Rick is right I guess, see result from "LC_NUMERIC=C rexx osmmap.rex"

-------------------------------------------------------------------------------

ruurd@Paradigit2:~/newrxgtk/GTKv3/test$ LC_NUMERIC=C rexx osmmap.rex
As CSTRINGs - Latitude: 52.289875;Longitude: 4.8448525
As objects - Latitude: 52.289875;Longitude: 4.8448525
As doubles - Latitude: 52.289875; Longitude: 4.844853
ruurd@Paradigit2:~/newrxgtk/GTKv3/test$

----------------------------------------------------------------------------------

As an aside for Erich, I started  with the arguments as float and the result triggered the trial bypass via CSTRING.

Ruurd

On 4/19/21 11:25 PM, Rick McGuire wrote:


On Mon, Apr 19, 2021 at 5:09 PM Erich Steinböck <erich.steinbo...@gmail.com <mailto:erich.steinbo...@gmail.com>> wrote:

    Hi Ruurd, instead of defining your latitude/longitude arguments as
    CSTRING and then manually converting them, you can define your
    arguments as (e. g.) float and have Rexx do the conversion for you.

    ~~~
    float lat,     // Latitude in decimal degrees
    float lon,     // Longitude in decimal degrees
    ~~~

    The actual issue may be a bug as ObjectToDouble calls C's strtod()
    which seems to adhere to the locale (decimal dot vs decimal comma).
    It seems rexx doesn't globally set the "C" locale but runs with
    whatever locale it is being started in.


I suspect that is the case. The actual work is done in method NumberString::doubleValue(), which uses strtod() to do the conversion. Since the numberstring object already has already parsed off the matissa, exponent, and sign, it should not be difficult to directly generate a double value from that information.

Rick


    Does it work as expected if you run your script in either of these
    two forms?
    LANG=C rexx <name.rex>
    LC_NUMERIC=C rexx <name.rex>
    _______________________________________________
    Oorexx-devel mailing list
    Oorexx-devel@lists.sourceforge.net
    <mailto:Oorexx-devel@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/oorexx-devel
    <https://lists.sourceforge.net/lists/listinfo/oorexx-devel>



_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to