in reply to Re^2: [OT: JavaScript] JS remainder operation ('%')
in thread [OT: JavaScript] JS remainder operation ('%')
Many languages take incompatible liberties in extending this definition by relying on the same implementation/algorithm, but also allowing floats as input.
The rounding errors theory in your case is very convincing. But you should also check results with negative values and error cases
> Surely, the sane thing to do would be to throw an exception.
NB: JS is particularly reluctant to throw exceptions, it rather follows the "quiet" NaN (= not a number) approach, to silently fail.
IMHO it's impossible to translate this behavior to efficient pure Perl.
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
I have problems imagining a use case for float modulo operations, except reimplementing division.
Any ideas?
|
|---|