Re: [julia-dev] round() function in Julia

59 views
Skip to first unread message

Jeff Bezanson

unread,
Oct 6, 2012, 7:26:46 PM10/6/12
to juli...@googlegroups.com
What result do you get?

On Sat, Oct 6, 2012 at 7:09 PM, Stéphane Laurent <lauren...@yahoo.fr> wrote:
> Hi,
> The command round(x,n), e.g. round(pi,3), does not work with my computer. I
> use a recent version of Julia on Windows XP.
>
> --
>
>
>

Harlan Harris

unread,
Oct 7, 2012, 4:14:11 PM10/7/12
to juli...@googlegroups.com
Really? Could you just type "round" at the REPL and show us what methods you get? There's nothing in the two/three-arg round code that refers to 64-bit anything. It's generic to Integer. 

Are you building on that machine? Does "make test" work?

 -Harlan

On Sun, Oct 7, 2012 at 4:00 PM, Stéphane Laurent <lauren...@yahoo.fr> wrote:
For instance
round(pi,3)
no method round(Float32,Int32)

--
 
 
 

Patrick O'Leary

unread,
Oct 7, 2012, 4:14:59 PM10/7/12
to juli...@googlegroups.com
Two-argument round/ceil/floor/trunk were pretty recent additions, and might not be in the Windows binary release yet.

If you need them now, you can use this snippet:

for f in (:round, :ceil, :floor, :trunc)
    @eval begin
        function ($f)(x, digits::Integer, base::Integer)
            og = _round_og(digits, base)
            ($f)(float(x) / og) * og
        end
        ($f)(x, digits) = ($f)(x, digits, 10)
    end
end



On Sunday, October 7, 2012 3:00:21 PM UTC-5, Stéphane Laurent wrote:
For instance
round(pi,3)
no method round(Float32,Int32)




Le dimanche 7 octobre 2012 01:26:47 UTC+2, Jeff Bezanson a écrit :

Keno Fischer

unread,
Oct 7, 2012, 4:18:09 PM10/7/12
to juli...@googlegroups.com
They are in current master on windows, though probably not yet in the binary distributions. Jameson is working on creating new binaries atm and I'll join in myself later, to try to get this figured out. 
Reply all
Reply to author
Forward
0 new messages