I don't find how to express signed zeros in C++/C. Does anybody know what is the proper way to do so? Are they just -0.0 and +0.0? How to distinguish signed zeros from true zeros. http://en.wikipedia.org/wiki/Signed_zero Regard, Peng

0 |

6/10/2015 2:50:44 PM

Peng Yu <pengyu.ut@gmail.com> writes: > I don't find how to express signed zeros in C++/C. Does anybody know > what is the proper way to do so? Are they just -0.0 and +0.0? How to > distinguish signed zeros from true zeros. > > http://en.wikipedia.org/wiki/Signed_zero AFAIK there is no literal for those. You need to use either copysign(), or the signbit() macro (from <cmath>). -- Alain.

0 |

6/10/2015 3:18:06 PM

On 6/10/2015 10:50 AM, Peng Yu wrote: > I don't find how to express signed zeros in C++/C. Does anybody know what is the proper way to do so? Are they just -0.0 and +0.0? How to distinguish signed zeros from true zeros. What's "true zeros"? The IEEE 754 floating point standard has a negative zero representation in which if the sign bit is set and the rest are clear. A "regular" zero (all bits clear) is considered positive. (I just looked at the Signed zero article, and it has that description). I am almost sure C++ has no way to express negative zero since the hosted system may not be able to represent it. The Standard does not require any particular representation of floating point values. If your system has IEEE 754, your compiler can have its own way of expressing it either in a literal or by invoking some function (possibly intrinsic) but that is *implementation-specific* and not general. > http://en.wikipedia.org/wiki/Signed_zero V -- I do not respond to top-posted replies, please don't ask

0 |

6/10/2015 3:19:21 PM

On Wednesday, 10 June 2015 17:51:01 UTC+3, Peng Yu wrote: > I don't find how to express signed zeros in C++/C. > Does anybody know what is the proper way to do so? Are they > just -0.0 and +0.0? In C++ '-0.0' and '+0.0' are not 'double' literals by its parsing rules. These are expressions where unary minus or plus operators are applied to 'double' literal '0.0'. What such floating point arithmetic does (like those unary operators) is not regulated by C or C++ standard. It is left implementation-specific. Target platform may for example (and often does) follow IEC 559/IEEE 754 standard of floating point arithmetic. You can check if it does with 'std::numeric_limits<double>::is_iec559'. It works compile-time so you can 'static_assert' if your code assumes that it does. #include <iostream> #include <limits> int main() { std::cout << (std::numeric_limits<double>::is_iec559 ? "double follows IEEE 754 on your platform" : "RTFM about double on your platform") << '\n'; double someZero = -0.0; std::cout << "Some zero:" << someZero << '\n' << "Some zero negated:" << -someZero << std::endl; return 0; } > How to distinguish signed zeros from true zeros. > > http://en.wikipedia.org/wiki/Signed_zero The link that you posted answers that question. Can't you read it? Either use 'copysign' from <cmath> or see if '1/someZero' produces negative or positive infinity.

0 |

6/10/2015 4:14:04 PM

On 10/06/2015 17:14, �� Tiib wrote: > On Wednesday, 10 June 2015 17:51:01 UTC+3, Peng Yu wrote: >> I don't find how to express signed zeros in C++/C. >> Does anybody know what is the proper way to do so? Are they >> just -0.0 and +0.0? > > In C++ '-0.0' and '+0.0' are not 'double' literals by > its parsing rules. > > These are expressions where unary minus or plus > operators are applied to 'double' literal '0.0'. > > What such floating point arithmetic does (like those > unary operators) is not regulated by C or C++ > standard. It is left implementation-specific. > Target platform may for example (and often does) > follow IEC 559/IEEE 754 standard of floating point > arithmetic. You can check if it does with > 'std::numeric_limits<double>::is_iec559'. It works > compile-time so you can 'static_assert' if your code > assumes that it does. > > #include <iostream> > #include <limits> > > int main() > { > std::cout << (std::numeric_limits<double>::is_iec559 > ? "double follows IEEE 754 on your platform" > : "RTFM about double on your platform") << '\n'; > > double someZero = -0.0; > std::cout << "Some zero:" << someZero << '\n' > << "Some zero negated:" << -someZero << std::endl; > return 0; > } > > >> How to distinguish signed zeros from true zeros. >> >> http://en.wikipedia.org/wiki/Signed_zero > > The link that you posted answers that question. > Can't you read it? Either use 'copysign' from <cmath> > or see if '1/someZero' produces negative or positive > infinity. In maths 1/0 is not infinity, 1/0 is undefined. In maths negative zeros don't exist. IEEE floating point is wrong. /Flibble

