### Author Topic: Timings for fast median algo  (Read 3769 times)

#### guga

• Member
• Posts: 1357
• Assembly is a state of art.
##### Re: Timings for fast median algo
« Reply #45 on: July 27, 2020, 09:00:21 AM »
JJ. Does the adaptation you did to the algo works for negative limit as well ?

Ex..

fsub arrInf.yMin   ; make positive
fmul arrInf.yRange   ; normalise 0...99999

If the minimum limit is...say -1 and the max to 1 can this work too if i set those values ?
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

#### jj2007

• Member
• Posts: 11431
• Assembler is fun ;-)
##### Re: Timings for fast median algo
« Reply #46 on: July 27, 2020, 05:43:26 PM »
If the minimum limit is...say -1 and the max to 1 can this work too if i set those values ?

Like this?

include \masm32\MasmBasic\MasmBasic.inc
Init
Dim MyArray() As REAL8        ; can be DWORD, REAL4, REAL8
For_ ecx=0 To 9999999
Rand(-1.0, 1.0, MyArray(ecx))   ; put random number into Real8 array
Next
PrintLine Str\$("The elements:\t%i", MyArray(?))
PrintLine Str\$("The minimum:\t%f", MyArray(?min)v)
PrintLine Str\$("The maximum:\t%9f", MyArray(?max)v)
PrintLine Str\$("The mean:\t%9f", MyArray(?mean)v)
PrintLine Str\$("The median:\t%f", MyArray(?median)v)
EndOfCode

Code: [Select]
The elements:   10000000
The minimum:    -0.9999998
The maximum:    0.999999964
The mean:       -1.45892021e-05
The median:     6.515711e-05

#### guga

• Member
• Posts: 1357
• Assembly is a state of art.
##### Re: Timings for fast median algo
« Reply #47 on: July 27, 2020, 05:47:19 PM »
Yes. perfect. Testing it right now.

Tks a lot.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com