 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
#local i=0;
#while (i<1)
#debug concat(str(i,0,2),"\n")
#local i=i+0.1;
#end
gives
0.00
0.10
0.20
0.30
0.40
0.50
0.60
0.70
0.80
0.90
1.00
is the1.00 normal ???
if we change i=i+0.1 into i=i+0.2 it stops at 0.8
povray3.5b6 win2000 Athlon 900MHz 256MB
M
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
in news:3bc402f7$1@news.povray.org Mael wrote:
> is the1.00 normal ???
> if we change i=i+0.1 into i=i+0.2 it stops at 0.8
>
Same happens in 3.1g
Ingo
--
Photography: http://members.home.nl/ingoogni/
Pov-Ray : http://members.home.nl/seed7/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 10 Oct 2001 05:18:40 -0400, ingo wrote:
>in news:3bc402f7$1@news.povray.org Mael wrote:
>
>> is the1.00 normal ???
>> if we change i=i+0.1 into i=i+0.2 it stops at 0.8
>>
>
>Same happens in 3.1g
It's roundoff error. I is probably .9999999 or so for the last iteration,
but it gets rounded for output.
--
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbt 1}hollow interior{media{emission T}}finish{
reflection.1}}#end Z(-x-x.2y)Z(-x-x.4x)camera{location z*-10rotate x*90}
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> It's roundoff error. I is probably .9999999 or so for the last iteration,
> but it gets rounded for output.
isn t it strange to get a roundoff error for only 10 additions ? i thought
pov was more precise :(
M
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Mael wrote:
>>It's roundoff error. I is probably .9999999 or so for the last iteration,
>>but it gets rounded for output.
>>
>
> isn t it strange to get a roundoff error for only 10 additions ? i thought
> pov was more precise :(
>
> M
>
You can get roundoff error with only one addition. It comes from the
fact that floating point numbers can not always be converted between
base2 and base10 without roundoff.
To see what happens, you have to modify your code to show all the
decimal places, like this:
#local i=0;
#while (i<1)
#debug concat(str(i,0,17),"\n")
#local i=i+0.1;
#end
Which (on my machine) produces:
0.00000000000000000
0.10000000000000001
0.20000000000000001
0.30000000000000004
0.40000000000000002
0.50000000000000000
0.59999999999999998
0.69999999999999996
0.79999999999999993
0.89999999999999991
0.99999999999999989
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* videotron.ca */}camera{location<6,1.25,-6>look_at a orthographic}
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
ok, thank you, it's clear.. we can't trust computers for maths :)
i'll change the test in the loop to avoid this
M
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Wed, 10 Oct 2001 14:50:11 +0200, Mael wrote:
>ok, thank you, it's clear.. we can't trust computers for maths :)
The problem is that .1 in decimal is a repeating fraction in binary, so it
can never be represented precisely, just as 1/3 is a repeating fraction in
decimal (but terminates in base 3.)
--
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbt 1}hollow interior{media{emission T}}finish{
reflection.1}}#end Z(-x-x.2y)Z(-x-x.4x)camera{location z*-10rotate x*90}
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> #local i=0;
> #while (i<1)
> #debug concat(str(i,0,2),"\n")
> #local i=i+0.1;
> #end
Try
#local i = 0;
#while (i < 10)
#debug concat(str(i/10, 0, 2), "\n")
#local i = i + 1;
#end
Since there is no round off error with adding integers.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Mael wrote:
> ok, thank you, it's clear.. we can't trust computers for maths :)
Yes we can. As long as we remembers that computers do not have the same
number of fingers to count on.
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* videotron.ca */}camera{location<6,1.25,-6>look_at a orthographic}
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Mael <mae### [at] hotmail com> wrote:
: isn t it strange to get a roundoff error for only 10 additions ? i thought
: pov was more precise :(
0.1 can't be represented accurately with binary floating point format.
The reason is the same as why 1/3 can't be represented accurately with
decimal format.
--
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}// - Warp -
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Note that counting in integers will work fine, and so should counting by
fractions that are non-repeating decimals in binary, such as .25, .125, and
.0625.
- Slime
[ http://www.slimeland.com/ ]
[ http://www.slimeland.com/images/ ]
"Francois Labreque" <fla### [at] videotron ca> wrote in message
news:3BC### [at] videotron ca...
>
>
> Mael wrote:
>
> > ok, thank you, it's clear.. we can't trust computers for maths :)
>
>
> Yes we can. As long as we remembers that computers do not have the same
> number of fingers to count on.
>
> --
> /*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
> /* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
> /* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
> /* videotron.ca */}camera{location<6,1.25,-6>look_at a orthographic}
>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Slime <noo### [at] hotmail com> wrote:
: Note that counting in integers will work fine
... as long as they are not too big.
Of course the integers you can handle accurately with a double type are
quite big (several thousands of millions...).
--
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}// - Warp -
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp wrote:
> (several thousands of millions...).
Now *there's* a phrase to cause anxiety in an American listening to an
international audience.
thousand=1E03
million = 1E06
thousand millions=1E09?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I had a discussion at work here about that once:
In the US:
million = 10^6
billion = 10^9 (thousand million)
In UK:
million = 10^6
billion = 10^12 (million million)
Read this article from the Straight Dope:
http://www.straightdope.com/mailbag/mgazilli.html
-tgq
"Greg M. Johnson" <"gregj56590[:-0]"@aol.com> wrote in message
news:3BC5AAE4.2D531AF1@aol.com...
> Warp wrote:
>
> > (several thousands of millions...).
>
> Now *there's* a phrase to cause anxiety in an American listening to an
> international audience.
>
> thousand=1E03
> million = 1E06
>
> thousand millions=1E09?
>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Greg M. Johnson <"gregj56590[:-0]"@aol.com> wrote:
:> (several thousands of millions...).
: Now *there's* a phrase to cause anxiety in an American listening to an
: international audience.
I know the 'billion' problem in the UK/US, so I deliberately used the
term "thousands of millions" instead. I don't know how good it sounds, but
I don't care; I don't want to cause confusion.
--
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}// - Warp -
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
and "thousand" is 10^3.
Trevor Quayle wrote:
> I had a discussion at work here about that once:
>
> In the US:
> million = 10^6
> billion = 10^9 (thousand million)
>
> In UK:
> million = 10^6
> billion = 10^12 (million million)
>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp wrote:
> term "thousands of millions" instead. I don't know how good it sounds, but
> I don't care; I don't want to cause confusion.
Is that 10^9?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Greg M. Johnson <"gregj56590[:-0]"@aol.com> wrote:
:> term "thousands of millions" instead. I don't know how good it sounds, but
:> I don't care; I don't want to cause confusion.
: Is that 10^9?
If you take a million one thousand times, how much do you get?-)
--
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}// - Warp -
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Mael" <mae### [at] hotmail com> wrote in message news:3bc43f4f@news.povray.org...
> isn t it strange to get a roundoff error for only 10 additions ? i thought
> pov was more precise :(
>
On that subject, a recent faq wot I wrote (corrections and/or criticisms happily
accepted - and please note the very long url)
http://www.ccl.com/cgi-bin/protonfaq.cgi?faq=itemconfigwhydowetalkofaccuracynots
izeforfloatingpointnumbers
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
10^9, unless outside the territorial United States, ha mon?
Warp wrote:
> If you take a million one thousand times, how much do you get?-)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Greg M. Johnson <"gregj56590[:-0]"@aol.com> wrote:
: 10^9, unless outside the territorial United States, ha mon?
Where "a thousand millions" is not 10^9?
--
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}// - Warp -
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp wrote:
> Greg M. Johnson <"gregj56590[:-0]"@aol.com> wrote:
> : 10^9, unless outside the territorial United States, ha mon?
>
> Where "a thousand millions" is not 10^9?
The vagueness of your reply in my attempt to nail down its meaning merely
underscores the barrier to technical communication in international audiences
from the use of either the terms "thousand" or "million". Americans won't
know what a non-American really means; I'm afraid I'll never know what you
mean...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> The vagueness of your reply in my attempt to nail down its meaning merely
> underscores the barrier to technical communication in international
audiences
> from the use of either the terms "thousand" or "million". Americans won't
> know what a non-American really means; I'm afraid I'll never know what you
> mean...
FYI, my dictionary gives two definitions of "billion" (the American 10^9 and
the British 10^12) but only one definition for "million" (10^6) and one
definition for "thousand" (10^3). So IMHO there can be no ambiguity in
saying thousand million.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
This is correct. 10^n is 10^n no matter where you are, it is a (as far as
we know) universal constant. The problem comes with terminology. A
"thousand" is the same in US/UK (10^3), so is a "million" (10^6) and,
therefore, so would a "thousand million" (10^3 x 10^6 = 10^9), but in the
US a "thousand million" is also known as a "billion" but not so in the UK,
it is still a "thousand million" (Or also a "milliard"). The UK reserve the
word "billion" to describe a "million million" (which is known as "trillion"
in the US). Also, a UK "trillion" is a "million million million" (quite
the mouthful) or 10^18 ("million"^3, "quadrillion" = "million"^4, etc.). All
in all, it is always better to use scientific notation so as to keep
confusion about such large numbers to a minimum when talking to an
international audience.
-tgq
"Anders K." <and### [at] f2s com> wrote in message
news:3bcae9df$1@news.povray.org...
> > The vagueness of your reply in my attempt to nail down its meaning
merely
> > underscores the barrier to technical communication in international
> audiences
> > from the use of either the terms "thousand" or "million". Americans
won't
> > know what a non-American really means; I'm afraid I'll never know what
you
> > mean...
>
> FYI, my dictionary gives two definitions of "billion" (the American 10^9
and
> the British 10^12) but only one definition for "million" (10^6) and one
> definition for "thousand" (10^3). So IMHO there can be no ambiguity in
> saying thousand million.
>
>
>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> This is correct. 10^n is 10^n no matter where you are, it is a (as far as
> we know) universal constant. The problem comes with terminology. [...]
What Warp said was "several thousands of millions". While Americans may have
another name for it, one thousand million is still 10^9. There is no other
way it can be interpreted.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Yes, that's right, but I think Greg's original point was that Americans tend
not to use the phrase "thousands of millions" but rather "billions" and
maybe wonder why Warp specified thousands of millions rather than just
saying billions even though they mean the same in American terms.
-tgq
"Anders K." <and### [at] f2s com> wrote in message
news:3bcaf586$1@news.povray.org...
> > This is correct. 10^n is 10^n no matter where you are, it is a (as far
as
> > we know) universal constant. The problem comes with terminology. [...]
>
> What Warp said was "several thousands of millions". While Americans may
have
> another name for it, one thousand million is still 10^9. There is no other
> way it can be interpreted.
>
>
>
>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Trevor Quayle wrote:
>
> This is correct. 10^n is 10^n no matter where you are, it is a (as far as
> we know) universal constant.
Well, this is true as long as everyone is working in the same base.
10^n (base 13) is not the same as 10^n (base 10), so 10^n may not be the
same everywhere. ;-)
Mike Andrews.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |