bigfloat

Steven Schveighoffer schveiguy at yahoo.com
Wed Apr 8 14:10:43 PDT 2009


On Wed, 08 Apr 2009 16:41:35 -0400, Frits van Bommel  
<fvbommel at remwovexcapss.nl> wrote:

> dsimcha wrote:
>> == Quote from Jarrett Billingsley (jarrett.billingsley at gmail.com)'s  
>> article
>>> On Wed, Apr 8, 2009 at 3:39 PM, Walter Bright
>>> <newshound1 at digitalmars.com> wrote:
>>>> Paul D. Anderson wrote:
>>>>> b) the features and functions that should be included.
>>>> I'd say NaNs and unordered comparisons. In other words, it should  
>>>> support
>>>> the same semantics as float, double and real do.
>>> opUnorderedCmp?
>>  What's wrong with just returning some sentinel from opCmp?  For  
>> example, define
>> int.max as the sentinel for when comparing with nans involved, etc.   
>> For opEquals,
>> we don't have a problem, just return false.
>
> IIRC having an opCmp returning floats works, so you could return  
> float.nan.
> (I've never used this, but I think it was mentioned in these groups)


It works if you want to just do x < y.  However, try sorting an array of  
structs that return float for opCmp, and you'll get an error.  This is  
because the compiler has special meaning for opCmp of a certain signature,  
which goes into the TypeInfo.  I submitted a bug for those functions to be  
documented: http://d.puremagic.com/issues/show_bug.cgi?id=2482

-Steve



More information about the Digitalmars-d mailing list