Problem with custom script not accepting zero

Dear Experts ,

What is the problem with this custom script ? doc.ed , doc.cst , doc.ebw , doc.fr , these fields are not accepting zero

{
function compute(doc, cdt, cdn){
if (doc.bc && doc.ed && doc.cst && doc.ebw && doc.fr){
x = doc.bc * (doc.ed/100);
y = (doc.bc + x) * (doc.cst/100);
z = (doc.bc + x + y) * (doc.ebw/100);
a = (doc.bc + x + y + z) * (doc.fr/100);
doc.cpk = (doc.bc + x + y + z + a);
doc.less = x;
doc.landed = (doc.cpk - doc.less);
refresh_field(“cpk”);
refresh_field(“less”);
refresh_field(“landed”);
}}
cur_frm.cscript.custom_bc = compute;
cur_frm.cscript.custom_ed = compute;
cur_frm.cscript.custom_cst = compute;
cur_frm.cscript.custom_ebw = compute;
cur_frm.cscript.custom_fr = compute;
}