You are viewing a single comment's thread from:

RE: C++ program of (a) power (b) without using builtin function

in #programming7 years ago (edited)

I accepted gladly the point about r/result since it is a matter of fact. But I had doubts about your other remarks. Now you admit they aren't genuine but just childish aimless behavior.

And yours is also just pointless and empty pedantry:

  • you agree that 0^0 = 1 is fine (so why you mentioned it?) — as readers should be able to infer from the fact that the result agrees with the one given by pow();
  • there's an obscure O^-2 = 0 which is nonsense;
  • and at last there's the “inefficient” overflow request, as if it would add value to the code: no, it wouldn't, for at least two reasons: overflow is already accounted for someway with the special Inf value, and then anyway there's no way to signal the overflow, except by throwing an exception (in C++ — but guess what cmath's pow() does…); bonus third reason, the behavior is consistent with pow().

Now I must stress that I am not “correcting someone else's post” for a matter of accuracy, nor I've been in the post pointlessly pedant about something that it's good (but not just as good as I'd like it to be), or that it is just not bad.

No, the reasons for my post are different. Let me summarize few points here, though it's a waste of my time because your comment wasn't genuine but driven by an irrational kind of “spite”.

  • There's a post which has 9 fat votes, (for a little bit more than 9$ right now).
  • It pretends to show how to compute ab without builtin functions,
  • but it doesn't: it implements a wrong algorithm (considered as a whole), and moreover
  • it can be deduced that also it is a wrong implementation of that algorithm (41 = 16 and in general a1 = a² is a bug of what it is otherwise a correct algorithm for positive exponents, and 100-1 = 100-2 = 100-3 = 0.100 is a bug of the algorithm used for negative exponents).
  • Bonus 1, there are hopefully fake comments like “amazing post”, “its really a great logic in this program” and now also “good work bro...”… Even though fake, students stumbling on this post could naively believe they are informed comments and that it is a good “logic” algorithm for ab;
  • bonus 2, poor formatting, poor style, very rookie programming anyway.

I sincerely believe that showing those problems can improve the quality of the contents on steemit, and that that kind of posts should be swept away, not implicitly defended trying to give me “the same medicine” — which is not, in case it isn't clear yet. They are “toxic” posts.

And I want to stress another point. Let us suppose it is a genuine post and not just a “fraud” to get money. I am not judging a poem, or an opinion: code can be objectively judged at least by one criterion, which is very simple: does the code do what you say it does?

If it doesn't, and it fails blatantly, not subtly in few special cases hard to get, how come you publish it trying to sell it as something that supposedly is teaching how to compute ab without builtin functions?

And moreover it takes votes… It's a scam, and it shouldn't be defended, if not for the money at least because there's a risk a novice takes the code seriously and steemit is marked as a bad place for code and programming.