Failed to passing vec<f64> to canister functions

I’m working on a vector database on icp rn, i’m passing a float64 vec to canister function. It works fine when it’s passing vec<f32>. However, when I changed it to vec<f64>, it hints me that the cannot decode float32 vec to float64 vec.

It’s seemingly a canister limitation or network limitation, even i’m passing float64 array from client side, either from javascript(number are natively f64) or ic-repl(float number are f64), it’s still showing what i’m passing is a float32 vec.

candid

type Result_1 = variant { Ok : vec record { float64; text }; Err : text };
get_similar : (nat32, vec float64, int32) -> (Result_1) query;

my ic-repl codes:

#!ic-repl

let b = file("arr.txt");  // a.txt contains 768 bytes
function f(x) { let _ = 0.1 };
let b = b.map(f);

let vdb = service "bkyz2-fmaaa-aaaaa-qaaaq-cai";
call vdb.get_similar(0, b, 1);

Error message:


Anyone can help?

1 Like

Resolved, seems ic-repl and javascript both relys on candid declaration, after updating it, it’s working fine.

3 Likes