POV-Ray : Newsgroups : povray.unofficial.patches : My personal wishlist : Re: My personal wishlist Server Time
2 Sep 2024 22:17:30 EDT (-0400)
  Re: My personal wishlist  
From: Chris Huff
Date: 27 Feb 2000 09:01:41
Message: <chrishuff_99-30DB49.09030927022000@news.povray.org>
In article <38b877a0@news.povray.org>, "Thorsten Froehlich" 
<tho### [at] trfde> wrote:

> User control can still be available, i.e. introducing two functions 
> to eliminate the common operations that should create floating-point 
> results: For division offer a Pascal style "div" function (or even 
> operator), and to still allow mixing integer and floating-point math 
> without forcing promotion to floating-point for the result, an "int" 
> function which can be placed around any section of a function, for 
> example "#declare MyFoo = 1; #declare MyFoo = 8084 div 7 + MyFoo - 
> (int(sin(45) * 10) * MyFoo;" would still give in an integer result.

Those functions already exist in POV. :-)

Section 4.1.3.6  Float Functions
...
div(A,B) Integer division. The integer part of (A/B) .
int(A) Integer part of A . Returns the truncated integer part of A . 
Rounds towards zero.


Now all that has to be done is add code for deciding whether to use 
integer or floating point...btw, I think the precision should be 
specified instead of being left to the implementation of "int", it would 
make the language more consistant across platforms and compilers. Or 
maybe just have it decide depending on the size of the number-but I 
think the overhead of that(some conditionals, comparisons, and type 
conversions?) would outweigh any possible benefits.

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

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