Reply by Paul Curtis May 12, 20052005-05-12
Hi Fred,

Ahh, sorry.  Yes, 2**5 is indeed 32 which is 1<<5.

Anyway, the way to compute this in C is using pow, powf, or if you have
it ipow.

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors 

> -----Original Message-----
> From: Frederic Beaulieu [mailto:fbeaulieu@fbea...] 
> Sent: 12 May 2005 12:39
> To: msp430@msp4...
> Subject: RE: [msp430] BIG problems with math.h
> 
> Sorry but 2 to the power of 5 is 32 not 64 which are the same as
1<<5.
> Sorry Paul but I must take my revenge since I pay a little 
> bit more attention to these details now ;)
> 
> Fred
> 
> -------------------------------
> 
> Frederic Beaulieu, M.Sc.
> 
> Research and Development
> 
> NewTrax Technologies Inc.
> 
> http://www.newtraxtech.com/
> 
> 
> -----Original Message-----
> From: msp430@msp4... [mailto:msp430@msp4...] 
> On Behalf Of Paul Curtis
> Sent: Thursday, May 12, 2005 5:48 AM
> To: msp430@msp4...
> Subject: RE: [msp430] BIG problems with math.h
> 
> Hi, 
> 
> > I have few questions, may I ask?
> > 
> > >> Ahh, 2>>5 == 0.  That's not right.
> > how much will be here then?
> 
> 2 >> 5 is zero.
> 
> > >> But, 2^5 == 32 == 1 << 5.  That is right.  :-)
> > so, on mspgcc I can use sipmly 2^5 and the result will be 32?
> > why then 1 << 5 is 32 too? how is it?
> 
> 2^5 in C is (in fact) 7.  2 to the power of 5 is 64.  That's 
> the same as
> 1 << 6.
> 
> Perhaps this is not the list for you.  Get a good book on C.
> 
> --
> Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk 
> CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005
>  
> 
> -- 
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.9 - Release Date: 5/12/2005
>  
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 

Beginning Microcontrollers with the MSP430

Reply by Frederic Beaulieu May 12, 20052005-05-12
Sorry but 2 to the power of 5 is 32 not 64 which are the same as
1<<5.
Sorry Paul but I must take my revenge since I pay a little bit more
attention to these details now ;)

Fred

-------------------------------

Frederic Beaulieu, M.Sc.

Research and Development

NewTrax Technologies Inc.

http://www.newtraxtech.com/


-----Original Message-----
From: msp430@msp4... [mailto:msp430@msp4...] On Behalf
Of Paul Curtis
Sent: Thursday, May 12, 2005 5:48 AM
To: msp430@msp4...
Subject: RE: [msp430] BIG problems with math.h

Hi, 

> I have few questions, may I ask?
> 
> >> Ahh, 2>>5 == 0.  That's not right.
> how much will be here then?

2 >> 5 is zero.

> >> But, 2^5 == 32 == 1 << 5.  That is
right.  :-)
> so, on mspgcc I can use sipmly 2^5 and the result will be 32?
> why then 1 << 5 is 32 too? how is it?

2^5 in C is (in fact) 7.  2 to the power of 5 is 64.  That's the same as
1 << 6.

Perhaps this is not the list for you.  Get a good book on C.

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors


.

 
Yahoo! Groups Links



 



-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005
 

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.9 - Release Date: 5/12/2005
 


Reply by HEX.loader May 12, 20052005-05-12
hi,


I have few questions, may I ask?

>> Ahh, 2>>5 == 0.  That's not right.
how much will be here then?


>> But, 2^5 == 32 == 1 << 5.  That is
right.  :-)
so, on mspgcc I can use sipmly 2^5 and the result will be 32?
why then 1 << 5 is 32 too? how is it?


> Looks like in the latest mspgcc distribution you
can get something
> linked like this:
> 
> msp430-gcc foo.c -Wl,-mmsp430x1611 -lm -lfp
> 
> So, if foo.c uses sin() then it all gets linked up hunkey dorey.
> 
> If, however, you need 64-bit doubles for sin() then it looks like
you're
> out of luck.

I have the latest mspgcc version. in dev-cpp I've added -lm but its
still dont work. You have said smth about fdlibm, how to implement it?
will it help? How to link math.h? Im noobie, so don't know all of
these specific things.


One more thing. I have a Taylor line, it counts smth and then I get a
number which i need to send to DAC (convert to voltage), so I
understand, that I need decimal number convert to hex, right? How can
I make it by writing my own function or mspgcc have own?


ps. im using F169.

Reply by Paul Curtis May 12, 20052005-05-12
Hi, 

> I have few questions, may I ask?
> 
> >> Ahh, 2>>5 == 0.  That's not right.
> how much will be here then?

2 >> 5 is zero.

> >> But, 2^5 == 32 == 1 << 5.  That is
right.  :-)
> so, on mspgcc I can use sipmly 2^5 and the result will be 32?
> why then 1 << 5 is 32 too? how is it?

2^5 in C is (in fact) 7.  2 to the power of 5 is 64.  That's the same as
1 << 6.

Perhaps this is not the list for you.  Get a good book on C.

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors

Reply by May 11, 20052005-05-11
Hi,

> Ahh, 2>>5 == 0.  That's not right.
> 
> Umm, 2 << 5 = 2*2^5 = 2^6 = 64.  That's not right either.

