Gamestudio Links
Zorro Links
Newest Posts
Lapsa's very own thread
by Lapsa. 06/26/24 12:45
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 869 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: how do I get the square root of a number? [Re: Rei_Ayanami] #349450
12/07/10 19:09
12/07/10 19:09
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Yes I know when i seen that I made the change to LC. It still will not compile,
I need to make it compile befor I can work on getting to work right.


I have A7 Commercial .............. Now I just need to learn how to use it

Re: how do I get the square root of a number? [Re: sadsack] #349453
12/07/10 19:28
12/07/10 19:28
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
WTF?

I tried to compile it, and I just needed to change the L to l and the C to c...

Re: how do I get the square root of a number? [Re: Rei_Ayanami] #349458
12/07/10 20:05
12/07/10 20:05
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
I did and it still does not compile.



Code:
#include <acknex.h>
#include <default.c>
#include <cmath>

#define PI 3.14159;

double f = 0;

double L = .00000012;
double C = .0000000000020;
/////////////////////////////////////////////////////////////////////

PANEL* panDisplay =
{
	digits(35, 10, "f = %0.f", *, 1,f);

	digits(35, 28, "L = %0.f", *, 1, L);
	digits(35, 38, "C = %0.f", *, 1, C);
	flags = SHOW;
}

/////////////////////////////////////////////////////////////////////

function main()
{
  screen_size.x = 800;
  screen_size.y = 600;
	screen_color.blue = 150; // and make its background dark blue
	while (1)
	{
		f = 1/ 2*PI*sqrt(L*C);
         
         wait (1);
   }
}




I can't find anything wrong with it, it should compile.

Last edited by sadsack; 12/07/10 20:07.

I have A7 Commercial .............. Now I just need to learn how to use it

Re: how do I get the square root of a number? [Re: sadsack] #349459
12/07/10 20:08
12/07/10 20:08
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
what the heck is cmath?

And why you put a ";" after the pi definitioN?

Last edited by Rei_Ayanami; 12/07/10 20:10.
Re: how do I get the square root of a number? [Re: Rei_Ayanami] #349468
12/07/10 21:45
12/07/10 21:45
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
having ";" or not having makes it compile. I can see no one so far know why it does not compile.


I have A7 Commercial .............. Now I just need to learn how to use it

Re: how do I get the square root of a number? [Re: sadsack] #349470
12/07/10 22:07
12/07/10 22:07
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Ok I got it to compile here the code:


Code:
////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>

#define PI 3.14159

double f = 0;
double L = .00000012;
double C = .000000000020;

/////////////////////////////////////////////////////////////////////

PANEL* panDisplay =
{
	digits(35, 10, "f = %0.f", *, 1, f);
	digits(35, 19, "L = %0.f", *, 1, L);
	digits(35, 28, "C = %0.f", *, 1, C);
	flags = SHOW;
}

/////////////////////////////////////////////////////////////////////

function main()
{
  screen_size.x = 800;
  screen_size.y = 600;
	screen_color.blue = 150; // and make its background dark blue
	while (1)
	{
		f = 1 / 2*PI * sqrt(C*L) ;
		wait (1);
	}
}



But I still get 0 for L C f.


I have A7 Commercial .............. Now I just need to learn how to use it

Re: how do I get the square root of a number? [Re: sadsack] #349471
12/07/10 22:14
12/07/10 22:14
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
From the manual:
Quote:
!! #define lines normally don't end with a semicolon, unless you want value to end with a semicolon for some reason. Some PRAGMA defines (see below) require a semicolon for ending a text string.


this means that '#define PI 3.14;' includes the semicolon within the equation in which you use PI, so the compiler reads the semicolon in the middle of the equation, where it 'cuts' the equation into two pieces - which are getting almost always senseless this way.

Re: how do I get the square root of a number? [Re: Pappenheimer] #349474
12/07/10 22:32
12/07/10 22:32
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Here is the formual for finding the frq of a tuned tank




I don't know If I am puting the formual in the code right.

Thank You Pappenheimer


I have A7 Commercial .............. Now I just need to learn how to use it

Re: how do I get the square root of a number? [Re: sadsack] #349475
12/07/10 22:40
12/07/10 22:40
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Quote:
I don't know If I am puting the formual in the code right.

No, sorry. Your square root multiplies with the numerator.
Write instead:

f = 1 / (2*PI * sqrt(C*L));


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: how do I get the square root of a number? [Re: Superku] #349481
12/08/10 00:13
12/08/10 00:13
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Thank you superku it works not I must test it it come up with the right numbers.
renny


I have A7 Commercial .............. Now I just need to learn how to use it

Page 2 of 2 1 2

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