0 |

6/10/2015 5:09:05 PM

On Wednesday, 10 June 2015 20:09:14 UTC+3, Mr Flibble wrote: > On 10/06/2015 17:14, =D6=F6 Tiib wrote: > > On Wednesday, 10 June 2015 17:51:01 UTC+3, Peng Yu wrote: > >> I don't find how to express signed zeros in C++/C. > >> Does anybody know what is the proper way to do so? Are they > >> just -0.0 and +0.0? > > > > In C++ '-0.0' and '+0.0' are not 'double' literals by > > its parsing rules. > > > > These are expressions where unary minus or plus > > operators are applied to 'double' literal '0.0'. > > > > What such floating point arithmetic does (like those > > unary operators) is not regulated by C or C++ > > standard. It is left implementation-specific. > > Target platform may for example (and often does) > > follow IEC 559/IEEE 754 standard of floating point > > arithmetic. You can check if it does with > > 'std::numeric_limits<double>::is_iec559'. It works > > compile-time so you can 'static_assert' if your code > > assumes that it does. > > > > #include <iostream> > > #include <limits> > > > > int main() > > { > > std::cout << (std::numeric_limits<double>::is_iec559 > > ? "double follows IEEE 754 on your platf= orm" > > : "RTFM about double on your platform") = << '\n'; > > > > double someZero =3D -0.0; > > std::cout << "Some zero:" << someZero << '\n' > > << "Some zero negated:" << -someZero << std::end= l; > > return 0; > > } > > > > > >> How to distinguish signed zeros from true zeros. > >> > >> http://en.wikipedia.org/wiki/Signed_zero > > > > The link that you posted answers that question. > > Can't you read it? Either use 'copysign' from <cmath> > > or see if '1/someZero' produces negative or positive > > infinity. >=20 > In maths 1/0 is not infinity, 1/0 is undefined. In maths negative zeros= =20 > don't exist. IEEE floating point is wrong. That is like saying that 'int' is wrong since it is not behaving like "integer" of maths. It does not even=20 pretend to be correct in that sense. IEEE 754 does define nothing about maths. It defines formats, rules and operations for implementing floating point computation and exchange.=20

0 |

6/10/2015 6:34:46 PM

On 10/06/2015 19:34, �� Tiib wrote: > On Wednesday, 10 June 2015 20:09:14 UTC+3, Mr Flibble wrote: >> On 10/06/2015 17:14, �� Tiib wrote: >>> On Wednesday, 10 June 2015 17:51:01 UTC+3, Peng Yu wrote: >>>> I don't find how to express signed zeros in C++/C. >>>> Does anybody know what is the proper way to do so? Are they >>>> just -0.0 and +0.0? >>> >>> In C++ '-0.0' and '+0.0' are not 'double' literals by >>> its parsing rules. >>> >>> These are expressions where unary minus or plus >>> operators are applied to 'double' literal '0.0'. >>> >>> What such floating point arithmetic does (like those >>> unary operators) is not regulated by C or C++ >>> standard. It is left implementation-specific. >>> Target platform may for example (and often does) >>> follow IEC 559/IEEE 754 standard of floating point >>> arithmetic. You can check if it does with >>> 'std::numeric_limits<double>::is_iec559'. It works >>> compile-time so you can 'static_assert' if your code >>> assumes that it does. >>> >>> #include <iostream> >>> #include <limits> >>> >>> int main() >>> { >>> std::cout << (std::numeric_limits<double>::is_iec559 >>> ? "double follows IEEE 754 on your platform" >>> : "RTFM about double on your platform") << '\n'; >>> >>> double someZero = -0.0; >>> std::cout << "Some zero:" << someZero << '\n' >>> << "Some zero negated:" << -someZero << std::endl; >>> return 0; >>> } >>> >>> >>>> How to distinguish signed zeros from true zeros. >>>> >>>> http://en.wikipedia.org/wiki/Signed_zero >>> >>> The link that you posted answers that question. >>> Can't you read it? Either use 'copysign' from <cmath> >>> or see if '1/someZero' produces negative or positive >>> infinity. >> >> In maths 1/0 is not infinity, 1/0 is undefined. In maths negative zeros >> don't exist. IEEE floating point is wrong. > > That is like saying that 'int' is wrong since it is not > behaving like "integer" of maths. It does not even > pretend to be correct in that sense. Using 'int' is wrong; use the typedefs from <cstdint> instead. > > IEEE 754 does define nothing about maths. It defines > formats, rules and operations for implementing floating > point computation and exchange. Doesn't make it right. If IEEE 754 was designed by mathematicians rather than engineers it may well have been a lot better. /Flibble

