c# code:
float floatA = 4;
float floatB = 17;
float floatC = floatA / floatB; //0.235294119
double doubleA = 4;
double doubleB = 17;
double doubleC = doubleA / doubleB; // 0.23529411764705882
float res = (float)doubleC; // 0.235294119
js code:
var a = 4;
var b = 17;
var c = a / b; // 0.23529411764705882
var res = (a / b).toPrecition(9); // 0.235294118
Why floatC & res are 0.235294119 instead of 0.235294118?
doubleC in c# is the same as c in js. Basically I need to round numbers in javascript the same as c# does it(double to float)