Radical in calculator !!!

irpersian20

Junior Member
Oct 15, 2012
24
0
0
Hi,
The windows 7 calculator
I enter Radical 4 - 2
But show for me
-1.068281969439142e-19
!!!!!
Why? What's this?
 

SOFTengCOMPelec

Platinum Member
May 9, 2013
2,417
75
91
You seem to mean sqrt(4) - 2 = -1.068281969439142e-19

Which is correct(to 18/19 digits), as the calculator only calculates accurately to about 18/19 digits.

As -1.068281969439142e-19 is almost 0

-1.068281969439142e-19 = -0.00000000000000000001068281969439142 = almost 0 = ok
 

Yuriman

Diamond Member
Jun 25, 2004
5,530
141
106
I get -8.16x10^-19

Float only holds so many decimal places, that's why it's not generally used for financial calculations.
 

SOFTengCOMPelec

Platinum Member
May 9, 2013
2,417
75
91
Can you give me an example for this?
Can you give me proof?(Reason)
I'm confused. Thank you

I'm also confused.

What do you think is wrong ?

I am confused as to why you are not happy with the answers 2 posters have supplied.
What part of the answers don't you understand and/or disagree with ?

Obviously I DON'T know what you are thinking.
 
Last edited:

Revolution 11

Senior member
Jun 2, 2011
952
79
91
That's kind of weird. On my old XP laptop, I get 1.0605907030850721689734498566293e-38.

Edit = How did my post insert itself midway into the thread? Post time says 1:18 PM but my clock is at 7:07 PM.
 

SOFTengCOMPelec

Platinum Member
May 9, 2013
2,417
75
91
That's kind of weird. On my old XP laptop, I get 1.0605907030850721689734498566293e-38.

Edit = How did my post insert itself midway into the thread? Post time says 1:18 PM but my clock is at 7:07 PM.

It's the number of digits that the calculator uses.

I think the OLD ones used some kind of big maths software library, approx 38 digits.

Newer ones seem to use (hardware) floating point Extended type, with about 18/19 digits resolution.

If the calculator uses rounding effectively, it can actually produce the less confusing answer of 0
 

Rakehellion

Lifer
Jan 15, 2013
12,181
35
91
I get 0 in Mac OS X .


I get -8.16x10^-19

Float only holds so many decimal places, that's why it's not generally used for financial calculations.

Yeah, but 4 and 2 and powers of 2 and whole numbers, so there shouldn't be any rounding errors. That's a bug in the square root algorithm.
 

Schmide

Diamond Member
Mar 7, 2002
5,595
730
126
Can you give me an example for this?
Can you give me proof?(Reason)
I'm confused. Thank you

Your calculator/computer does not inherently know that 2 is the sqrt of 4.

The method I believe they use is the Newton–Raphson method.



(click image for wikipedia article)

The above is basically a specific (optimized) form of a Taylor Expansion


(click image for wikipedia article)

As you can see it takes multiple operations and is only exact to a certain number of digits per iteration.

Any further explanations will be given in your calculus II/III - Numerical Analysis class.
 

videogames101

Diamond Member
Aug 24, 2005
6,783
27
91
The square root function is using a numerical method which is going to repeatedly determine closer and closer results for the square root operation. Once the result is within some error of the actual result, (tested by squaring the result and subtracting the operand, 4) that result is used.

The -1.068281969439142e-19 is a little less than the error allowable by whatever approximation method the calculator is using.

You expected an exact result, but windows 7 doesn't have a CAS system by default in its calculator, and is instead using numeric methods for finding square roots.

EDIT: time warping has returned
 
Last edited:

SOFTengCOMPelec

Platinum Member
May 9, 2013
2,417
75
91
Hi,
The windows 7 calculator
I enter Radical 4 - 2
But show for me
-1.068281969439142e-19
!!!!!
Why? What's this?

If you set the calculator to scientific mode, it will give you a more accurate answer.

The specification lists the calculator (in scientific mode) as being accurate to 32 digits, so it's best to ignore anything after 32 digits.

-8.1648465955514287168521180122928e-39 (scientific mode answer)

The following quote is from the calculator help menu:

In Scientific mode, Calculator is precise to 32 significant digits.

If you expect or want it to say 0
What you need to do is set the rounding/fix/etc mode, or some other calcs will produce 0 anyway.

This IS available in a number of software calculators, but NOT apparently in the Microsoft win7 one.
So if you are VERY bothered by this, feel free to use another software calculator, with this feature.
 
Last edited:

KingFatty

Diamond Member
Dec 29, 2010
3,034
1
81
Google says the answer is zero, when you do a google search for sqrt(4)-2
No idea if that's because it knows the math, or if it just rounds off the answer?
 

