|
From: Scott <fre...@ve...> - 2005-06-27 12:19:34
|
>I'm not sure how abs() would help.. unless that's to ensure that the
>original value is positive before multiplying by negative one?
>-Lukas
This is still not working right,
Iv'e been scratching my head on this all day..
I'm trying to get the value of 128.5
But instead all the mentioned formula's are giving me 129...
What i'm trying to express is this..
(2^8+1)/ 2 = 128.5
So in C/C++ it should be pow(2,8)/2+1 (However it returns 129)
Here is a quick test....
----------------------------------------------------------
#include <stdio.h>
#include <math.h>
void main()
{
double test;
test=pow(2,8)/2+1; //figure 2 to the eighth power +1
printf("The number is %0.0f \n",test);
system("PAUSE");
return 0;
}
-----------------------------------------------------------
#include <stdio.h>
#include <math.h>
void main()
{
float test;
test=((2^8+1) / 2); //figure 2 to the eighth power +1
printf("The number is %0.0f \n",test);
system("PAUSE");
return 0;
}
-------------------------------------------------------------
Here is a quick snippett from the actual source code i'm using to position
points.
sprintf( cmd, "MAKEBOX <%g %g %g> <%g %g %f> <%d %d %d>",
-128.5, -0.0, -128.5, pow(2,8)/2+1, 0.0, pow(2,8)/2+1, 1, 1, 1 );
local->evaluate( local->data, cmd );
Both suffer from the returning the same 129 figure....
I must be missing something stupid... (i'll try again in the morning)
Thanks for the help guys..
Cheers,
Scott.
|