POV-Ray : Newsgroups : povray.beta-test : No error message for array element nr. -1 : Re: No error message for array element nr. -1 Server Time
29 Jul 2024 12:17:09 EDT (-0400)
  Re: No error message for array element nr. -1  
From:
Date: 9 May 2002 02:37:22
Message: <v66kdu0ou58og7rain2ur778mlhqgcd2bh@4ax.com>
On Thu, 09 May 2002 01:55:58 +0200, Tor Olav Kristensen
<tor### [at] hotmailcom> wrote:
> I just discovered that RC4 for Windows does not issue an
> error message if one tries to access array element nr. -1
>
> Here's the code I tried:
>
> #declare A = array[1] { 0 }
>
> // No error messages
> #declare N = A[-1]; 
> #declare A[-1] = 0;

I can confirm however I wonder if it could be ... floating point accuracy.
What rounding is performed when float is converted to integer ? Truncation
towards zero ? Could it be that -1 is internally something like -0.99999999999
and after truncation it is valid value 0 ? If yes then possible fix is to
check sign of the float before conversion to int.

POV 3.5 RC4 icl on WinNT Sp 6 PII 233 with 128 MB

ABX


Post a reply to this message

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