widemul returns a value of a type that is guaranteed to be big enough to
hold the result. For Int128, this is BigInt, not Int128 and BigInt(6) !==
Int128(6):

julia> widemul(Int128(3), Int128(2))
6

julia> typeof(ans)
BigInt


The == operator just checks for numerical equality.

On Fri, Dec 25, 2015 at 12:03 PM, Pranit Bauva <[email protected]>
wrote:

> Hey everyone!
>
> This gives an error
> julia> @test widemul(Int128(3), Int128(2)) === Int128(6)
> ERROR: test failed: 6 is 6
>  in expression: widemul(Int128(3),Int128(2)) === Int128(6)
>  in error at ./error.jl:21
>  in default_handler at test.jl:30
>  in do_test at test.jl:53
>
> julia>
>
>
> But this does not
> julia> @test widemul(Int128(3), Int128(2)) == Int128(6)
>
> julia>
>
>
>
> Could someone please explain how is `===` differing from `==` in this case?
>
> Regards,
> Pranit Bauva
>
>
>

Reply via email to