Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,2 @@
put median("4.1,5.6,7.2,1.7,9.3,4.4,3.2") & "," & median("4.1,7.2,1.7,9.3,4.4,3.2")
returns 4.4, 4.25

View file

@ -0,0 +1,24 @@
function floor n
if n < 0 then
return (trunc(n) - 1)
else
return trunc(n)
end if
end floor
function median2 x
local n, m
set itemdelimiter to comma
sort items of x ascending numeric
put the number of items of x into n
put floor(n / 2) into m
if n mod 2 is 0 then
return (item m of x + item (m + 1) of x) / 2
else
return item (m + 1) of x
end if
end median2
returns the same as the built-in median, viz.
put median2("4.1,5.6,7.2,1.7,9.3,4.4,3.2") & "," & median2("4.1,7.2,1.7,9.3,4.4,3.2")
4.4,4.25