Re: [julia-users] product of Int64 and Float64 is Int64

2016-10-19 Thread Michele Zaffalon
Thanks.

On Wed, Oct 19, 2016 at 1:46 PM,  wrote:

> Or include a space.
>
> parse("1. * 80") --> :(1.0 * 80)
>
> parse("1.* 80")  --> :(1 .* 80)
>
> On Wednesday, October 19, 2016 at 1:30:27 PM UTC+2, Mauro wrote:
>>
>> On Wed, 2016-10-19 at 13:11, Michele Zaffalon 
>> wrote:
>> > I am confused by the type of the result of `1.*80`, which is `Int64`,
>> despite
>> > the fact that `1.` is `Float64`, and that `Float64(1)*80` is a
>> `Float64`:
>>
>> No this is parsed as 1 .* 80.  Try 1.0*80
>>
>> > julia> typeof(1.), typeof(80), typeof(1.*80), typeof(Float64(1.)*80)
>> > (Float64,Int64,Int64,Float64)
>> >
>> > Does it have to do with the fact that both 1 and 80 have an exact
>> Float64
>> > representation?
>> >
>> > julia> bits(1.)
>> > "0011"
>> >
>> > julia> bits(80.)
>> > "010001010100"
>> >
>> >
>> > Thank you,
>> > michele
>>
>


Re: [julia-users] product of Int64 and Float64 is Int64

2016-10-19 Thread lapeyre . math122a
Or include a space.  

parse("1. * 80") --> :(1.0 * 80)

parse("1.* 80")  --> :(1 .* 80)

On Wednesday, October 19, 2016 at 1:30:27 PM UTC+2, Mauro wrote:
>
> On Wed, 2016-10-19 at 13:11, Michele Zaffalon  > wrote: 
> > I am confused by the type of the result of `1.*80`, which is `Int64`, 
> despite 
> > the fact that `1.` is `Float64`, and that `Float64(1)*80` is a 
> `Float64`: 
>
> No this is parsed as 1 .* 80.  Try 1.0*80 
>
> > julia> typeof(1.), typeof(80), typeof(1.*80), typeof(Float64(1.)*80) 
> > (Float64,Int64,Int64,Float64) 
> > 
> > Does it have to do with the fact that both 1 and 80 have an exact 
> Float64 
> > representation? 
> > 
> > julia> bits(1.) 
> > "0011" 
> > 
> > julia> bits(80.) 
> > "010001010100" 
> > 
> > 
> > Thank you, 
> > michele 
>


Re: [julia-users] product of Int64 and Float64 is Int64

2016-10-19 Thread Michele Zaffalon
And

julia> parse("1.*80")
:(1 .* 80)
julia> parse("1.0*80")
:(1.0 * 80)


On Wednesday, October 19, 2016 at 1:36:00 PM UTC+2, Michele Zaffalon wrote:
>
> I should have realized that:
>
> julia> promote(1., 80)
> (1.0,80.0)
> julia> 80*1.
> 80.0
>
> Thank you.
>
> On Wednesday, October 19, 2016 at 1:30:27 PM UTC+2, Mauro wrote:
>>
>> On Wed, 2016-10-19 at 13:11, Michele Zaffalon  
>> wrote: 
>> > I am confused by the type of the result of `1.*80`, which is `Int64`, 
>> despite 
>> > the fact that `1.` is `Float64`, and that `Float64(1)*80` is a 
>> `Float64`: 
>>
>> No this is parsed as 1 .* 80.  Try 1.0*80 
>>
>> > julia> typeof(1.), typeof(80), typeof(1.*80), typeof(Float64(1.)*80) 
>> > (Float64,Int64,Int64,Float64) 
>> > 
>> > Does it have to do with the fact that both 1 and 80 have an exact 
>> Float64 
>> > representation? 
>> > 
>> > julia> bits(1.) 
>> > "0011" 
>> > 
>> > julia> bits(80.) 
>> > "010001010100" 
>> > 
>> > 
>> > Thank you, 
>> > michele 
>>
>

Re: [julia-users] product of Int64 and Float64 is Int64

2016-10-19 Thread Michele Zaffalon
I should have realized that:

julia> promote(1., 80)
(1.0,80.0)
julia> 80*1.
80.0

Thank you.

On Wednesday, October 19, 2016 at 1:30:27 PM UTC+2, Mauro wrote:
>
> On Wed, 2016-10-19 at 13:11, Michele Zaffalon  > wrote: 
> > I am confused by the type of the result of `1.*80`, which is `Int64`, 
> despite 
> > the fact that `1.` is `Float64`, and that `Float64(1)*80` is a 
> `Float64`: 
>
> No this is parsed as 1 .* 80.  Try 1.0*80 
>
> > julia> typeof(1.), typeof(80), typeof(1.*80), typeof(Float64(1.)*80) 
> > (Float64,Int64,Int64,Float64) 
> > 
> > Does it have to do with the fact that both 1 and 80 have an exact 
> Float64 
> > representation? 
> > 
> > julia> bits(1.) 
> > "0011" 
> > 
> > julia> bits(80.) 
> > "010001010100" 
> > 
> > 
> > Thank you, 
> > michele 
>


Re: [julia-users] product of Int64 and Float64 is Int64

2016-10-19 Thread Mauro
On Wed, 2016-10-19 at 13:11, Michele Zaffalon  
wrote:
> I am confused by the type of the result of `1.*80`, which is `Int64`, despite
> the fact that `1.` is `Float64`, and that `Float64(1)*80` is a `Float64`:

No this is parsed as 1 .* 80.  Try 1.0*80

> julia> typeof(1.), typeof(80), typeof(1.*80), typeof(Float64(1.)*80)
> (Float64,Int64,Int64,Float64)
>
> Does it have to do with the fact that both 1 and 80 have an exact Float64
> representation?
>
> julia> bits(1.)
> "0011"
>
> julia> bits(80.)
> "010001010100"
>
>
> Thank you,
> michele


[julia-users] product of Int64 and Float64 is Int64

2016-10-19 Thread Michele Zaffalon
I am confused by the type of the result of `1.*80`, which is `Int64`, 
despite the fact that `1.` is `Float64`, and that `Float64(1)*80` is a 
`Float64`:

julia> typeof(1.), typeof(80), typeof(1.*80), typeof(Float64(1.)*80)
(Float64,Int64,Int64,Float64)

Does it have to do with the fact that both 1 and 80 have an exact Float64 
representation?

julia> bits(1.)
"0011"

julia> bits(80.)
"010001010100"


Thank you,
michele