Re: [julia-users] 0.5 how to convert to Int

2016-10-27 Thread Steven G. Johnson
On Thursday, October 27, 2016 at 4:21:39 AM UTC-4, Ángel de Vicente wrote: > > > > program...@gmail.com writes: > > > BIG THX, but what about Float array ? > round(Int, rand(5)) also works. (In 0.6 this will probably be deprecated in favor of round.(Int, rand(5)) ...)

Re: [julia-users] 0.5 how to convert to Int

2016-10-27 Thread Angel de Vicente
programista...@gmail.com writes: > BIG THX, but what about Float array ? map(x->round(Int,x),rand(Bool,5)) map(x->round(Int,x),rand(5)) both do work. -- Ángel de Vicente http://www.iac.es/galeria/angelv/

Re: [julia-users] 0.5 how to convert to Int

2016-10-27 Thread programistawpf
BIG THX, but what about Float array ? julia> Int.(rand(Bool,10)) 10-element Array{Int64,1}: 1 0 1 1 1 0 1 0 0 0 julia> Int.(rand(10)) ERROR: InexactError() in macro expansion at .\broadcast.jl:129 [inlined] in macro expansion at .\simdloop.jl:73 [inlined] in macro expansion at .\broad

Re: [julia-users] 0.5 how to convert to Int

2016-10-27 Thread Angel de Vicente
Hi, programista...@gmail.com writes: > in ver 0.5 how to convert to Int f.e bool or Float > > julia> int(rand(Bool,10)) > ERROR: UndefVarError: int not defined > > julia> convert(Int64,rand(Bool,10)) > ERROR: MethodError: Cannot `convert` an object of type Array{Bool,1} to an > object of type Int

Re: [julia-users] 0.5 how to convert to Int

2016-10-27 Thread Mauro
you must have missed Julia 0.4 which told you: _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type "?help" for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.4.7 (201

[julia-users] 0.5 how to convert to Int

2016-10-27 Thread programistawpf
in ver 0.5 how to convert to Int f.e bool or Float julia> int(rand(Bool,10)) ERROR: UndefVarError: int not defined julia> convert(Int64,rand(Bool,10)) ERROR: MethodError: Cannot `convert` an object of type Array{Bool,1} to an object of type Int64 This may have arisen from a call to the construct