Open ikaradogan opened 3 years ago
Thanks for the nice catch. I'm sure this is not the last discrepancy to be found :)
Yes, that line is where we could create a function instead of aliasing Math.round
. I don't have much free cycles the coming weeks. A PR (by you, or anybody else) is welcome!
Hi,
here is a short solution for stdlib.py.
greets
pyxdroid
FUNCTIONS['round'] = """function (x, dec) { // nargs: 1 2
return (x >= 0) ? (!dec ? Math.round(x) : Number(Math.round(x+'e'+dec)+'e-'+dec))
: (!dec ? Math.round(x-Number.EPSILON) : Number(Math.round(x-Number.EPSILON+'e'+dec)+'e-'+dec));
}"""
The round function takes one or two parameters in Python and one parameter in JavaScript. In Flexx, while using round with two parameter in PyWidget, the program does not fail, but in JS Widget it fails.
From what i see this line may need to be fixed.