Thanks Stefan.

Let me ask a stupid question based on my one day of experience in Julia: 
Why does the compiler not understand that a negative power will always 
result in numbers requiring floating point precision? My guess is that it 
has to do with the type inference mechanism. But exactly what it is?

I see John wrote about the type instability and speed of execution 
in 
http://www.johnmyleswhite.com/notebook/2013/12/06/writing-type-stable-code-in-julia/

Is there a trick which will force the compiler to consider all variables 
and function arguments, local or not, to be of certain type unless 
explicitly overridden? I ask this question since I would think that while 
doing scientific computation a user will mostly use one numeric type. Is 
this a terrible idea?


On Friday, 6 June 2014 22:18:59 UTC-4, Stefan Karpinski wrote:
>
> A perennial struggle. In this case I personally didn't take it in a bad 
> way – I can certainly see how it seems stupid unless you know about the 
> type stability issue. This is one of those unsatisfying corners of reality 
> that don't seem to have a satisfying solution.
>
> On Jun 6, 2014, at 9:56 PM, John Myles White <[email protected] 
> <javascript:>> wrote:
>
> No worries. After more than two years on it, I’m still figuring out what’s 
> the right tone for the mailing list.
>
>  — John
>
> On Jun 6, 2014, at 6:42 PM, Zahirul ALAM <[email protected] 
> <javascript:>> wrote:
>
> Thanks John. 
>
> with regards to your side note, I will refrain from using that word. In my 
> defense, my drink-fuddled brain was very frustrated. ;)
>
> On Friday, 6 June 2014 20:10:14 UTC-4, John Myles White wrote:
>>
>> You should use 10^-2.0. The way you’re trying to do things would require 
>> that the power function produce different types of outputs for different 
>> input values, which would make optimization/compilation difficult. 
>>
>> As a side note, I think you’ll find it’s more effective not to use the 
>> word “stupid”. 
>>
>>  — John 
>>
>> On Jun 6, 2014, at 5:05 PM, Zahirul ALAM <[email protected]> wrote: 
>>
>> > 10^2 returns 100; 
>> > but 10^-2  or 10^(-2) returns  ERROR: DomainError in power_by_squaring 
>> at intfuncs.jl:60  in ^ at intfuncs.jl:84 
>> > 
>> > do I have to use 1/10^2 instead? 
>> > 
>> > This seems rather stupid. is it a Bug? I am using the nightly build 
>> version downloaded a couple of days ago. I am new to Julia and trying to 
>> convert my a large Mathematica code in Julia. 
>>
>>
>

Reply via email to