Int.min is the smallest negative value, and Int.max is the largest positive 
value (that fits in an Int). However, the absolute value of Int.min is larger 
than the absolute value of Int.max. So you can't convert Int.min into -Int.min 
because it's larger than Int.max.

In other words, this is expected behaviour :)

For example:

Int.min + Int.max = 1

If they were the same value, it would be zero.

Alex

> On 22 Sep 2017, at 02:42, Peter W A Wood via swift-users 
> <[email protected]> wrote:
> 
> Entering the following statement in a playground gives an overflow error. 
> Where should I report this?
> 
> Statement:
> 
> Int.min.dividedReportingOverflow(by:-1)
> 
> Playground log:
> 
> Playground execution failed:
> 
> error: MyPlayground.playground:3:9: error: division '-9223372036854775808 / 
> -1' results in an overflow
> Int.min.dividedReportingOverflow(by:-1)
> 
> Peter
> _______________________________________________
> swift-users mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to