I wrote a code:
let rec compareVs v1 v2 =
if List.length v1 == 0 then
true
else
((match v1 with [] -> 0. | h::l -> h) == (match v2 with [] -> 0. | h::l -> h)) &&
(compareVs(match v1 with [] -> [] | h::l -> l) (match v2 with [] -> [] | h::l -> l))
And ran it:
# compareVs [0.1;0.1] [0.1;0.1];;
- : bool = false
Can't seem to find the problem. Please help.
EDIT
The problem seams to be with float comparisons:
# 0.1 == 0.1;;
- : bool = false
# 1.0 == 1.0;;
- : bool = false
How else can we compare floats in ocaml?