Why does your example have : Real which is a type found in languages of the 
Pascal family such as: Pascal, Modula2 and possibly Delphi .  (Considered 
obsolete in Delphi)

in a program which uses C family syntax ?  C++, C#, Java  none of which have 
the Real type.   



________________________________
From: Wols Lists <antli...@youngman.org.uk>
To: u2-users@listserver.u2ug.org
Sent: Monday, November 14, 2011 4:44 PM
Subject: Re: [U2] Simplify, or why mathematicians make better programmers

On 14/11/11 19:49, George Gallen wrote:
> Or didn't know about the INT() command, and forced everything to be even.....
> 
> Which in reality, is kinda odd. (Couldn't resist).
> 
:-)

In reality, you could well be correct !!!

When I was involved in recruiting a C programmer ages ago, we set a simple 
competence test. I lifted a snippet of code from one of OUR OWN programs 
somewhere that said something like ...

real rr = our value of interest;

int ii = rr*10;

int mm = ( rr - (float(ii)/10) ) * 10;

if (mm>5)
  float rr2 = int( rr + .5 );
else
  float rr2 = int( rr);

We asked the candidates to identify what this code was doing, and could they do 
it any simpler. We made a point of saying that all we wanted was for them to 
spot what was going on ...

With only ONE exception, every candidate rewrote it and made it even more 
convoluted. That one exception got it right ...

rr2 = round( rr);

Cheers,
Wol
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to