[m-dev.] inf or infinity

Julien Fischer jfischer at opturion.com
Wed Aug 13 17:39:30 AEST 2014


On Wed, 13 Aug 2014, Ben Schmidt wrote:

> On 13/08/14 3:30 PM, Julien Fischer wrote:
>> On Wed, Aug 13, 2014 at 3:26 PM, Ben Schmidt 
> <schmidtb at student.unimelb.edu.au
>> <mailto:schmidtb at student.unimelb.edu.au>> wrote:
>>
>>     I prefer the shorter 'inf', because you can also use 'NaN' (or 'nan'), 
> whereas
>>     not_a_number is somewhat cumbersome.
>>
>>
>> Using "infinity" does not mean we can not also use "nan".
>
> Of course, but I'm a programmer; I like consistency. :-p
>
> If you use 'inf', I'll automatically try 'nan' as it's the corresponding 
> abbreviation (and vice-versa). I would also guess 'inf' before trying 
> 'infinity', 
> but that's probably as much to do with how I 'grew up' as anything else.

Another objection to "inf" is that mathematically "inf" is occasionally
used as an abbrevation of "infimum".

> If you use 'infinity', I'll stop and think "What am I supposed to use?"

If you're using pure Mercury you shouldn't writing code that deals with
NaNs, other than catching the exceptions that should result from them
(at least that's the idea, see the comments at the head of the float
module).

...

> Is mercury unicode?

That's a somewhat vague question, however, the status of Unicode
support in Mercury is:

* String literals, comments and quoted names can contain Unicode
characters.

* Text file streams are UTF-8 encoded (even on the non-C backends).

> Just use ±∞. :-D

No.  (It's not a valid unquoted Mercury name in any case.)

Cheers,
Julien.


More information about the developers mailing list