

SSCrazy Eights
Group: General Forum Members
Last Login: Yesterday @ 8:36 PM
Points: 8,035,
Visits: 9,748


Hugo Kornelis (7/1/2013) [quote][b](By the way, I think real should be considered to have maximum precision six; you should always calculate with at least one more digit then the precision to limit the effect of rounding errors  at least, that's what has been taught to me in high school). Up that that point I thought your explanation was great, but here you are confusing the precision of representation with the accuracy or results. They aren't the same thing. Besides, your teachers were remiss in telling to use 1 rather than 2 or more  if you want final results accurate to N decimal places all starting values and intermediate results should be represented to a precision of at least N+2 decimal places unless the calculation to be carried out is utterly trivial. It's fine to work with N+1 places when the calculation is something rally very simple like a single multiplication, but if you are trying to compute the eigenvectors or the inverse of a 3 X 3 matrix (both calculations which are extremely common in elementary mechanics) working with N+1 places may give you horribly inaccurate results. 32bit floating point with precision 7 decimal places was intended to carry out complex calculations delivering results to a guaranteed 3 decimal places accuracy  an N+4 design rather than N+1  and of course less complex calculations to greater guaranteed accuracy.
The very earliest floating point hardware implementation (Zuse, 1941) was neither electronic nor part of a stored program computer and had much smaller precision (15 bits  so nominally decimal precision 3) and hence wasn't useful for any complex calculations unless a great lack of accuracy was acceptable.
Tom




SSCrazy
Group: General Forum Members
Last Login: Today @ 8:09 AM
Points: 2,465,
Visits: 2,910


Yes, thanks to Hugo for the detailed explanation. I agree with those who say that the Microsoft documentation could use Hugo's addition!
I think the following queries show the switchover point where the REAL number is returned as 100.
 Num1 = 99.99999 CREATE TABLE #QotD ( Num1 REAL, Num2 FLOAT );
INSERT INTO #QotD VALUES ( 99.9999961, 99.99999999997 );
SELECT * FROM #QotD;
DROP TABLE #QotD;
 Num1 = 100 CREATE TABLE #QotD ( Num1 REAL, Num2 FLOAT );
INSERT INTO #QotD VALUES ( 99.9999962, 99.99999999997 );
SELECT * FROM #QotD;
DROP TABLE #QotD;
Thanks again.
 webrunner
 "Operator! Give me the number for 911!"  Homer Simpson
"A SQL query walks into a bar and sees two tables. He walks up to them and says 'Can I join you?'" Ref.: http://tkyte.blogspot.com/2009/02/sqljoke.html




SSCarpal Tunnel
Group: General Forum Members
Last Login: Friday, October 24, 2014 12:43 PM
Points: 4,126,
Visits: 3,428


L' Eomot Inversé (7/1/2013) . . . The very earliest floating point hardware implementation (Zuse, 1941) was neither electronic nor part of a stored program computer and had much smaller precision (15 bits  so nominally decimal precision 3) and hence wasn't useful for any complex calculations unless a great lack of accuracy was acceptable. Z1 was built in 1936.
http://en.wikipedia.org/wiki/Konrad_Zuse




SSCrazy Eights
Group: General Forum Members
Last Login: Yesterday @ 8:36 PM
Points: 8,035,
Visits: 9,748


Revenant (7/1/2013)
L' Eomot Inversé (7/1/2013) . . . The very earliest floating point hardware implementation (Zuse, 1941) was neither electronic nor part of a stored program computer and had much smaller precision (15 bits  so nominally decimal precision 3) and hence wasn't useful for any complex calculations unless a great lack of accuracy was acceptable.Z1 was built in 1936. http://en.wikipedia.org/wiki/Konrad_Zuse I should have said "commercial hardware implementation" instead of just "hardware implementation" because I was excluding Z1 (as something that didn't really work, so not an implementation) and Z2 (as something which was only a prototype for the Z3 (and a demonstration machine for the German military), not a properly engineered machine. I don't regard the Z1 as an implementation (because it didn't often work, or so I was told).
Although construction of the Z1 started in 1936, it didn't finish until 1938 and even when finished the machining of its parts wasn't clean/accurate enough so the machine frequently went wrong (or at least so I was taught long ago). There was no working Z1 until Siemens worked with Zuse to build one that actually worked (rather than reconstructing one that worked sometimes) in the late 1980s (a valuable history project, I think). The Z2 (finished in 1941) was another oneoff prototype, with no future  it sprawled over too a large space and was very much a string and sealingwax piece of engineering  in effect it was the testbed in which some of the Z3s design was verified. The first working machine, which actually went into production, was the Z3 (also 1941), and that was the machine I meant. Although it wasn't what we today call an electronic stored program computer, it had a significant electrical component (mechanical relays) and did store program in its electromechanical store.
Zuse had patented pretty well all of what is known as Von Neumann architecture a few years before Williams and Kilburn started developing a reliable nonmechanical store for a storedprogram computer which in turn was a year or two before Von Neumann wrote his report. In fact floating point was probably the one area (apart, of course, from politics) where Von Neumann disagreed with Zuse  he was famously antifloatingpoint.
Tom




SSCarpal Tunnel
Group: General Forum Members
Last Login: Friday, October 24, 2014 12:43 PM
Points: 4,126,
Visits: 3,428


L' Eomot Inversé (7/1/2013)
Revenant (7/1/2013)
L' Eomot Inversé (7/1/2013) . . . The very earliest floating point hardware implementation (Zuse, 1941) was neither electronic nor part of a stored program computer and had much smaller precision (15 bits  so nominally decimal precision 3) and hence wasn't useful for any complex calculations unless a great lack of accuracy was acceptable.Z1 was built in 1936. http://en.wikipedia.org/wiki/Konrad_Zuse I should have said "commercial hardware implementation" instead of just "hardware implementation" . . . Tom, as I said already several times, when you come to Redmond, or to the NW from Portland to Vancouver, we have to get together for drinks and I am buying.




SSCAddicted
Group: General Forum Members
Last Login: Saturday, November 29, 2014 2:17 AM
Points: 483,
Visits: 245


That's an easy one but worthwhile regarding the real and float data types. Thanks.




SSChampion
Group: General Forum Members
Last Login: Today @ 8:12 AM
Points: 13,896,
Visits: 11,805





SSCertifiable
Group: General Forum Members
Last Login: Monday, December 15, 2014 4:15 AM
Points: 5,523,
Visits: 1,402





Old Hand
Group: General Forum Members
Last Login: Monday, April 7, 2014 1:30 PM
Points: 395,
Visits: 89





Hall of Fame
Group: General Forum Members
Last Login: Today @ 3:57 AM
Points: 3,584,
Visits: 2,679


Pretty simple question but what a good discussion. Some great explanation by Hugo.



