This is not Julia-specific, but what the IEEE floating point standard
requires. One rationale, I guess, could be a form of sign preservation
(signbit(x)==signbit(round(x))), although of course abs(sign(-0.0))==0.
Negative zeros make some computations more convenient, but can also be
the source of
Hi,
You have discovered that IEEE standard floating point numbers have two
distinct zeros: 0.0 and -0.0. They compare `==` even though they are not
`===`. If you want to consider +0.0 and -0.0 to be the same, use `==` or
`!=` not `===` or `!==` when testing floating point values (the other
I see. So the multiple dispatch is better than anonymous function in 0.4
In 0.5, if I do this
create_function{T}(coeff::Vector{T}) = x -> sum(coeff .* [x^k for k in 1:
length(coeff)])
would it have better performance?
On Tuesday, April 19, 2016 at 8:44:26 PM UTC-7, Yichao Yu wrote:
>
> On Tue, A
Hello everyone!
I was wondering if the following behavior of round() has an special
purpouse:
a = round(0.1)
0.0
b = round(-0.1)
-0.0
a == b
true
a === b
false
bits(a)
""
bits(b)
"10
> Again, I don't know if there is any demand for adding a general
> facility for this.
If you have in mind to make a PR, I would be a client for such a
facility. IIUC, this would e.g. allow me to change automatically the
prompt by calling a function from .juliarc.jl ? (which I do manually
now with
On Tue, Apr 19, 2016 at 11:31 PM, Po Choi wrote:
> Given coefficients, say, coeff = [1,2,3]
> I want to get a function for the polynomial: f(x) = coeff[1] * x + coeff[1]
> * x^2 + coeff[1] * x^3
>
> First way
> create_function(coeff) = x -> sum(coeff .* [x^k for k in 1:length(coeff)])
>
> Second w
Given coefficients, say, coeff = [1,2,3]
I want to get a function for the polynomial: f(x) = coeff[1] * x + coeff[1]
* x^2 + coeff[1] * x^3
First way
create_function(coeff) = x -> sum(coeff .* [x^k for k in 1:length(coeff)])
Second way
immutable Myfunction
coeff::Vector
end
call(f::Myfuncti
+1 (what Stefan said)
Is there a way to auto-generate something appropriate that takes care of
the ambiguity with Bool that pops up frequently, for numerical methods that
never intend being called with Bool arg(s)?
On Tuesday, April 19, 2016 at 3:08:20 PM UTC-4, Stefan Karpinski wrote:
>
> I'v
As a partial solution, this makes warnings print in black rather than red.
julia> Base.eval(parse("default_color_warn = :black"))
I just had a problem in which I wanted to do the opposite, restore coloring
and bold to a new REPL.
Also, this gives a black, plain typeface to warning and error mes
Thanks. I got it working. I copied much of the code in client.jl. In the
end I wrote the new mode directly into a copy of REPL.setup_interface.
There is probably an easier way to get the REPL to start in the new mode
rather than julia, but this was faster for me. There were many details, eg
Milan Bouchet-Valat wrote:
> This is an inner constructor, not an outer one. But you would usually
> write it in a very different way. What you did is equivalent to the
> much simpler:
>
> Where did you get this convoluted idea?
Precisely in the section of the manual you're pointing me too ;-)
I have an embarrassingly parallel problem with the following features:
1. I need to run a pure function on different inputs a lot of times
2. I need to record the results of *every* call to this function
3. I need to pass a lot of information as input to this function, and in
particul
I've always felt that arbitrarily breaking a tie is just asking for trouble
when ties actually occur since the choice that's made is rather likely to
be wrong. At this point it seems fairly clear that definition-time warnings
about method ambiguities are usually too annoying, especially between
unr
On Apr 19, 2016 12:30 PM, wrote:
>
>
> It is quite weird.
> If I type in the REPL the following lines:
>
> > f(a=1, b=2) = a + 2b
> > f(a::Int, b::Int) = a - 2b
> > f() # this gives me -3
> > f(1,2) # this gives me -3
>
> but if I type
> > f(a=1, b=2) = a + 2b
> > f() # -> 5
> > f(a::Int, b::Int)
Hi Juliets,
Just started working on my first major Julia project and thought I'd share
some of the results so far:
https://github.com/fblscode/Fbls.jl
A few issues that I'm still struggling with:
1) I would like to add support for using arrays, dicts and other kinds of
sequences as field value
It is quite weird.
If I type in the REPL the following lines:
> f(a=1, b=2) = a + 2b
> f(a::Int, b::Int) = a - 2b
> f() # this gives me -3
> f(1,2) # this gives me -3
but if I type
> f(a=1, b=2) = a + 2b
> f() # -> 5
> f(a::Int, b::Int) = a - 2b
> f() # -> 5 again
> f(1,2) # -> -3
so the call
On Tue, Apr 19, 2016 at 11:22 AM, Maurice Diamantini
wrote:
> Hi,
>
> Since two years have passed since the original question, is there now a
> standard way to install some packages for them to be available for all the
> users?
> If not wat is the actuel hack to do that?
You can install into `LOA
Huh.. I just tried julia -p 2 on version 0.4.5 and it actually starts with 3
processes and 2 workers.
So the docs are correct.
Sorry i cant help with the 0.5 version..
Hi,
Since two years have passed since the original question, is there now a
standard way to install some packages for them to be available for all the
users?
If not wat is the actuel hack to do that?
Thank you very much,
-- Maurice
On Tuesday, April 19, 2016 04:47:54 PM Milan Bouchet-Valat wrote:
> Perfect, thanks. I must say I never really understood what that giant
> PR was about, except that it sounded interesting.
This predecessor explains its motivation:
https://github.com/JuliaLang/julia/pull/10691. It's morphed to hav
All of this seems very reasonable... Except for the fact that also nprocs()
is returning 1 after calling julia -p 2 :D
I call julia from terminal using *export PATH* in bash_profile, but the
behavior is the same if I go in the directory and call *./Julia -p 2*
Plus, I think I saw n workers afte
Le mardi 19 avril 2016 à 06:58 -0700, Matt Bauman a écrit :
> That's https://github.com/JuliaLang/julia/pull/11242. Another common
> workaround is a generated function (but the wrapper function is
> better if you don't need other generated functionality):
>
> @generated function f(x...)
> N =
That's https://github.com/JuliaLang/julia/pull/11242. Another common
workaround is a generated function (but the wrapper function is better if
you don't need other generated functionality):
@generated function f(x...)
N = length(x)
:(Array{Int, $N})
end
On Tuesday, April 19, 2016 at 8:
As Greg said, the total number of workers is one less than the number of
available processes.
There is always one master process (with id = 1, and not considered a
worker) and the remaining workers.
So for *julia -p 3 *you will get one master process and two workers.
The documentation may be mi
I second that - overwriting the conversion worked very well for me while
debugging some time ago. If you throw an error, you get the exact line
number where it happened:
Base.convert(::Type{BigFloat}, x::Float64) = throw(InexactError())
One case to watch out for, which I only found in my code w
Hi!
I'm looking for the recommended way of getting type inference to
determine the number of elements passed via varargs.
I guess a code snippet is better than a thousand words: in the
following function, the type of a isn't inferred correctly.
function f(x...)
N = length(x)
a = Array{In
julia -p 2 will start Julia with 2 processes.
nprocs() will return 2
nworkers() will return 1 (1 less than nprocs())
http://docs.julialang.org/en/release-0.4/stdlib/parallel/?highlight=nworkers#Base.nworkers
On Tuesday, April 19, 2016 at 6:58:30 PM UTC+10, Iacopo Poli wrote:
> Hi,
>
> I'm tr
julia -p 2 will start Julia with 2 processes.
nprocs() will return 2
nworkers() will return 2 (1 less than nprocs())
http://docs.julialang.org/en/release-0.4/stdlib/parallel/?highlight=nworkers#Base.nworkers
On Tuesday, April 19, 2016 at 6:58:30 PM UTC+10, Iacopo Poli wrote:
> Hi,
>
> I'm tryi
Le mardi 19 avril 2016 à 11:58 +0200, Didier Verna a écrit :
> There's something I don't understand about them:
>
> type Foo
> val
> double
> function call(::Type{Foo}, val)
> new(val, 2*val)
> end
> end
This is an inner constructor, not an outer one. But you would usually
write it in a ver
There's something I don't understand about them:
type Foo
val
double
function call(::Type{Foo}, val)
new(val, 2*val)
end
end
I understand here that the programmer explicitly provides a way to call
Foo(3), but how does this prevent calls to Foo(3, 4) from being
automatically defined as us
Hi,
I'm trying to start Julia with more than one worker, but if I type in the
terminal for example "julia -p 2", then in the REPL nworkers() returns 1.
I have version *0.5.0-dev+3488 *and a Intel Core i5 (Macbook Pro Mid 2012).
Running system_profiler:
"system_profiler SPHardwareDataType
Ha
31 matches
Mail list logo