News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Timings for fast median algo

Started by jj2007, July 24, 2020, 12:30:27 AM

Previous topic - Next topic

guga

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

Quote from: guga on July 27, 2020, 09:00:21 AM
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


The elements:   10000000
The minimum:    -0.9999998
The maximum:    0.999999964
The mean:       -1.45892021e-05
The median:     6.515711e-05

guga

Yes. perfect. Testing it right now.  :greenclp: :greenclp:

Tks a lot. :thumbsup: :thumbsup: :thumbsup: :thumbsup:
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