What is the behavior of this function supposed to be? F(a,b) is the nearest multiple of b to a? I'm curious what definition is consistent with all three given examples.
On Thu, Oct 8, 2015 at 9:20 PM, Isaiah Norton <[email protected]> wrote: > See > http://julia.readthedocs.org/en/latest/manual/integers-and-floating-point-numbers/#rounding-modes > and the rest of the discussion on that page. > > On Thu, Oct 8, 2015 at 11:01 AM, Sisyphuss <[email protected]> wrote: > >> Hello everyone, >> >> I want a function F(), so that >> F(0.154, 0.1) = 0.1 >> F(0.154, 0.01) = 0.15 >> F(0.154, 0.003) = 0.153 >> >> I tried `div(a,b)*b`. However, I got: >> >> div(0.128,0.0001) * 0.0001 = 0.1279 >> >> not equal to 0.1280 >> >> Any solution? >> > >
