JAVA -> GWT -> JS double value comparison -
i've trouble comparing 2 double.
if use values came have weird behaviour (if > b comparison give b < !!).
'report' class created gwt rpc
double = report.getr_press_delta_pressure(); double b = report.getr_press_0_delta(); window.alert("compare("+a+", "+b+") = "+double.compare(a, b)); compare(50.0,200.0) = 1
a = 50.0; b = 200.0; window.alert("compare("+a+", "+b+") = "+double.compare(a, b)); compare(50.0,200.0) = -1 (ok)
a = double.parsedouble(""+report.getr_press_delta_pressure()); b = double.parsedouble(""+report.getr_press_0_delta()); window.alert("compare("+a+", "+b+") = "+double.compare(a, b)); compare(50.0,200.0) = -1 (ok)
i obtain same error classic comparison ">", "<"
there reason this? doing wrong?
the get() methods automatically generated:
public final native double getr_press_delta_pressure() /*-{ return this.r_press_delta_pressure; }-*/; public final native double getr_press_0_delta() /*-{ return this.r_press_0_delta; }-*/; the code permuted gwt java html + js, final functions js
i think i've solved: in php file retrieve values sqlite db, here need specify value float, this:
$result->r_press_0_delta = floatval($row['r_press_0_delta']); $result->press_delta_pressure = floatval($row['press_delta_pressure']); thank all.
Comments
Post a Comment