26 lines
816 B
Text
26 lines
816 B
Text
include builtins\unicode_console.e -- (0.8.0+)
|
|
|
|
constant tests = {"0 1 19 20", "0 0 1 1",
|
|
"0 999 4000 4999 7000 7999", "1 1 2 2 3 3",
|
|
"1 2 3 4 5 6 7 8 7 6 5 4 3 2 1",
|
|
"1.5, 0.5 3.5, 2.5 5.5, 4.5 7.5, 6.5"}
|
|
|
|
for i=1 to length(tests) do
|
|
sequence ti = split_any(tests[i]," ,",no_empty:=true)
|
|
for j=1 to length(ti) do
|
|
{{ti[j]}} = scanf(ti[j],"%f")
|
|
end for
|
|
atom mn = min(ti),
|
|
mx = max(ti),
|
|
range = mx-mn
|
|
printf(1,"Min :%g, Max :%g, Range :%g\n",{mn,mx,range})
|
|
|
|
if unicode_console() then
|
|
for j=1 to length(ti) do
|
|
ti[j] = #2581 + min(7,floor((ti[j]-mn)/range*8))
|
|
end for
|
|
printf(1,"%s\n",{utf32_to_utf8(ti)})
|
|
else
|
|
puts(1,"unicode is not supported\n")
|
|
end if
|
|
end for
|