From: Sisyphus <sis...@op...> - 2010-11-01 06:30:57
|
Hi, The demo: ############################## #include <stdio.h> #include <stdlib.h> int main(void) { double x; char * ptr; x = strtod("nan", &ptr); printf("%f\n", x); x = strtod("INf", &ptr); printf("%f\n", x); return 0; } ############################## With the mingw.org compilers that I've tested, the output of that program is: -1.#IND00 1.#INF00 But, on the same machine, with the mingw64 compilers that I've tested, the output is: 0.000000 0.000000 Why the difference ? Cheers, Rob |
From: Kai T. <kti...@go...> - 2010-11-01 19:39:08
|
2010/11/1 Sisyphus <sis...@op...>: > Hi, > > The demo: > > ############################## > #include <stdio.h> > #include <stdlib.h> > > int main(void) { > double x; > char * ptr; > > x = strtod("nan", &ptr); > printf("%f\n", x); > > x = strtod("INf", &ptr); > printf("%f\n", x); > > return 0; > } > ############################## > > With the mingw.org compilers that I've tested, the output of that program > is: > > -1.#IND00 > 1.#INF00 > > But, on the same machine, with the mingw64 compilers that I've tested, the > output is: > > 0.000000 > 0.000000 > > Why the difference ? > > Cheers, > Rob Hi Rob, the difference is that we are exporting for strtod the msvcrt function and do not redirect to the internal c99 version of __strtod. If you use here __strtod instead, you will get c99 compatible behavior. Regards, Kai -- | (\_/) This is Bunny. Copy and paste | (='.'=) Bunny into your signature to help | (")_(") him gain world domination |
From: Kai T. <kti...@go...> - 2010-11-01 20:16:52
|
2010/11/1 Kai Tietz <kti...@go...>: > 2010/11/1 Sisyphus <sis...@op...>: >> Hi, >> >> The demo: >> >> ############################## >> #include <stdio.h> >> #include <stdlib.h> >> >> int main(void) { >> double x; >> char * ptr; >> >> x = strtod("nan", &ptr); >> printf("%f\n", x); >> >> x = strtod("INf", &ptr); >> printf("%f\n", x); >> >> return 0; >> } >> ############################## >> >> With the mingw.org compilers that I've tested, the output of that program >> is: >> >> -1.#IND00 >> 1.#INF00 >> >> But, on the same machine, with the mingw64 compilers that I've tested, the >> output is: >> >> 0.000000 >> 0.000000 >> >> Why the difference ? >> >> Cheers, >> Rob > > Hi Rob, > > the difference is that we are exporting for strtod the msvcrt function > and do not redirect to the internal c99 version of __strtod. If you > use here __strtod instead, you will get c99 compatible behavior. > > Regards, > Kai > > -- > | (\_/) This is Bunny. Copy and paste > | (='.'=) Bunny into your signature to help > | (")_(") him gain world domination > This behavior is already changed on our trunk version of runtime. Here we have same behavior about strtod like mingw.org. Regards, Kai -- | (\_/) This is Bunny. Copy and paste | (='.'=) Bunny into your signature to help | (")_(") him gain world domination |
From: Ozkan S. <se...@gm...> - 2010-11-02 08:02:47
|
On Mon, Nov 1, 2010 at 10:16 PM, Kai Tietz <kti...@go...> wrote: > 2010/11/1 Kai Tietz <kti...@go...>: >> 2010/11/1 Sisyphus <sis...@op...>: >>> Hi, >>> >>> The demo: >>> >>> ############################## >>> #include <stdio.h> >>> #include <stdlib.h> >>> >>> int main(void) { >>> double x; >>> char * ptr; >>> >>> x = strtod("nan", &ptr); >>> printf("%f\n", x); >>> >>> x = strtod("INf", &ptr); >>> printf("%f\n", x); >>> >>> return 0; >>> } >>> ############################## >>> >>> With the mingw.org compilers that I've tested, the output of that program >>> is: >>> >>> -1.#IND00 >>> 1.#INF00 >>> >>> But, on the same machine, with the mingw64 compilers that I've tested, the >>> output is: >>> >>> 0.000000 >>> 0.000000 >>> >>> Why the difference ? >>> >>> Cheers, >>> Rob >> >> Hi Rob, >> >> the difference is that we are exporting for strtod the msvcrt function >> and do not redirect to the internal c99 version of __strtod. If you >> use here __strtod instead, you will get c99 compatible behavior. >> >> Regards, >> Kai >> >> -- >> | (\_/) This is Bunny. Copy and paste >> | (='.'=) Bunny into your signature to help >> | (")_(") him gain world domination >> > > This behavior is already changed on our trunk version of runtime. Here > we have same behavior about strtod like mingw.org. If the behavior is changed only in the trunk, which revision is it? It may be worth merging back to the release branch. > > Regards, > Kai > -- Ozkan |
From: Kai T. <kti...@go...> - 2010-11-02 10:10:39
|
2010/11/2 Ozkan Sezer <se...@gm...>: > On Mon, Nov 1, 2010 at 10:16 PM, Kai Tietz <kti...@go...> wrote: >> 2010/11/1 Kai Tietz <kti...@go...>: >>> 2010/11/1 Sisyphus <sis...@op...>: >>>> Hi, >>>> >>>> The demo: >>>> >>>> ############################## >>>> #include <stdio.h> >>>> #include <stdlib.h> >>>> >>>> int main(void) { >>>> double x; >>>> char * ptr; >>>> >>>> x = strtod("nan", &ptr); >>>> printf("%f\n", x); >>>> >>>> x = strtod("INf", &ptr); >>>> printf("%f\n", x); >>>> >>>> return 0; >>>> } >>>> ############################## >>>> >>>> With the mingw.org compilers that I've tested, the output of that program >>>> is: >>>> >>>> -1.#IND00 >>>> 1.#INF00 >>>> >>>> But, on the same machine, with the mingw64 compilers that I've tested, the >>>> output is: >>>> >>>> 0.000000 >>>> 0.000000 >>>> >>>> Why the difference ? >>>> >>>> Cheers, >>>> Rob >>> >>> Hi Rob, >>> >>> the difference is that we are exporting for strtod the msvcrt function >>> and do not redirect to the internal c99 version of __strtod. If you >>> use here __strtod instead, you will get c99 compatible behavior. >>> >>> Regards, >>> Kai >>> >>> -- >>> | (\_/) This is Bunny. Copy and paste >>> | (='.'=) Bunny into your signature to help >>> | (")_(") him gain world domination >>> >> >> This behavior is already changed on our trunk version of runtime. Here >> we have same behavior about strtod like mingw.org. > > If the behavior is changed only in the trunk, which revision > is it? It may be worth merging back to the release branch. > >> >> Regards, >> Kai >> > > -- > Ozkan > Well, patches of interest are 2827, and 2826. Cheers, Kai -- | (\_/) This is Bunny. Copy and paste | (='.'=) Bunny into your signature to help | (")_(") him gain world domination |
From: Ozkan S. <se...@gm...> - 2010-11-02 15:01:40
|
On Tue, Nov 2, 2010 at 12:10 PM, Kai Tietz <kti...@go...> wrote: > 2010/11/2 Ozkan Sezer <se...@gm...>: >> On Mon, Nov 1, 2010 at 10:16 PM, Kai Tietz <kti...@go...> wrote: >>> 2010/11/1 Kai Tietz <kti...@go...>: >>>> 2010/11/1 Sisyphus <sis...@op...>: >>>>> Hi, >>>>> >>>>> The demo: >>>>> >>>>> ############################## >>>>> #include <stdio.h> >>>>> #include <stdlib.h> >>>>> >>>>> int main(void) { >>>>> double x; >>>>> char * ptr; >>>>> >>>>> x = strtod("nan", &ptr); >>>>> printf("%f\n", x); >>>>> >>>>> x = strtod("INf", &ptr); >>>>> printf("%f\n", x); >>>>> >>>>> return 0; >>>>> } >>>>> ############################## >>>>> >>>>> With the mingw.org compilers that I've tested, the output of that program >>>>> is: >>>>> >>>>> -1.#IND00 >>>>> 1.#INF00 >>>>> >>>>> But, on the same machine, with the mingw64 compilers that I've tested, the >>>>> output is: >>>>> >>>>> 0.000000 >>>>> 0.000000 >>>>> >>>>> Why the difference ? >>>>> >>>>> Cheers, >>>>> Rob >>>> >>>> Hi Rob, >>>> >>>> the difference is that we are exporting for strtod the msvcrt function >>>> and do not redirect to the internal c99 version of __strtod. If you >>>> use here __strtod instead, you will get c99 compatible behavior. >>>> >>>> Regards, >>>> Kai >>>> >>>> -- >>>> | (\_/) This is Bunny. Copy and paste >>>> | (='.'=) Bunny into your signature to help >>>> | (")_(") him gain world domination >>>> >>> >>> This behavior is already changed on our trunk version of runtime. Here >>> we have same behavior about strtod like mingw.org. >> >> If the behavior is changed only in the trunk, which revision >> is it? It may be worth merging back to the release branch. >> >>> >>> Regards, >>> Kai >>> >> >> -- >> Ozkan >> > > Well, patches of interest are 2827, and 2826. > > Cheers, > Kai > OK, as of rev.3771 the release branch has the same strtod behavior as the trunk. -- O.S. |