POV-Ray : Newsgroups : povray.off-topic : Unexpected : Re: Unexpected Server Time
28 Jul 2024 16:15:27 EDT (-0400)
  Re: Unexpected  
From: Orchid Win7 v1
Date: 17 Aug 2013 13:56:37
Message: <520fb955$1@news.povray.org>
On 17/08/2013 05:56 PM, Warp wrote:
> Having been a teaching assistant at the computing science lab, I got to
> see some pretty weird programs made by students.
>
> For example, you wouldn't believe how complicated calculating the length
> of a 2D vector can become in the hands of an inexperienced programmer.
> (This should be a literal one-liner, yet even 100 lines of code were
> regularly broken just to do this simple thing.)

Hmm, yes. I'm just trying to visualise that now... What would I do if I 
had no idea what I'm doing? (I guess the question is, how many of these 
programs ever *worked*?)

>> * return sqrt(x*x); // Evil.
>
> Many C and C++ compilers will actually optimize that to abs(x). I wouldn't
> be surprised if a C# compiler wouldn't do the same...

Perhaps. That doesn't mean this is a good way to achieve that goal though.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.