<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>On Fri, Dec 18, 2015, at 03:04 PM, Chris Lattner via swift-evolution wrote:<br></div>
<blockquote type="cite"><div>&nbsp;</div>
<div><blockquote type="cite"><div>On Dec 18, 2015, at 3:03 PM, Stephen Canon &lt;<a href="mailto:scanon@apple.com">scanon@apple.com</a>&gt; wrote:<br></div>
<div>&nbsp;</div>
<div><div style="word-wrap:break-word;-webkit-line-break:after-white-space;"><div>&nbsp;</div>
<div><blockquote type="cite"><div>On Dec 18, 2015, at 5:57 PM, Chris Lattner &lt;<a href="mailto:clattner@apple.com">clattner@apple.com</a>&gt; wrote:<br></div>
<div>&nbsp;</div>
<div><div style="word-wrap:break-word;-webkit-line-break:after-white-space;"><div>On Dec 18, 2015, at 1:12 PM, Stephen Canon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br></div>
<div><blockquote type="cite"><div><div style="word-wrap:break-word;-webkit-line-break:after-white-space;"><div>Hi everybody —<br></div>
<div>&nbsp;</div>
<div>I’d like to propose removing the “%” operator for floating-point types.<br></div>
</div>
</div>
</blockquote><div>&nbsp;</div>
<div>I support removing this - it is actively harmful for a surprising operation like this to have such short and inviting syntax. &nbsp;As asked downthread, have you given any thought into whether a Decimal type would support this operation?<br></div>
</div>
</div>
</div>
</blockquote><div>&nbsp;</div>
</div>
<div>The same concerns apply to decimal. &nbsp;It makes sense to have the operation (for both binary and decimal floating-point) as “Type.remainder(a,b)” or a free function like "remainder(a, b)”, but I would prefer not to use the operator “%” for it because it behaves very differently from integer %, and in ways that are not at all obvious to most users.<br></div>
</div>
</div>
</blockquote><div>&nbsp;</div>
</div>
<div>Great, I’d prefer decimal and the float types to have a consistent interface where possible. &nbsp;+1 from me on the proposal.<br></div>
</blockquote><div>&nbsp;</div>
<div>Agreed. +1 from me too. The `10.0 % 0.1` behavior is sufficiently surprising that I think that justifies removal by itself.<br></div>
<div>&nbsp;</div>
<div>I'm also in favor of adding mod and remainder as instance methods of the floating point types, e.g. `10.0.mod(0.1)` (as opposed to static methods or free functions).<br></div>
<div>&nbsp;</div>
<div>-Kevin Ballard</div>
</body>
</html>