Re: [julia-users] Re: Julia cannot compute factorial(21) while Octave can

2015-01-16 Thread Carlos Baptista
Thanks Frank :) , similar answers were already given

On 16/01/2015, Frank Kampas  wrote:
> factorial(BigInt(21)) works
>
> On Monday, January 12, 2015 at 10:10:06 PM UTC-5, Carlos Baptista wrote:
>>
>> I understand that factorial(21) is quite a large number and therefore an
>> OverflowError is perfectly understandable. However, with Octave I can go
>> up
>> to factorial(170) (if I go higher I receive Inf). Is there a way to go
>> beyond factorial(20) in Julia?
>>
>


-- 
Regards,

C. F. Baptista


[julia-users] Re: Julia cannot compute factorial(21) while Octave can

2015-01-16 Thread Frank Kampas
factorial(BigInt(21)) works

On Monday, January 12, 2015 at 10:10:06 PM UTC-5, Carlos Baptista wrote:
>
> I understand that factorial(21) is quite a large number and therefore an 
> OverflowError is perfectly understandable. However, with Octave I can go up 
> to factorial(170) (if I go higher I receive Inf). Is there a way to go 
> beyond factorial(20) in Julia?
>


[julia-users] Re: Julia cannot compute factorial(21) while Octave can

2015-01-15 Thread Ivar Nesje
Currently *OverflowError* doesn't have a message field, so to do this, you 
have to either let showerror 

 
check the backtrace to look for *factoria*l or add a text field, so that 
factorial can add the message to the exception.

I think we eventually want all exceptions to have a string field with a 
message, but there has been raised some concerns about the performance 
overhead in some situations. It seems possible to fix that problem, but I 
don't really understand the underlying issues well enough to comment on 
that.

Ivar

onsdag 14. januar 2015 21.48.36 UTC+1 skrev g følgende:
>
> Is there a way to provide a suggestion with the error?
>
> It currently says this, 
>
> *julia> **factorial(21)*
>
> *ERROR: OverflowError()*
>
> * in factorial_lookup at combinatorics.jl:27*
>
> * in factorial at combinatorics.jl:35*
>
> Maybe it would be more useful if it said
>
> *julia> **factorial(21)*
>
> *ERROR: OverflowError("perhaps you want factorial(big(21)) instead?")*
>
> * in factorial_lookup at combinatorics.jl:27*
>
> * in factorial at combinatorics.jl:35*
>
> On Wednesday, January 14, 2015 at 11:37:17 AM UTC-7, Viral Shah wrote:
>>
>> I am guessing, that like Matlab, octave uses doubles to represent 
>> integers, and hence you can go a bit farther than with integers. That 
>> should be the same as factorial(21.0) in julia. Of course, you can also use 
>> BigInt and such, which has already been discussed here.
>>
>> -viral
>>
>> On Tuesday, January 13, 2015 at 8:40:06 AM UTC+5:30, Carlos Baptista 
>> wrote:
>>>
>>> I understand that factorial(21) is quite a large number and therefore an 
>>> OverflowError is perfectly understandable. However, with Octave I can go up 
>>> to factorial(170) (if I go higher I receive Inf). Is there a way to go 
>>> beyond factorial(20) in Julia?
>>>
>>

[julia-users] Re: Julia cannot compute factorial(21) while Octave can

2015-01-14 Thread ggggg
Is there a way to provide a suggestion with the error?

It currently says this, 

*julia> **factorial(21)*

*ERROR: OverflowError()*

* in factorial_lookup at combinatorics.jl:27*

* in factorial at combinatorics.jl:35*

Maybe it would be more useful if it said

*julia> **factorial(21)*

*ERROR: OverflowError("perhaps you want factorial(big(21)) instead?")*

* in factorial_lookup at combinatorics.jl:27*

* in factorial at combinatorics.jl:35*

On Wednesday, January 14, 2015 at 11:37:17 AM UTC-7, Viral Shah wrote:
>
> I am guessing, that like Matlab, octave uses doubles to represent 
> integers, and hence you can go a bit farther than with integers. That 
> should be the same as factorial(21.0) in julia. Of course, you can also use 
> BigInt and such, which has already been discussed here.
>
> -viral
>
> On Tuesday, January 13, 2015 at 8:40:06 AM UTC+5:30, Carlos Baptista wrote:
>>
>> I understand that factorial(21) is quite a large number and therefore an 
>> OverflowError is perfectly understandable. However, with Octave I can go up 
>> to factorial(170) (if I go higher I receive Inf). Is there a way to go 
>> beyond factorial(20) in Julia?
>>
>

[julia-users] Re: Julia cannot compute factorial(21) while Octave can

2015-01-14 Thread Viral Shah
I am guessing, that like Matlab, octave uses doubles to represent integers, 
and hence you can go a bit farther than with integers. That should be the 
same as factorial(21.0) in julia. Of course, you can also use BigInt and 
such, which has already been discussed here.

-viral

On Tuesday, January 13, 2015 at 8:40:06 AM UTC+5:30, Carlos Baptista wrote:
>
> I understand that factorial(21) is quite a large number and therefore an 
> OverflowError is perfectly understandable. However, with Octave I can go up 
> to factorial(170) (if I go higher I receive Inf). Is there a way to go 
> beyond factorial(20) in Julia?
>