what's wrong with these?
I can find no error. In ANSI-C they are both right.

Regards,

Rolf





Reply by Paul Curtis May 11, 20052005-05-11
The error was with the ORIGINAL posting which stated that 2^5 is the
same as 2 >> 5.  It's not.  And neither is 2<<5.  QED.

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors

> -----Original Message-----
> From: rolf.freitag@rolf... [mailto:rolf.freitag@rolf...] 
> Sent: 11 May 2005 15:16
> To: msp430@msp4...
> Subject: RE: [msp430] BIG problems with math.h
> 
> Hi,
> 
> > Ahh, 2>>5 == 0.  That's not right.
> > 
> > Umm, 2 << 5 = 2*2^5 = 2^6 = 64.  That's not right either.
> 
> what's wrong with these?
> I can find no error. In ANSI-C they are both right.
> 
> Regards,
> 
> Rolf
> 
> 
> 
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 

Reply by Paul Curtis May 11, 20052005-05-11
Looks like in the latest mspgcc distribution you can get something
linked like this:

msp430-gcc foo.c -Wl,-mmsp430x1611 -lm -lfp 

So, if foo.c uses sin() then it all gets linked up hunkey dorey.

If, however, you need 64-bit doubles for sin() then it looks like you're
out of luck.

Regards,

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors

> -----Original Message-----
> From: HEX.loader [mailto:hexloader@hexl...] 
> Sent: 11 May 2005 12:23
> To: msp430@msp4...
> Subject: [msp430] BIG problems with math.h
> 
> hello
> 
> I need to make such a move: 2 ^ 5, so, I write pow (2,5) and 
> I get this error: "[Linker error] undefined reference to `pow'
".
> why?
> I tried other compilers and all was ok, but on mspgcc I dont work.
> All paths are ok, ie when i write pow (2), then compiler says:
>  "too few arguments to function `pow' ", so I can say then, 
> that compiler had found math.h, coz he know what a function 
> it is, but why it dont work pow (2,5) ???
> in my math.h it is:
> 
> #ifndef _REENT_ONLY
> #ifndef __math_6881
> extern double acos _PARAMS((double));
> extern double asin _PARAMS((double));
> extern double atan2 _PARAMS((double, double)); extern double 
> cosh _PARAMS((double)); extern double sinh _PARAMS((double)); 
> extern double exp _PARAMS((double)); extern double ldexp 
> _PARAMS((double, int)); extern double log _PARAMS((double)); 
> extern double log10 _PARAMS((double)); extern double pow 
> _PARAMS((double, double)); extern double sqrt 
> _PARAMS((double)); extern double fmod _PARAMS((double, 
> double)); #endif /* ! defined (__math_68881) */ #endif /* ! 
> defined (_REENT_ONLY) */
> 
> Now I have my own pow function, but its very important to me, 
> coz I'll need soon sqrt and tan functions but all has the same syntax.
> 
> anyone...help me!
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 

Reply by Frederic Beaulieu May 11, 20052005-05-11
You're right! I never pay attention these details.
Sorry Hex

-------------------------------

Frederic Beaulieu, M.Sc.

Research and Development

NewTrax Technologies Inc.

http://www.newtraxtech.com/


-----Original Message-----
From: msp430@msp4... [mailto:msp430@msp4...] On Behalf
Of Paul Curtis
Sent: Wednesday, May 11, 2005 8:33 AM
To: msp430@msp4...
Subject: RE: [msp430] BIG problems with math.h

Fred, 

> -----Original Message-----
> From: Frederic Beaulieu [mailto:fbeaulieu@fbea...] 
> Sent: 11 May 2005 12:33
> To: msp430@msp4...
> Subject: RE: [msp430] BIG problems with math.h
> 
> You are still at the wrong place to ask this question!
> To do 2^5, you don't need the pow function, only to write
"2>>5" ...
> To have acces to math.h, you just need to add the -lm option 
> in your compilation option.

Ahh, 2>>5 == 0.  That's not right.

Umm, 2 << 5 = 2*2^5 = 2^6 = 64.  That's not right either.

But, 2^5 == 32 == 1 << 5.  That is right.  :-)

Regards,

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors


.

 
Yahoo! Groups Links



 



-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005
 

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005
 


Reply by Leon Heller May 11, 20052005-05-11
----- Original Message ----- 
From: "HEX.loader" <hexloader@hexl...>
To: <msp430@msp4...>
Sent: Wednesday, May 11, 2005 1:22 PM
Subject: [msp430] BIG problems with math.h


> hello
>
> I need to make such a move: 2 ^ 5, so, I write pow (2,5) and
> I get this error: "[Linker error] undefined reference to `pow'
".
> why?

Have you got '-lm' at the end of your command line? libm.a won't
get linked 
otherwise.


Leon
--
Leon Heller
http://webspace.webring.com/people/jl/leon_heller/ 



Reply by HEX.loader May 11, 20052005-05-11
On 5/11/05, Paul Curtis <plc@plc@...> wrote:
> Perhaps libm isn't available for MSPGCC?
> 

but its funny, its simple mathematical move, why it cant be available?
and if its so, why then in mspgcc include dir I have math.h with all
its functions, macros and so on, what for, if its unavailable?
and it cannot be true, coz I dont believe that mspgcc dont support
sqrt, tan and other mathematical operands.


ehhh... I need these functions so much.