yes

On Fri, Mar 31, 2017 at 12:30 PM, Ian Davis <m...@iandavis.com> wrote:

> On Fri, 31 Mar 2017, at 05:19 PM, Michael Jones wrote:
>
> There is part of the topic that has always been slightly beyond my grasp.
> (Maybe I do understand...but just lack absolute certainty.) Maybe others
> know the answer...
>
> In a template system (which is what I prefer but that's not the point of
> this email) we have the notion of the TYPE(s) being a formal argument. We
> presume that the code will compile or fail based on the suitability of the
> instantiated type. That is, a templated Min would fail on the comparison
> "<" if the TYPE was "Map[something]something." Call that a lexical fail.
>
> My question is, what about a semantic fail. Say, "<" for floating point.
> In the sort package the Less function does !Less(a,b)&&!Less(b,a) to figure
> out Equal(a,b). That works for ints and strings, but when I templated sort
> I found that it failed in tests with float32 and float64 because of NaN
> values, which are !Less(a,b)&&!Less(b,a) yet !Equal(a,b). I had to make two
> templates, one for floating point values and one for integral/string values.
>
>
> Is this because sort.Less requires total ordering and, because of NaN, <
> for floats only offers partial ordering?
>
> Ian
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Michael T. Jones
michael.jo...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to