0 |

6/10/2015 7:34:03 PM

On Wednesday, June 10, 2015 at 6:09:14 PM UTC+1, Mr Flibble wrote: > In maths 1/0 is not infinity, 1/0 is undefined. In maths negative zeros > don't exist. IEEE floating point is wrong. > > /Flibble Sure, in \mathbb{R} it is undefined. But real mathematicians don't limit themselves to a single model of numbers, if other models are better for their purposes. On the real projective line \mathbb{R}^*, you can absolutely have 1/0 = infinity. The numbers stop being a field of course, but IEEE floats aren't a field either. Since IEEE floats can't reasonably model \mathbb{R} while the field axioms, a mathematician might very reasonably decide they might as well model the projective line instead.

0 |

6/11/2015 7:31:56 AM

On Thursday, 11 June 2015 10:32:16 UTC+3, gwowen wrote: > > Sure, in \mathbb{R} it is undefined. Are there Usenet clients that support LaTeX? Some support Unicode ... u8"=E2=84=9D" <- tried to achieve u8"\u211D" .

0 |

6/11/2015 7:58:03 AM

On Thursday, June 11, 2015 at 8:58:14 AM UTC+1, =C3=96=C3=B6 Tiib wrote: > On Thursday, 11 June 2015 10:32:16 UTC+3, gwowen wrote: > > > > Sure, in \mathbb{R} it is undefined. >=20 > Are there Usenet clients that support LaTeX? > Some support Unicode ... u8"=E2=84=9D" <- tried to achieve u8"\u211D" . Not that I know of. I just used the LaTeX markup on the basis that anyone = who cared about the projective real line and field axioms would just parse = it mentally. FWIW: on the hated google group interace, that UTF-8 shows up= correctly.

0 |

6/11/2015 10:31:16 AM

On 11/06/15 12:31, gwowen wrote: > On Thursday, June 11, 2015 at 8:58:14 AM UTC+1, Öö Tiib wrote: >> On Thursday, 11 June 2015 10:32:16 UTC+3, gwowen wrote: >>> >>> Sure, in \mathbb{R} it is undefined. >> >> Are there Usenet clients that support LaTeX? Some support Unicode >> ... u8"ℝ" <- tried to achieve u8"\u211D" . > > Not that I know of. I just used the LaTeX markup on the basis that > anyone who cared about the projective real line and field axioms > would just parse it mentally. FWIW: on the hated google group > interace, that UTF-8 shows up correctly. > It's also fine here in Thunderbird on Linux.

0 |

6/11/2015 11:51:21 AM

On 11/06/2015 08:31, gwowen wrote: > On Wednesday, June 10, 2015 at 6:09:14 PM UTC+1, Mr Flibble wrote: > >> In maths 1/0 is not infinity, 1/0 is undefined. In maths negative zeros >> don't exist. IEEE floating point is wrong. >> >> /Flibble > > Sure, in \mathbb{R} it is undefined. But real mathematicians don't limit themselves to a single model of numbers, if other models are better for their purposes. > > On the real projective line \mathbb{R}^*, you can absolutely have 1/0 = infinity. The numbers stop being a field of course, but IEEE floats aren't a field either. > > Since IEEE floats can't reasonably model \mathbb{R} while the field axioms, a mathematician might very reasonably decide they might as well model the projective line instead. Nonsense. In maths 1/0 is undefined not infinity. IEEE floating point is wrong about this and about negative zero. /Flibble

