POV-Ray : Newsgroups : povray.advanced-users : Divide by Zero Error ? : Re: Divide by Zero Error ? Server Time
28 Jun 2024 01:50:03 EDT (-0400)
  Re: Divide by Zero Error ?  
From: Ron Parker
Date: 9 Aug 1999 09:31:53
Message: <37aed849@news.povray.org>
[crossposted to .bugreports, note followups]

On Sun, 08 Aug 1999 19:54:58 -0700, Ken wrote:
>
>
>Ron Parker wrote:
>> 
>> On Sun, 08 Aug 1999 17:28:21 -0700, Ken <tyl### [at] pacbellnet> wrote:
>> 
>> >Is this causing a divide by zero error or ? It gets past parsing but
>> >when is gets to building bounding slabs it crashes Pov violently.
>> 
>> The crash is not a divide by zero error.  I'm not sure what it is, but
>> it might be a stack fault.  It crashes somewhere deep within the
>> Visual C++ runtime library for me, in the process of doing a malloc
>> under a pile of calls to sort_and_split.  In short, I have no idea
>> what you did here. :)
>
>Do you think it's a bug and maybe someone should report it ? You could
>probably word it in programmerese better than I if you feel it is worth
>bringing to the teams attention.

Yes, it's a bug.  Anything that crashes is a bug in my book, whether or
not it's due to bad code.  I've copied in the faulty code below, for the
sake of the bug hunters. (The loop on Y wasn't necessary to duplicate
the crash, so I've elided it.)  

It may be worth noting that internally POV sets the result of a division by 
zero to HUGE_VAL, which is 1e17 by default.  It's likely that some code 
somewhere in the creation and subdivision of bounding slabs has trouble with 
this huge number, which is something like 2^60.  I don't understand
sort_and_split all that well, I'm afraid.

------------- cut here -------------
camera{location<0,20,20>look_at 0}

light_source{<0,50,100> rgb 1}

#declare Y = 0;
#declare X = 0;
#while (X < 50)
      sphere {
             <X, Y, sin(X/Y)>, 0.1
             pigment {color rgb<(sin(X/Y) + 1)/2, 0, 0>}
      }              
      #declare X = X + 1;
#end
------------- cut here -------------


Post a reply to this message

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