How would you solve this 'interview' question in D?

John Colvin john.loughran.colvin at gmail.com
Thu Jun 27 05:42:08 PDT 2013


On Thursday, 27 June 2013 at 12:38:25 UTC, John Colvin wrote:

Woops, sorry missed an assert

unittest
{
         assert(f(f(int.min)) == -(cast(long)int.min));
         foreach(int n; int.min + 1 .. int.max)
         {
                 assert(f(f(n)) == -n);
         }
  	assert(f(f(int.max)) == -int.max);
}


More information about the Digitalmars-d-learn mailing list