SOFTengCOMPelec

Platinum Member
May 9, 2013
2,417
75
91
Ah yes, now I get "-8.1648465955514287168521180122928e-39"

Sorry, I was a bit SNAPPY saying that.

At least we are in agreement now!

32 significant digits =

+0.00000000000000000000000000000000###### Where ##=Ends
-0.00000000000000000000000000000000000000081648465955514287168521180122928

So the answer is WELL within the 32 significant digits, so it is NOT a bug as such.
But it would have been much better if it had rounded it to 0, and/or had a rounding/fix/etc mode, to make it show 0

I said I was confused at the OP, because I am not sure if he realises "-8.1648465955514287168521180122928e-39" and zero are almost the same thing. I.e. does he/she understand what e-39 is ?
Or if he is too bothered that it is not exactly 0 ?
 

SOFTengCOMPelec

Platinum Member
May 9, 2013
2,417
75
91
Google says the answer is zero, when you do a google search for sqrt(4)-2
No idea if that's because it knows the math, or if it just rounds off the answer?

It seems to be rounding, because if you try:

"sqrt(4.1)-2" it comes up with
0.02484567313
which is just an approximation to about 10 digits or so, of the correct answer.

"1/7*7.000000000000000000001-1"

So it seems to be rounding to about 10 or so digits.
 

Idontcare

Elite Member
Oct 10, 1999
21,110
59
91
Sorry, I was a bit SNAPPY saying that.

At least we are in agreement now!

32 significant digits =

+0.00000000000000000000000000000000###### Where ##=Ends
-0.00000000000000000000000000000000000000081648465955514287168521180122928

So the answer is WELL within the 32 significant digits, so it is NOT a bug as such.
But it would have been much better if it had rounded it to 0, and/or had a rounding/fix/etc mode, to make it show 0

I said I was confused at the OP, because I am not sure if he realises "-8.1648465955514287168521180122928e-39" and zero are almost the same thing. I.e. does he/she understand what e-39 is ?
Or if he is too bothered that it is not exactly 0 ?

LOL, not snappy at all. I failed to read your post TBH. I saw the OP, read a few posts below the OP, and just felt like adding one more datum to the thread. Only afterwards did I look up and read your post right above mine, for which I agree my post looked rather out of place right below yours

Sometimes I need to be smacked with a wet-trout, it happens
 

sm625

Diamond Member
May 6, 2011
8,172
137
106
You would have to add this error in a loop for a long long time in order for this number to be significant:

Code:
x = 0;
for(a = 0; a < 1000000; a++)
	for(b = 0; b < 1000000; b++)
		for(c = 0; c < 1000000; c++)
			for(d = 0; d < 1000000; d++)
				for(e = 0; e < 1000000; e++)
					for(f = 0; f < 1000000; f++)
						x += sqrt(4) - 2;

That code would probably take years to execute, I'm not exactly sure. (sqrt function takes 10nS to execute.) That's how small and insignificant this error is.
 
Last edited:

Schmide

Diamond Member
Mar 7, 2002
5,595
730
126
You would have to add this error in a loop for a long long time in order for this number to be significant:

Code:
x = 0;
for(a = 0; a < 1000000; a++)
	for(b = 0; b < 1000000; b++)
		for(c = 0; c < 1000000; c++)
			for(d = 0; d < 1000000; d++)
				for(e = 0; e < 1000000; e++)
					for(f = 0; f < 1000000; f++)
						x += sqrt(4) - 2;

That code would probably take years to execute, I'm not exactly sure. (sqrt function takes 10nS to execute.) That's how small and insignificant this error is.

Why would you use Undecillion operations to calculate a Duodecillion term?

Code:
x = 0;
for(unsigned int a = 0; a < 1545867928; a++)
	for(unsigned int b = 0; b < 4294967296; b++)
		for(unsigned int c = 0; c < 4294967296; c++)
			for(unsigned int d = 0; d < 4294967296; d++)
				x += sqrt(4) - 2;

Optimized to 1.224762753711557105657117300394e+38 operations. Then number of them needed to get to 1.

EDIT: Since the compiler would optimize out the sqrt operation, on todays computers it would take approximately 320years to complete. (as an unsigned int takes ~10sec to overflow)
 
Last edited:

sm625

Diamond Member
May 6, 2011
8,172
137
106
EDIT: Since the compiler would optimize out the sqrt operation, on todays computers it would take approximately 320years to complete. (as an unsigned int takes ~10sec to overflow)


sqrt is a function call. The compiler cannot optimize it out even if the input to the sqrt function is always the same.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |