|
![](/i/fill.gif) |
In article <38b877a0@news.povray.org>, "Thorsten Froehlich"
<tho### [at] trf de> 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] yahoo com
Web page: http://chrishuff.dhs.org/
Post a reply to this message
|
![](/i/fill.gif) |