0 |

6/11/2015 6:18:23 PM

On Thursday, June 11, 2015 at 7:18:29 PM UTC+1, Mr Flibble wrote: > On 11/06/2015 08:31, gwowen wrote: > > On Wednesday, June 10, 2015 at 6:09:14 PM UTC+1, Mr Flibble wrote: > > > >> In maths 1/0 is not infinity, 1/0 is undefined. In maths negative zeros > >> don't exist. IEEE floating point is wrong. > >> > >> /Flibble > > > > Sure, in \mathbb{R} it is undefined. But real mathematicians don't limit themselves to a single model of numbers, if other models are better for their purposes. > > > > On the real projective line \mathbb{R}^*, you can absolutely have 1/0 = infinity. The numbers stop being a field of course, but IEEE floats aren't a field either. > > > > Since IEEE floats can't reasonably model \mathbb{R} while the field axioms, a mathematician might very reasonably decide they might as well model the projective line instead. > > Nonsense. In maths 1/0 is undefined not infinity. IEEE floating point > is wrong about this and about negative zero. Is there no subject on which your confidence does not exceed your knowledge? Go read up on how the mathematical object called the Real Projective Line is defined. You may learn something. As Earl Weaver said, the important stuff is what you learn after you know everything.

0 |

6/11/2015 6:27:22 PM

On 11/06/2015 19:27, gwowen wrote: > On Thursday, June 11, 2015 at 7:18:29 PM UTC+1, Mr Flibble wrote: >> On 11/06/2015 08:31, gwowen wrote: >>> On Wednesday, June 10, 2015 at 6:09:14 PM UTC+1, Mr Flibble wrote: >>> >>>> In maths 1/0 is not infinity, 1/0 is undefined. In maths negative zeros >>>> don't exist. IEEE floating point is wrong. >>>> >>>> /Flibble >>> >>> Sure, in \mathbb{R} it is undefined. But real mathematicians don't limit themselves to a single model of numbers, if other models are better for their purposes. >>> >>> On the real projective line \mathbb{R}^*, you can absolutely have 1/0 = infinity. The numbers stop being a field of course, but IEEE floats aren't a field either. >>> >>> Since IEEE floats can't reasonably model \mathbb{R} while the field axioms, a mathematician might very reasonably decide they might as well model the projective line instead. >> >> Nonsense. In maths 1/0 is undefined not infinity. IEEE floating point >> is wrong about this and about negative zero. > > Is there no subject on which your confidence does not exceed your knowledge? > > Go read up on how the mathematical object called the Real Projective Line is defined. You may learn something. As Earl Weaver said, the important stuff is what you learn after you know everything. The real projective line looks like nonsense to me mate. 1/0 is undefined. /Flibble

0 |

6/11/2015 6:42:03 PM

Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> wrote in news:qfmdnZa-WeB3TeTInZ2dnUU7-eGdnZ2d@giganews.com: > Nonsense. In maths 1/0 is undefined not infinity. IEEE floating point > is wrong about this and about negative zero. As this is a C++ group, math is no concern and neither is whether IEEE is conceptually wrong in anything or not. If the C++ implementation is using IEEE, that's what we have got and that's what we have to work with: >echo ' #include <iostream> int main() { double x = 0; std::cout << 1/x << "\n"; } ' > test1.cpp >g++ test1.cpp >./a.exe inf See there. It is inf, regardless or whether you or me like it or not (I do!) Cheers Paavo

0 |

6/11/2015 8:43:28 PM

On Thursday, June 11, 2015 at 7:42:10 PM UTC+1, Mr Flibble wrote: > The real projective line looks like nonsense to me mate. 1/0 is undefined. (... shakes head sadly ...) There is little worse than a man who is proudly ignorant.

0 |

6/11/2015 8:45:56 PM

