Up |
Compare two float arrays. The two arrays can have differents sizes. This function
compare the float number of each index while this value is the same between the
two arrays. The compare is done from an epsilon.
The return value is the last same index.
Example with an epsilon = 0.1 :
10.0 | 5.0 | 2.15 | 25.5 | 20.05 | 10.0 | 3.0
array 1
10.0 | 5.0 | 2.15 | 25.0 | 20.05 | 12.0 | 3.0 | 9.9
array 2
the return value between array 1 and array 2 is 2 (10.0 = 10.0, 5.0 = 5.0, 2.15 = 2.15 but 25.5 != 25.0)
If epsilon is 1.0, the result is 4 (25.5-25.0 < 1.0, so the function continues)
The result depends on the given epsilon ! See the example below.
fun [tab F tab F F] I
Return : I the last same index, nil if the first index (0) is already different and nil if epsilon is nil.
fun main ()=
_showconsole;
let mktab 3 nil -> t in
let mktab 4 nil -> T in
(
set t.0 = set T.0 = 1.1;
set t.1 = set T.1 = 2.1;
set t.2 = 4.0;
set T.2 = 1.41;
set T.3 = 10.0;
_fooId tabcmpF t T 0.1; // 1 (4.0 - 1.41 > 0.1)
_fooId tabcmpF t T 5.0; // 2 (4.0 - 1.41 < 5.0)
);
0;;
Don't forget that the first index is 0, not 1 !