Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Akow, degenerate_762), 1,430 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Possible bug in Lite-C 7.80 - duplicating 'double's. [Re: jcl] #285274
08/17/09 21:58
08/17/09 21:58
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline OP
Expert
EvilSOB  Offline OP
Expert

Joined: Feb 2008
Posts: 3,232
Australia
JCL : Thanks again for help and explainations. The reasons I was going wrong was several-fold.

1> Like bunsen, I was not aware that literal constants get "truncated" to ONLY 'float' or 'int' types.

2> I was (also?) under the MISTAKEN belief that by putting a re-cast operator, like (double), at the
start of the expression would then 'crowbar' any contstants, or intermediate values/results,
into that type, and therefore that level of precision. I WAS WRONG..!! shocked!! See, it can happen wink

3> Thanks for your reply to MMike giving us the list of precisions IN DIGITS of the different types.
I could never "decrypt" the manual for that information. Any chance that info could be added/clarified
to the manual as one simple sentence in the "Variables" page? And maybe mention constants are only float or int?

4> As for 'diag_var' truncation down to 9 digits, I WAS already aware.

Again, many thanks for your patience and knowledge.


MMike : I think your "CONV:DOUBLE::DOUBLE" problem is that you are using the (double) like this,
double xyz = 12345;
double abc = (double)xyz;

You cant convert a double TO a double, cause it already is.
Whereas I was going from a constant to a double, which is OK.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Possible bug in Lite-C 7.80 - duplicating 'double's. [Re: jcl] #285461
08/18/09 16:56
08/18/09 16:56
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
Originally Posted By: jcl
MMike: floats have a maximum precision of about 6 digits, vars 9 digits, and doubles 14 digits.

There is no variable with 20 digits precision. Constants in the script are either floats or integers. When you get syntax errors, something's wrong with your version or your code.


JCL, i don't know if the problem is or not with the code? i just used the EvilSob code.. But does it work on your side??
im using Version 7.73 13-Mar-2009 (did not updated to 7.80 because in my case, the known bugs are not a problem at the moment, and i went to check and there are no bugs related to this this). Well i can update anyway, But first tell me if its a version problem or not.

Well,I tried to check the origin of the error..

This is EvilSob code:

Code:
function whatever()
{
   double  values[6];

   values[0] = (double)2.862738448796;
   values[1] = (double)-8.642801642417908;
   diag_var("p1 = %.9f x ", (double)values[0]);	diag_var("%.9f\n", (double)values[1]);
   diag_var("p2 = %.9f x ", (double)values[2]);	diag_var("%.9f\n", (double)values[3]);

   values[2] = (double)2.86270802130925;
   values[3] = (double)-8.642629981040955;
   diag_var("p1 = %.9f x ", (double)values[0]);	diag_var("%.9f\n", (double)values[1]);
   diag_var("p2 = %.9f x ", (double)values[2]);	diag_var("%.9f\n", (double)values[3]);
}



And Sed complains here:

double values[6];
values[0] = (double)2.862738448796;
saying cant convert Double::Double

after testing that .. i ended up that the error is because of this:

function whatever()
{double val=0; val = (double)350.9898789;}

function whatever() // removing the point ...
{double val=0; val = (double)3509898789;}

(see the number is huge now 35098(...) , not 350.98.. and because of that point.. it returns that error of double..

(Is this normal?)

If i change this to...

function whatever() //changing double to float
{double val=0; val = (float)350.9898789;}

it compiled just fine..
__________________________________________

Second thing is:

Ok one reason i never got aware of this limitation is because that table is confusing, at least for me.. because this is what i learn on school:

as the manual it says : range minimum
float 4 bytes -3.4e38 to 3.4e38 1.2e-38

I though this means 3.4 x 10 ^38 which means.. in scientific notations.
and typing on my university calculator.. 0.0000000(...38 zeros)34 , which is around 35 decimals.



Last edited by MMike; 08/19/09 11:50.
Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1