Re: [swift-evolution] floating point numbers implicit conversion

2017-06-20 Thread Ted F.A. van Gaalen via swift-evolution
@Stephen @John: Interesting to learn about the low-level things, thank you, but efficient or not. somewhere along the way, conversions are simply unavoidable, whether explicit or implicit, regardless of its performance... Theoretically, doing: aDouble = Double(aFloat) should have the

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-20 Thread Ted F.A. van Gaalen via swift-evolution
if it were possible, I would only use one floating point type in my app, however FP conversions are needed often, because of heavy usage of library functions e.g. SceneKit that all work with different floating point types.. Programmers should be aware of the implications of conversions e.g.

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-20 Thread Ted F.A. van Gaalen via swift-evolution
> On 19. Jun 2017, at 19:58, Stephen Canon wrote: > >> On Jun 19, 2017, at 11:46 AM, Ted F.A. van Gaalen via swift-evolution >> > wrote: >> >> var result: Float = 0.0 >> result = float * integer * uint8 + double

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-19 Thread John McCall via swift-evolution
> On Jun 19, 2017, at 5:43 PM, David Sweeris wrote: > Sent from my iPhone > On Jun 19, 2017, at 13:44, John McCall via swift-evolution > > wrote: > >>> On Jun 19, 2017, at 1:58 PM, Stephen Canon via

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-19 Thread Stephen Canon via swift-evolution
> On Jun 19, 2017, at 5:43 PM, David Sweeris wrote: > > Sent from my iPhone > On Jun 19, 2017, at 13:44, John McCall via swift-evolution > > wrote: > >>> On Jun 19, 2017, at 1:58 PM, Stephen Canon via

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-19 Thread David Sweeris via swift-evolution
Sent from my iPhone > On Jun 19, 2017, at 13:44, John McCall via swift-evolution > wrote: > >>> On Jun 19, 2017, at 1:58 PM, Stephen Canon via swift-evolution >>> wrote: >>> On Jun 19, 2017, at 11:46 AM, Ted F.A. van Gaalen via

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-19 Thread John McCall via swift-evolution
> On Jun 19, 2017, at 1:58 PM, Stephen Canon via swift-evolution > wrote: >> On Jun 19, 2017, at 11:46 AM, Ted F.A. van Gaalen via swift-evolution >> > wrote: >> >> var result: Float = 0.0 >> result = float

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-19 Thread Stephen Canon via swift-evolution
> On Jun 19, 2017, at 11:46 AM, Ted F.A. van Gaalen via swift-evolution > wrote: > > var result: Float = 0.0 > result = float * integer * uint8 + double > // here, all operands should be implicitly promoted to Double before the > complete expression evaluation.

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-19 Thread Ted F.A. van Gaalen via swift-evolution
Hi Xiaodi in 1966-1970 PL/I, a static-typed procedural block-structured programming language far ahead of its time, with the purpose of giving "all things to all programmers” was introduced by IBM as their main (mainframe) programming flagship. I’ve worked with PL/I very often during my

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-19 Thread Ted F.A. van Gaalen via swift-evolution
> On 18. Jun 2017, at 08:04, Xiaodi Wu wrote: > > On Sun, Jun 18, 2017 at 00:02 Brent Royal-Gordon > wrote: >> On Jun 17, 2017, at 8:43 PM, Xiaodi Wu via swift-evolution >>

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-18 Thread Xiaodi Wu via swift-evolution
On Sun, Jun 18, 2017 at 00:02 Brent Royal-Gordon wrote: > On Jun 17, 2017, at 8:43 PM, Xiaodi Wu via swift-evolution < > swift-evolution@swift.org> wrote: > > How do you express the idea that, when you add values of disparate types T > and U, the result should be of the

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-17 Thread David Sweeris via swift-evolution
Off the top of my head? As the language stands now, maybe a ton of extensions so that it never actually hits the fully generic version? extension Addable where Self == Int8 {...} extension Addable where Self == Int16 {...} extension Addable where Self == Int32 { static func + (lhs: Self, rhs:

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-17 Thread Brent Royal-Gordon via swift-evolution
> On Jun 17, 2017, at 8:43 PM, Xiaodi Wu via swift-evolution > wrote: > > How do you express the idea that, when you add values of disparate types T > and U, the result should be of the type with greater precision? You need to > be able to spell this somehow. To

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-17 Thread Xiaodi Wu via swift-evolution
And, without integer literals as generic parameters, how would you express this operation? On Sat, Jun 17, 2017 at 23:01 David Sweeris wrote: > > On Jun 17, 2017, at 20:43, Xiaodi Wu wrote: > > In Swift, all types and all operators are implemented in

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-17 Thread David Sweeris via swift-evolution
> On Jun 17, 2017, at 20:43, Xiaodi Wu wrote: > > In Swift, all types and all operators are implemented in the standard > library. How do you express the idea that, when you add values of disparate > types T and U, the result should be of the type with greater precision?

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-17 Thread Xiaodi Wu via swift-evolution
In Swift, all types and all operators are implemented in the standard library. How do you express the idea that, when you add values of disparate types T and U, the result should be of the type with greater precision? You need to be able to spell this somehow. On Sat, Jun 17, 2017 at 22:39 David

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-17 Thread David Sweeris via swift-evolution
> On Jun 17, 2017, at 16:16, Xiaodi Wu via swift-evolution > wrote: > >> On Sat, Jun 17, 2017 at 3:21 PM, Ted F.A. van Gaalen >> wrote: >> >> As you know, Swift currently does not facilitate implicit conversion >> (coercion), >> which

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-17 Thread Xiaodi Wu via swift-evolution
On Sat, Jun 17, 2017 at 3:21 PM, Ted F.A. van Gaalen wrote: > Hi Xiaodi > > in 1966-1970 PL/I, a static-typed procedural block-structured programming > language > far ahead of its time, with the purpose of giving "all things to all > programmers” > was introduced by IBM

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-16 Thread David Waite via swift-evolution
> On Jun 16, 2017, at 4:34 PM, Greg Parker > wrote: > > >> On Jun 16, 2017, at 10:35 AM, David Waite via swift-evolution >> > wrote: >> >> Has it been proposed to eventually make

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-16 Thread Greg Parker via swift-evolution
> On Jun 16, 2017, at 10:35 AM, David Waite via swift-evolution > wrote: > > Has it been proposed to eventually make CGFloat into a typealias for Double > to reduce the amount of explicit conversion necessary? (I realize as a > proposal this would be better suited

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-16 Thread David Waite via swift-evolution
Has it been proposed to eventually make CGFloat into a typealias for Double to reduce the amount of explicit conversion necessary? (I realize as a proposal this would be better suited for corelibs-libfoundation) - For Apple platforms, eventually CGFloat will *always* be a Double value, as

Re: [swift-evolution] floating point numbers implicit conversion

2017-06-16 Thread Xiaodi Wu via swift-evolution
Implicit promotion has been brought up on the list before, many times over many years. The scale and implications of the change not to be underestimated. To give a taste of what would be involved, consider that new integer protocols were recently implemented that allow heterogeneous comparison;