On 11/06/2015 21:43, Paavo Helde wrote: > Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> wrote in > news:qfmdnZa-WeB3TeTInZ2dnUU7-eGdnZ2d@giganews.com: > >> Nonsense. In maths 1/0 is undefined not infinity. IEEE floating point >> is wrong about this and about negative zero. > > As this is a C++ group, math is no concern and neither is whether IEEE is > conceptually wrong in anything or not. If the C++ implementation is using > IEEE, that's what we have got and that's what we have to work with: > >> echo ' > #include <iostream> > int main() { > double x = 0; > std::cout << 1/x << "\n"; > } > ' > test1.cpp >> g++ test1.cpp >> ./a.exe > inf > > See there. It is inf, regardless or whether you or me like it or not (I > do!) If you write code that treats division by zero as infinity then you better keep that code to yourself; the world doesn't need it. /Flibble

0 |

6/11/2015 11:55:46 PM

I am looking for a good systems programming language that can be used instead of C/C++. My qualifications for the language are: * mature compiler(s) that produce native-code binaries (for Windows) * open source - preferable, but not 100% necessary Thanks, Kevin "Kevin Albrecht" <kevin@albrecht.net> writes: > I am looking for a good systems programming language > that can be used instead of C/C++. My qualifications > for the language are: > > * mature compiler(s) that produce native-code > binaries (for Windows) Ocaml, D, cyclone, Eiffel, Beta >...

How do I get C-c C-c to work with jython? I have the jpython command set to jython, and I can start the interpreter with C-C ! and then use C-c C-c, but this is rather frustrating. If I try to use C-c C-c without first starting the interpreter in another window I get wrong type argument: sequencep, jpython Thanks, Dave Cook ...

Hi I've been asking on the net how to use MEX properly so that I can use C/C++ in MATLAB, but information is not forthcoming. There seems to be a lot on using MATLAB in C/C++ but not the other way around. I understand Mathworks is trying very hard to sell the Matlab Compiler, but even so, why is it SO hard to get information about MEX? Or is it that I've missed something very fundamental, meaning that I'm struggling over something that is actually quite easy? Any thoughts and info would be great. Thanks BullDog BullDog wrote: > Hi > > I've been asking on the net ...

We can write c program in turbo c++ editor.But reverse is not true why? i.e The program will not compile if u write c++ program in turbo c editor vim wrote: > We can write c program in turbo c++ editor.But reverse is not true why? > i.e The program will not compile if u write c++ program in turbo c > editor This isn't about C; this is about some editor. Why the fircone should /we/ know? Ask in a relevant group. [And /why/, in an editor specialised to some specific programming languages, would you expect it to compile a /different/ one? Would you expect turbo perl to compi...

Is it possible to read C/C++ code in matlab and the other way around too? Hi, as long as C or C++ are written in text files you can edit them in the matlab editor. To see the special character of C or C++ coding language, in the editor go to menus: file>preferences>Edito/Debugger>language and on popup "Language" select "C/C++". This does not allow you to run the C/C++ code, just to view it i nicer way... regards, chris saneman <asdfsdf@asd.com> wrote in message <frl846 $f8i$2@news.net.uni-c.dk>... > Is it possible to read C/C...

Does anyone have a good workaround for this problem other than: just be careful! When I've compiled a large package and slime has given me a *slime-compilation* buffer, I like to work through this buffer issue by issue, fixing the errors, warnings, etc. But If I ever press C-c C-c in the editor window while fixing an error, slime destroys the *(slime-compilation* buffer with the compilation output of C-c C-c. Jim Newton <jimka.issy@gmail.com> writes: > Does anyone have a good workaround for this problem other than: just be careful! > > When I've compiled a ...

Isn't it a lame use of human time and effort to maintain completely separate C and C++ standards? As in the words of Betty White about Facebook: "It seems like an incredible waste of time". Why don't the two standards groups get together and agree on a common specification for the ground which both standards cover? There would still be two separate standards, but they'd both be exactly the same for the common ground. The common ground document could be referred to by both standards instead of being maintained by both groups in individual efforts resulting in...

Throne Software has opened up C, C++ and C# Forums at: http://www.thronesoftware.com/forum/ Join us! Throne Software wrote: > Throne Software has opened up C, C++ and C# Forums at: > > http://www.thronesoftware.com/forum/ For all of your forums newsgroups already exist. > Join us! Why? Don't see any reason to support your marketing. ...

