0 registered members (),
833
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
OP
Senior Member
|
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: Rei_Ayanami]
#349458
12/07/10 20:05
12/07/10 20:05
|
Joined: Aug 2008
Posts: 408 mi usa
sadsack
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2008
Posts: 408
mi usa
|
I did and it still does not compile.
#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
Expert
|
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
OP
Senior Member
|
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
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2008
Posts: 408
mi usa
|
Ok I got it to compile here the 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
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
|
From the manual: !! #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
OP
Senior Member
|
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
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
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
OP
Senior Member
|
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
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|