View Single Post
Old 23 March 2021, 00:59   #76
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
OK, I'm gonna give it a rest now (have to do some actual work ><)...
A request to the maintainer, could you please remove my previous versions or eventually leave "A/B 2" as a short+inaccurate version so we can also have a collection of those. The rest is obsolete (yeah, rm -rf is my favorite command ).

My code rates this as max_err=0.528 avg_err=0.159%, not sure what is the sheet going to say. Max absolute is still 0.528 since the "first" value is 100.528, so if you start with a 100 you get 0.528 and if you start with a 101 you get 0.472, and basically that's about it.

Code:
	moveq	#0,d0		; amp=16384, len=1024
	move.w	#511+2,a1
Loop	subq.l	#2,a1
	move.l	d0,d1

; extra accuracy begin (comment in/out as needed)
	move.w	d1,d2
	neg.w	d2
	mulu.w	d1,d2
	divu.w	#74504/2,d2	; 74504=amp/scale
	lsr.w	#2+1,d2
	sub.w	d2,d1
; extra accuracy end

	asr.l	#2,d1
	move.w	d1,(a0)+
	neg.w	d1
	move.w	d1,(1024-2,a0)
	add.l	a1,d0
	bne.b	Loop
a/b is offline  
 
Page generated in 0.05276 seconds with 11 queries