Throne Software has opened up C, C++ and C# Forums at: http://www.thronesoftware.com/forum/ Join us! In article <1120963701.862698.160260@g14g2000cwa.googlegroups.com>, Throne Software <mail@thronesoftware.com> writes >Throne Software has opened up C, C++ and C# Forums at: > >http://www.thronesoftware.com/forum/ > >Join us! Why? The beauty of news groups is that they come to me I don't have to go to them. Also all the people who have been around a while know what they are doing and are here. I noticed that there are some C and C++ Forums on another system...

Of the 3 languages titled in this post is c++ older than obj-c ? Would someone experienced in C be able to dive right into C++ rather than obj-c ? Java is out for me now except applet programming I think I'm going to go with just C and C++. Bill Bill Cunningham wrote: > Of the 3 languages titled in this post is c++ older than obj-c ? Why does that matter? Do you want to use an old language? Try Fortran or LISP. > Would > someone experienced in C be able to dive right into C++ rather than > obj-c ? Not quite dive in, at least not into the OO parts of C++. ...

I come from C,C++,Java and C#. What can SmallTalk do for me and for what cost? Regarding the Squeak thing, it's interesting though confusing. Is it an IDE? Why are the menus so wacky? "DM McGowan II" <nospam@nospam.net> wrote in message news:PLednX2vnLd11IncRVn-rA@comcast.com... > I come from C,C++,Java and C#. What can SmallTalk do for me ...? Ask not what Smalltalk can do for, but what can you do with Smalltalk. :-) In very few words, it significantly reduces time to market, while enhancig the development experience. This is because: 1. It...

Throne Software has opened up C, C++ and C# Forums at: http://www.thronesoftware.com/forum/ Join us! ...

Please Who wants to post Command and Conquer Red Alert 3. I'm looking for the whole version. If you do so Thank you. --------------= Posted using GrabIt =---------------- ------= Binary Usenet downloading made easy =--------- -= Get GrabIt for free from http://www.shemes.com/ =- Shaniel's Usenet wrote: > Please > Who wants to post Command and Conquer Red Alert 3. > I'm looking for the whole version. > If you do so Thank you. > > > --------------= Posted using GrabIt =---------------- > ------= Binary Usenet downloading made easy =--------- &g...

Someone can exaplain me why use C instead C++? Until now i've never found exaplanation for this. Every project written in C on which i've worked could be written in c++, and when in nowadays happen still to see C code i really don't understand why the same things cannot be written in c++. Using c++ it's possble to reduce developing time achieving the same result. Can you give me a valid reason for C? Simple enough, the OO & template features are not needed on some projects targeted to OS kernel development and device driver development and other low-level libraries. Moreov...

Signed zero is zero with an associated sign . In ordinary arithmetic, the number 0 does not have a sign, so that −0, +0 and 0 are identical. ...

JUST ADDED! GET "FIRST PHONE CALL" SIGNED FOR CHRISTMAS FROM COMFORT OF YOUR HOME! As it is snowing this weekend in Michigan, the nice folks ...

We’re updating our encryption requirements for Facebook-connected apps to reflect a new and more secure industry standard. As a result, apps ...

Went to an author signing event earlier this week and got my Kindle signed by Hugh Howey, yay! I gave him some chocolate chip cookies and a piece ...

Lil Wayne Says He Signed A Deal With Jay Z at KMEL Summer Jam 2015 Lil Wayne Says He Signed A Deal With Jay Z at KMEL Summer Jam 2015 Lil Wayne ...

Unbeaten fighter Floyd Mayweather said Sunday that neither he nor Manny Pacquiao have signed a deal for a May mega-fight, but he still hopes ...

IN A long, typed note he left strict instructions for the terrified Madeleine Pulver, but placed no price on his demands, despite her family's ...

Emoji level: Expert.

The professional fishermen who will patrol West Australian waters as "shark sheriffs" are still to be contracted, despite a state government ...

AN astonishing seven Australians are holding NFL contracts after punter Sam Irwin-Hill was signed as an undrafted free agent by the Indianapolis ...

Resources last updated: 1/25/2016 2:04:25 PM