The long division like approach to square root was taught in schools here when I was young.
The disadvantage with respect to Newton's is that the convergence is linear. Each iteration gives two more digits rather than doubling the number of correct digits. I suspect it's also more complex to implement.
Trigonometric/transcendental function accuracy
Re: Trigonometric/transcendental function accuracy
My implementation was definetly an iteration approach, and from my memory, I am 99% certain, that it was Newton-Raphson.
The code was based on some code I found in a magazine, either BYTE or Dr. Dobbs Journal, that represented floating point numbers and did basic arithmetic, +-*/. It sounds easy enough, but the assembler code was complex.
The code was based on some code I found in a magazine, either BYTE or Dr. Dobbs Journal, that represented floating point numbers and did basic arithmetic, +-*/. It sounds easy enough, but the assembler code was complex.
/Rudi
DM-42 (s/n 06999), HP-42S, HP-35s, HP-11c, HP-32SII (ex HP-41CV, ex HP-75C, ex HP-48G + a lot, really lot of a accessories)
Denmark
DM-42 (s/n 06999), HP-42S, HP-35s, HP-11c, HP-32SII (ex HP-41CV, ex HP-75C, ex HP-48G + a lot, really lot of a accessories)
Denmark
Re: Trigonometric/transcendental function accuracy
The Intel Decimal Point LIbrary, if you look at the source code, in dpml_sqrt.c, there are some interesting comments.
One appears to be a proof of Tuckerman's Rounding, a bit on Newton's iteration, and lots of comments, exclamation marks, and even bits left like this:
#elif SQRT && (F_PRECISION <= 24) && (B_PRECISION < 2*F_PRECISION)
/* This case is unlikely enough that we will worry about it
when we need to (if ever). There is code in older versions of
sqrt that does a tuckermans rounding on single prec values. */
# error "We need to worry about it now."
It is all way above my head, but weirdly fascinating.
One appears to be a proof of Tuckerman's Rounding, a bit on Newton's iteration, and lots of comments, exclamation marks, and even bits left like this:
#elif SQRT && (F_PRECISION <= 24) && (B_PRECISION < 2*F_PRECISION)
/* This case is unlikely enough that we will worry about it
when we need to (if ever). There is code in older versions of
sqrt that does a tuckermans rounding on single prec values. */
# error "We need to worry about it now."
It is all way above my head, but weirdly fascinating.
SN:09075
Re: Trigonometric/transcendental function accuracy
Lovely. Sometimes, I wish I could go back three or four decades. I also think that the beer tasted better back then…
/Rudi
DM-42 (s/n 06999), HP-42S, HP-35s, HP-11c, HP-32SII (ex HP-41CV, ex HP-75C, ex HP-48G + a lot, really lot of a accessories)
Denmark
DM-42 (s/n 06999), HP-42S, HP-35s, HP-11c, HP-32SII (ex HP-41CV, ex HP-75C, ex HP-48G + a lot, really lot of a accessories)
Denmark
Re: Trigonometric/transcendental function accuracy
The 90s were a golden age. We didn't realise it at the time!
SN:09075
Re: Trigonometric/transcendental function accuracy
Fun fact: golden ages exist only in the past.
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
Re: Trigonometric/transcendental function accuracy
Maybe you meant Golden Ale.
Greetings,
Massimo
ajcaton
-+×÷ left is right and right is wrong Casted in gold
Massimo
ajcaton
-+×÷ left is right and right is wrong Casted in gold
Re: Trigonometric/transcendental function accuracy
I'm quite surprised to see the C47 (C43) simulator shows a very reduced precision result in this case - is this expected? I was hoping for very similar accuracy to Free42.whuyse wrote: ↑Sun Mar 26, 2023 2:29 pmOlder HPs (the 41, and its emulator DM-41X) also show the problem for SIN(x) for x close to PI;
eg. PI SIN (in RAD mode of course..) returns -4.1E-10 on a 41.
I'm not sure which model was first, but certainly the 42S and its faithful simulator Free42 (and thus, the DM42) get it right, the latter even all 34 digits
PI = 3.141592653589793238462643383279503
SIN(PI) = -1.158028306006248941790250554076922E-34
PI + SIN(PI) = 3.1415926535897932384626433832795028841971693993751058209749445923078
Cheers, Werner
PI = 3.141592653589793238462643383279503
SIN(PI) = -1.1580283060062489E-34
Re: Trigonometric/transcendental function accuracy
My (unsupported) supposition is that Free42 is incorrectly rounding which cascades to a less reliable result.
I am very much aware that Intel's decimal library has rounding issues in the last digit at times.
I'm not aware of any such issues in the WP 34S firmware.
Pauli
I am very much aware that Intel's decimal library has rounding issues in the last digit at times.
I'm not aware of any such issues in the WP 34S firmware.
Pauli