#1572 js Int.divFloat

go4 Sun 10 Jul 2011

My code like this:

a := 800
b := 600
f := a / b.toFloat

java: f == 1.33
js: f == 1

Maybe divFloat has some problem.

java:

public static double divFloat(long self, double x) { return (double)self / x; }

js:

fan.sys.Int.divFloat = function(a, b) { return fan.sys.Float.make(fan.sys.Int.div(a, b)); }

andy Mon 11 Jul 2011

Thanks @go4 - pushed a fix

go4 Tue 12 Jul 2011

Int.divDecimal too

andy Tue 12 Jul 2011

Decimal isn't implemented in JavaScript yet - so probably have to touch all that code when its gets added - so not too worried about it here.

Login or Signup to reply.