It's not like Julia is doing anything strange or uncommon here. Most people 
would be really surprised if -10² meant positive 100.

Den torsdagen den 18:e september 2014 kl. 15:01:44 UTC+2 skrev Jutho:
>
> because it is not recognized/parsed as literal but as the application of a 
> unary minus, which has lower precedence than ^
>
> I guess it is not possible to give binary minus a lower precedence than ^ 
> and unary minus of higher precedence, since these are just different 
> methods of the same function/operator.
>
> Op donderdag 18 september 2014 14:54:26 UTC+2 schreef Florian Oswald:
>>
>> yes - not sure why -0.4 and (-0.4) are any different.
>>
>> On 18 September 2014 13:52, Patrick O'Leary <patrick...@gmail.com> wrote:
>>
>>> Seems like the literal -0.4^2.5 should throw the same error, though?
>>>
>>>
>>> On Thursday, September 18, 2014 6:42:56 AM UTC-5, Tim Holy wrote:
>>>>
>>>> http://docs.julialang.org/en/latest/manual/faq/#why-does-
>>>> julia-give-a-domainerror-for-certain-seemingly-sensible-operations 
>>>>
>>>> On Thursday, September 18, 2014 03:24:00 AM Florian Oswald wrote: 
>>>> > # define a variable gamma: 
>>>> > 
>>>> > gamma = 1.4 
>>>> > mgamma = 1.0-gamma 
>>>> > 
>>>> > julia> mgamma 
>>>> > -0.3999999999999999 
>>>> > 
>>>> > # this works: 
>>>> > 
>>>> > julia> -0.399999999999^2.5 
>>>> > -0.10119288512475567 
>>>> > 
>>>> > # this doesn't: 
>>>> > 
>>>> > julia> mgamma^2.5 
>>>> > ERROR: DomainError 
>>>> > in ^ at math.jl:252 
>>>>
>>>>
>>

Reply via email to