- Available C++ Libraries FAQ - 3 Updates
- pow(0, 0) - 12 Updates
- The unbelievable slowness of larger int types (in my experiment) - 2 Updates
- Hateful abusive posts by Leigh Johnston, round #2 - 8 Updates
JiiPee <no@notvalid.com>: Nov 14 11:42PM * Learn C++ by example. <http://www.cppbasics.com/> link does not work On 14/11/2018 23:23, Nikki Locke wrote: |
"Öö Tiib" <ootiib@hot.ee>: Nov 15 01:54AM -0800 On Thursday, 15 November 2018 01:42:52 UTC+2, JiiPee wrote: > * Learn C++ by example. <http://www.cppbasics.com/> > link does not work It is likely bot post, if you have any comments to bot's author then read the bottom part of message too: |
woodbrian77@gmail.com: Nov 15 01:50PM -0800 On Wednesday, November 14, 2018 at 5:42:52 PM UTC-6, JiiPee wrote: > > Maintainer: Nikki Locke - if you wish to contact me, please use the form on the website. > * Learn C++ by example. <http://www.cppbasics.com/> > link does not work Please don't top post here. I've reworked things above to make your post follow the post you replied to. Brian Ebenezer Enterprises - Enjoying programming again. https://github.com/Ebenezer-group/onwards |
Juha Nieminen <nospam@thanks.invalid>: Nov 15 11:48AM > So the authors of ISO/IEC 60559 apparently disagree with you. They are free to disagree all they like, but they are still wrong. 0^0 is not 1, never was, and never will be. It's as undefined as, for example, 0/0, the logarithm of a negative value, the inverse cosine of a value larger than 1, and so on. If you make the assumption that 0^0 is 1, you will be getting incorrect results in, for example, limit problems. |
Juha Nieminen <nospam@thanks.invalid>: Nov 15 11:56AM > I am sure that even you would make > int ipow(int x, int y); > return 1 for ipow(0, 0), wouldn't you? Why? Zero raised to any power results in zero. Why is that argument less valid than yours? |
Reinhardt Behm <rbehm@hushmail.com>: Nov 15 09:57PM +0800 AT Thursday 15 November 2018 19:56, Juha Nieminen wrote: >> return 1 for ipow(0, 0), wouldn't you? > Why? Zero raised to any power results in zero. > Why is that argument less valid than yours? Any number other than 0 raised the the zeroth power results in 1. -- Reinhardt |
Geoff <geoff@invalid.invalid>: Nov 15 06:30AM -0800 On Wed, 14 Nov 2018 12:39:58 +0200, Paavo Helde >} >Output with MSVC++: x=1, y=(1,0) >Output with gcc: x=1, y=(0,0) Output of Xcode with clang: x=1, y=(nan,nan) |
jameskuyper@alumni.caltech.edu: Nov 15 06:31AM -0800 On Thursday, November 15, 2018 at 6:48:56 AM UTC-5, Juha Nieminen wrote: > cosine of a value larger than 1, and so on. > If you make the assumption that 0^0 is 1, you will be getting > incorrect results in, for example, limit problems. Not necessarily. Consider a function func(z) that calls pow(x,n) internally, where x and n depend in some way upon the value of z. Consider a value of z, call it z0, for which x and n are both 0. If the standard were changed to specify that pow(0,0) returns a NaN, as you recommend, then func(z0) will probably also return a NaN, even if func(z) has a well-defined limit as z approaches z0 from a specified direction. However, there's a pretty good chance that having pow(0,0) return 1.0, the same value as pow(x,0) for x!=0.0, will cause func(z0) to return a floating point value that is exactly the best possible approximation to the true value of that limit. Whether or not that's true depends upon the function and the limit. It's easy to construct such a function - the hard part is proving that such functions come up often enough to justify this decision. It's certainly not true for all functions matching my description above. I don't know for sure, but I wouldn't be surprised to learn that the decision was originally made (by whoever originally made it - probably someone responsible for the design of Fortran) based upon being familiar with a significant number of cases of practical importance for which that was the case. If so, the decision may also have been ratified by ISO/IEC 60559, the C standard, or the C++ standard, by people who were also aware of those cases. I'd be happier if I knew what those cases were, so I could cite them for you, but I'd be very surprised if all of those decisions were made entirely at random, or by someone unfamiliar with the fact that mathematically, the value of 0^0 is undefined. |
bitrex <user@example.net>: Nov 15 09:37AM -0500 On 11/15/2018 08:57 AM, Reinhardt Behm wrote: >> Why? Zero raised to any power results in zero. >> Why is that argument less valid than yours? > Any number other than 0 raised the the zeroth power results in 1. in C++ std::pow is the equivalent of the exponential operator " ^ " in e.g. Mathematica, they could've added another overloadable operator to represent exponentiation whose function was context-dependent but it would've complicated an already complex precedence table so you have the sort of kludge situation std::pow, std::complex;:pow, you could have matrix::pow, etc. Why the return value of regular std::pow for intrinsic types at 0^0 must be congruent with what real analysis says x^n is at (0, 0) is due to the behavior of limits is mysterious to me; std::pow is not the analytic function x^n, and the idea that in all of mathematics in general to define 0^0 as being anything other than undefined is somehow "wrong" is, well, simply wrong what it is is context-dependent. It's irrelevant that defining it to be 1 in set theory or lambda calculus will give you incorrect results when working with limits in real analysis, you're not _doing_ real analysis! Gosh! |
"Shobe, Martin" <martin.shobe@yahoo.com>: Nov 15 08:44AM -0600 On 11/15/2018 5:48 AM, Juha Nieminen wrote: > 0^0 is not 1, never was, and never will be. It's as undefined as, > for example, 0/0, the logarithm of a negative value, the inverse > cosine of a value larger than 1, and so on. In combinatorics, 0^0 = 1. In set theory 0^0 = 1. In algebra, there's a standard definition for repeated application of an operator. That definition applied to x^y results in 0^0 = 1. These are facts that are simply not in dispute as they follow easily from how x^y is defined in those fields. Another important fact is that defining 0^0 as 1 doesn't violate the more important identities of exponentiation. This contrasts with 0/0 where any value you give 0/0 results in one of the field axioms being false. (BTW, you should look into complex numbers if you want to see what the logarithm of a negative value is.) > If you make the assumption that 0^0 is 1, you will be getting > incorrect results in, for example, limit problems. You'd be doing limits incorrectly then. Martin Shobe |
jameskuyper@alumni.caltech.edu: Nov 15 07:56AM -0800 On Thursday, November 15, 2018 at 6:48:56 AM UTC-5, Juha Nieminen wrote: ... > ... It's as undefined as, > for example, 0/0, the logarithm of a negative value, the inverse > cosine of a value larger than 1, and so on. I sorry - I didn't notice those comments until Martin referred to the second one. You're familiar with complex analysis, and are making those comments in the context of referring to that fact, yet you list the logarithm of negative numbers and the arccosine of a value larger than 1 as examples of undefined values? Try calling log(complex(-1.0)) or acos(complex(2.0)), and tell me what you get (I'm currently in a location where I can't easily perform the test myself). |
Manfred <noname@add.invalid>: Nov 15 05:33PM +0100 On 11/15/2018 3:44 PM, Shobe, Martin wrote: > operator. That definition applied to x^y results in 0^0 = 1. > These are facts that are simply not in dispute as they follow easily > from how x^y is defined in those fields. I am not sure about combinatorics or set theory, but in algebra 0^0 the above does not apply, as others have pointed out: n^0 = 1 for each n ∈ ℝ > 0 would yield 0^0 = 1 0^n = 0 for each n ∈ ℝ > 0 would yield 0^0 = 0 So, strictly speaking, 0^0 is a NaN, and in fact this is what the C++ complex library implementation of gcc yields. That said, it is to be remembered that algebraic analysis is not the same as numerical analysis, and computers can only do numerical computations, so it does make sense that in order to support the expected results some special case of computation yields some conventional value. In fact even in algebra the definition of n^0 = 1 is posed to be consistent with other properties of exponentiation, not because the definition of exponentiation (i.e. repeated multiplication) shows that. The fact that some special cases of numerical computation give a conventional result (and implementation defined) is only to be intended as "to make things work", and baseline is that it should be handled with care. IME such special cases are best avoided, and typically this can be achieved by a proper rearrangement of the algorithm. |
Paavo Helde <myfirstname@osa.pri.ee>: Nov 15 10:13PM +0200 On 15.11.2018 18:33, Manfred wrote: > care. > IME such special cases are best avoided, and typically this can be > achieved by a proper rearrangement of the algorithm. Agreed. On another tangent, when calculating x^n, it might make sense to use an optimized function for small enough integer arguments, e.g. int result=1; for (int i=0; i<n; i++) result*=x; This will produce 0^0 = 1 in a "natural" way. On the other hand, there is not much point to provide a special check or branch for 0^n as this would apply only for invalid/degenerate data which should not be a normal usage case. Not sure if this says anything about anything. |
"Shobe, Martin" <martin.shobe@yahoo.com>: Nov 15 03:45PM -0600 On 11/15/2018 10:33 AM, Manfred wrote: > above does not apply, as others have pointed out: > n^0 = 1 for each n ∈ ℝ > 0 would yield 0^0 = 1 > 0^n = 0 for each n ∈ ℝ > 0 would yield 0^0 = 0 The case in question is explicitly excluded from the right hand side of those statements. They say nothing about what 0^0 yields. In other words, any choice of value for 0^0 is consistent with them. However, from Wikipedia (yeah, I know, but they were the easiest to find) "In a monoid, one can define positive integer powers of an element x : x^1 = x, and x^n = x • ... • x (n times) for n > 1 . The rule of powers x^(n + p) = x^n • x^p is obvious." "From the definition of a monoid, one can show that the identity element e is unique. Then, for any x, one can set x^0 = e and the rule of powers is still true with nonnegative exponents." Now, for multiplication, e (the identity element) is 1. So x^0 = 1. > So, strictly speaking, 0^0 is a NaN, and in fact this is what the C++ > complex library implementation of gcc yields. Strictly speaking 0^0 is whatever the one(s) who defines ^ says it is. For that library it's NaN. For the cases I mentioned above, it's not. Martin Shobe |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Nov 15 09:49PM On 15/11/2018 21:45, Shobe, Martin wrote: >> complex library implementation of gcc yields. > Strictly speaking 0^0 is whatever the one(s) who defines ^ says it is. For > that library it's NaN. For the cases I mentioned above, it's not. Here's an idea: don't call std::pow(0, 0) as it is a bug. /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Paul <pepstein5@gmail.com>: Nov 15 12:35PM -0800 I had fun timing the below function which uses the most naive method of doing a popcount. I ran it from i = 0 to 10 million in a for loop. This took 2.5 seconds. However, 10 million is small enough that you can replace 1ull by 1 with no problems. This cut the time from 2.5 seconds to 0.98 seconds, and I did this experiment many times. I am admittedly omitting the code for the for loop here, but if people feel it's relevant, I'd be happy to supply it. The form was for(int i = 0; i < 10 million; ++i) basicPopcount(i); I'm using the Codeblocks IDE with a recent version of gcc and a modern Windows operating system. My laptop is short of memory so I wonder if that's got anything to do with it. Is it really that slow to use non-int integer types and, if so, what can be done about it? Using unsigned long long increases the runtime by 2.5 times. int basicPopcount(int x) { int count = 0; int place = 0; // An overflow bug can arise in this method for large values of x // So make sure types are large enough while(1ull << place <= x) if(1ull << place++ & x) ++count; return count; } |
Jorgen Grahn <grahn+nntp@snipabacken.se>: Nov 15 09:29PM On Thu, 2018-11-15, Paul wrote: > to 0.98 seconds, and I did this experiment many times. > I am admittedly omitting the code for the for loop here, but if people > feel it's relevant, I'd be happy to supply it. It's extremely relevant. > The form was for(int i = 0; i < 10 million; ++i) > basicPopcount(i); If the compiler had access to the basicPopcount() implementation when it compiled that, I'm surprised it wasn't all optimized away. It doesn't do anything! Did you enable optimization when compiling? /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Nov 14 03:53PM -0800 On Wednesday, November 14, 2018 at 5:35:20 PM UTC-5, Chris M. Thomasson wrote: > > The Nephilim. > Indeed. I have a sneaking suspicion that the Nephilim happen to be hyper > smart rebellious alien scientists... If you'd like me to continue to communicate with you, find a way to express yourself without using profanity, or suggestive masked profanity. If you'd like to know the truth about your beliefs, to have them confirmed or denied, read and study the Bible. You'll learn all about them God has revealed to us. The rest is pure speculation, and Satan will be happy to lead you down any path you're willing to believe in there ... and that's something you don't want, even though you might think you do. -- Rick C. Hodgin |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Nov 15 12:02AM On 14/11/2018 22:35, Chris M. Thomasson wrote: > their abominations of desolation, their hybrid strange creations, with > the: Flood...^^...^^^^...^^ > Ascii art for little waves. ;^) Yeah the Nephilim are what we today call "The Grays" (big heads/black eyes) and they continue to abduct and experiment on people. People think they are demons when in fact they are inter-dimensional beings (the word "demon" comes from the word "dimension"). /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Nov 15 12:19AM On 14/11/2018 22:35, Chris M. Thomasson wrote: > their abominations of desolation, their hybrid strange creations, with > the: Flood...^^...^^^^...^^ > Ascii art for little waves. ;^) Jesus was also an alien (a "Nordic Alien" to be precise, see https://en.wikipedia.org/wiki/Nordic_aliens). All his miracles were simply uses of advanced alien technology. Jesus walking on water was a nice effect he achieved by simply using anti-gravity shoes. /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo>: Nov 14 10:25PM -0500 Chris M. Thomasson wrote: > Strange beings: > https://youtu.be/-xW9oy6MFTQ > Why do they seem to resemble alien like beings? ;^) If you like these alien-like things, you may enjoy this story about even more alien-like fungi that enslave and kill ants (warning: not for the faint of heart). https://www.youtube.com/watch?v=XuKjBIBBAL8 ... sorry for the offshoot-off-topic. |
jacobnavia <jacob@jacob.remcomp.fr>: Nov 15 11:03AM +0100 Le 13/11/2018 à 01:28, Chris M. Thomasson a écrit : >>> State B: No longer a Virgin. >> It's described in the Bible how it happened. It was the power >> of God which created the child within her. Wait... 1: this god creates the universe, earth, sun, animals whatever. 2: he gets amnesic and wants to have a child but has forgotten how. 3: then, he needs to go to a woman to make a child... 4: but WAIT WAIT! SEX is bad, so he can't make love and has problems with an erection since he is god 5: what a predicament! what can he do? 6: Hey gabriel would you do me a favor? 7: gabriel: ok, if you want... 8: Look joseph, just one time only, do not be jealous like that, just let me do it one time and it will be over. 9: Maria: MMmmmmmmmmm.... 10: Rick telling us porn stories here with that virgin birth |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Nov 15 03:07AM -0800 On Thursday, November 15, 2018 at 5:03:31 AM UTC-5, jacobnavia wrote: > 1: this god creates the universe, earth, sun, animals whatever. > 2: he gets amnesic and wants to have a child but has forgotten how. > 3: then, he needs to go to a woman to make a child... Sin was here (on Earth, by man). God had to become one of us (a man) ... here ... where we are, to save us from sin where sin was, where we were condemned. He could've just deleted everything and reset the universe: Unviverse* u = new Universe(rand()); while (u->run(_1000_years) == _ERRORS) { delete u; u = new Universe(rand()); } cout << "Ahhh..."; But He didn't. He became part of His creation because He loves you, and wants you to be with Him where He is outside of linear time. The Bible is a tremendous love story, where the creator becomes part of His creation to rescue us from our own voluntary folly (from sin). It's to be revered, not mocked. What He's done is beautiful beyond words. His love is on display. And He and His love is what you're mocking when you mock me / these messages (at least so long as I am accurately conveying the Biblical teachings). Investigate these claims, Jacob. See if I am telling you the truth. Prove me out. Prove the teaching out. Do not just listen to me espouse. Seek to know with certainty for yourself. -- Rick C. Hodgin |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Nov 15 07:27PM On 15/11/2018 11:07, Rick C. Hodgin wrote: >> 2: he gets amnesic and wants to have a child but has forgotten how. >> 3: then, he needs to go to a woman to make a child... > Sin was here (on Earth, by man). Sin is just the name given to a type of buttered scone popular in the 1960s; man-made of course. > God had to become one of us (a man) ... here ... where we are, to > save us from sin where sin was, where we were condemned. As I said in other post God/Jesus is a Nordic Alien using alien technology to perform so called "miracles" for personal amusement. > u = new Universe(rand()); > } > cout << "Ahhh..."; The Nordic Aliens didn't have C++ in the 18th century so that is of course nonsense. > But He didn't. He became part of His creation because He loves you, > and wants you to be with Him where He is outside of linear time. Yes the Nordic Aliens love humans, but as pets. > The Bible is a tremendous love story, where the creator becomes part > of His creation to rescue us from our own voluntary folly (from sin). The Bible is a disinformation document created the Nordic Aliens to retard human technological development ensuring we don't evolve past the "pet" status. > words. His love is on display. And He and His love is what you're > mocking when you mock me / these messages (at least so long as I am > accurately conveying the Biblical teachings). Yes the Nordic Aliens are very fuckable and they like to fuck their pets too so it is a win-win situation. > Investigate these claims, Jacob. See if I am telling you the truth. > Prove me out. Prove the teaching out. Do not just listen to me espouse. > Seek to know with certainty for yourself. Yes the evidence is out there. /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Nov 15 11:39AM -0800 On Thursday, November 15, 2018 at 2:27:15 PM UTC-5, Mr Flibble wrote: > [snip] The ability to know Jesus as Savior and Lord is a gift given those who will be saved, Leigh. It comes from within, not from without. God draws a person to His Son to be saved. It doesn't come from man's convincing arguments or statements. You alone will know if God is calling you, and that call will be know to you on the inside. You alone will be drawn by Him to His Son when He calls you, because the spirit nature will override your flesh nature. You won't even believe what's happening to you, and after it happens you'll be absolutely amazed at what did just happen to you. It will boggle your mind, as your spirit nature asserts itself in your life. You'll stand mouth agape, stunned in every way that the very thing you mocked for decades now has made Himself known to you, and you've been forever changed by it. Until that day, you'll be only as you have been, and all of these things I try and teach you seem as foolishness to you, and you'll only be able to mock those teachings, and place emphasis on Satan's alternate explanations for things, or even invent some of your own, all the while concluding that I and the other people who believe in Jesus, are categorical lunatics of grand stature, deserving your pity at best, your wrath at worst, as "bigots" and "haters." Jesus is the great divider: (1) Sinners, saved by His Grace, going to Heaven. (2) Sinners, unsaved, going to Hell. Someday everyone will come into this knowledge. For some ... it will be too late. I would save you from that today, Leigh, but it's not up to me. It's up to you and your willingness to hear that call and answer it. It's between you and God alone. No one else. -- Rick C. Hodgin |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment