Prove me wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
21st Nov 2017, 5:55 PM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar
20 Answers
+ 19
the math seems intact to me 16 is quite different from 16.97056274847714
21st Nov 2017, 6:32 PM
Burey
Burey - avatar
+ 11
As Burey said, you didn't break math, math broke you. :)
21st Nov 2017, 6:45 PM
AgentSmith
+ 6
Maybe you have proven there is a difference between an integer and a floating point.
21st Nov 2017, 8:09 PM
Paul
Paul - avatar
+ 3
It's just like how you can't round π to 3.2 and then argue that physicists are wrong because if you calculate with 3.2 then the results will be totally off - π just isn't 3.2. 12√2 ≈ 16.97, but 12√2 ≠ 16.97.
21st Nov 2017, 11:24 PM
tVrd
tVrd - avatar
+ 2
The sqrt of 289 is 17 exactly. But, The sqrt of 288 is not exactly 16.97 The sqrt of 288 is *not* exactly 16.97 Why would you think that it is? Math and javascript seem to be working just fine.
22nd Nov 2017, 2:22 PM
Rob Blans
Rob Blans - avatar
+ 1
Should be this for correct answer: var xc=Math.sqrt(256);
21st Nov 2017, 6:38 PM
Duncan
Duncan - avatar
+ 1
You have proven nothing and your updated code does not explain easier. From the JavaScript course (rounding has nothing to do with it): "JavaScript numbers are always stored as double precision floating point numbers."
21st Nov 2017, 10:00 PM
Duncan
Duncan - avatar
+ 1
When you round 16.97... to 17 you feel it is necessary, but round 287.999998 to 288 is more unnecessary for you??? But you're a genius, of course... If we have infinite memory cell and "ask" infinite processor what equal sqrt(288), whatever we get the number, not equal to 17, because square root of non-square number is irrational (infinite) number. I.e. we exactly doesn't know what mean sqrt(2), because this number INFINITE and we never see sqrt(2) last digit, but we exactly know that sqrt(2)^2 = 2. We invented square root themselves and sometimes we shouldn't round so hard
9th Dec 2017, 2:38 PM
Ярослав Иноземцев
Ярослав Иноземцев - avatar
0
You haven't tested that the variables are equal, you have tested them against 2 independent values. You are not a genious.
21st Nov 2017, 10:14 PM
Duncan
Duncan - avatar
0
if you don't round.. 287.999998 does not equal 288.
22nd Nov 2017, 3:04 PM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar
- 1
updated code to explain easier.
21st Nov 2017, 7:52 PM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar
- 1
mathematical definition of rounding is round when you feel is necessary,. 16 rounded to 17 means,17 squared is 289.
21st Nov 2017, 8:10 PM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar
- 1
I showed how different variables are achieved by mathematics. ✓288=16.97 but 16.97 squared does not equal 288. if you round, then you could say round to 17. 17 squared is 289, not 288. mathematical definition of rounding is round when you feel is necessary. if I round at ✓288=16.97 by rounding to 17, then 17 squared is 289.
21st Nov 2017, 10:31 PM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar
- 1
according to the mathematical definition of rounding I can round when I feel it is necessary. ✓288=16.97, even if you wanted to be accurate and not round.. the number would not be the same if you did 16.97*16.97. you can plug in the numbers, it still doesn't add up. I was checking my work in Pythagorean Theorem when I noticed these issues. wether you round or don't round, I'm still right.
22nd Nov 2017, 2:58 PM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar
- 1
✓288= 16.9705627 16.9705627*16.9705627=287.999998
22nd Nov 2017, 3:03 PM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar
- 1
simply put.. 16.97 was me rounding to save people the trouble of thinking too much.
22nd Nov 2017, 3:05 PM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar
- 2
16.97 squared doesn't equal 288, hence the square root of 288 does not equal 16.
21st Nov 2017, 7:49 PM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar
- 2
if you don't use rounding, the code proves the variables are not equal. anomaly. I'm a genius, thank you.
21st Nov 2017, 10:01 PM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar
- 2
Genius.
21st Nov 2017, 10:23 PM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar
- 4
I'm a genius!
21st Nov 2017, 7:55 PM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar