Subject:
|
problem with floating point numbers (legOS 0.2.5)
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Fri, 25 May 2001 08:18:14 GMT
|
Viewed:
|
1578 times
|
| |
| |
Hi
Here are two programs I've compiled and downloaded into my RCX. The first one
works fine whereas the second doesn't (no music). Since the only difference
between them is the type of the variable "number", I'm worrying about the
ability of the system RCX/LegOS to handle floating point numbers.
My system :
legOS 0.2.5
Red Hat Linux 7.1 on an i686
Can anyone help ?
Thanks.
This works fine :-)
-----------------------------------------------------------
#include <stdlib.h>
#include <unistd.h>
#include <lnp.h>
#include <conio.h>
#include <dsound.h>
static const note_t robots[] = {
{ PITCH_D4, 2 } , { PITCH_C4, 1 } , { PITCH_D4, 1 },
{ PITCH_F4, 1 } , { PITCH_D4, 1 } , { PITCH_D4, 2 },
{ PITCH_F4, 2 } , { PITCH_G4, 1 } , { PITCH_C5, 1 },
{ PITCH_A4, 2 } , { PITCH_D4, 2 } , { PITCH_END, 0 }
};
int main() {
int number = 3;
if(number > 0)
{dsound_play(robots);
wait_event(dsound_finished,0);
}
return 0;
}
-----------------------------------------------------------
This doesn't work :-(
-----------------------------------------------------------
#include <stdlib.h>
#include <unistd.h>
#include <lnp.h>
#include <conio.h>
#include <dsound.h>
static const note_t robots[] = {
{ PITCH_D4, 2 } , { PITCH_C4, 1 } , { PITCH_D4, 1 },
{ PITCH_F4, 1 } , { PITCH_D4, 1 } , { PITCH_D4, 2 },
{ PITCH_F4, 2 } , { PITCH_G4, 1 } , { PITCH_C5, 1 },
{ PITCH_A4, 2 } , { PITCH_D4, 2 } , { PITCH_END, 0 }
};
int main() {
float number = 3.0;
if(number > 0)
{dsound_play(robots);
wait_event(dsound_finished,0);
}
return 0;
}
-----------------------------------------------------------
|
|
Message has 1 Reply:
7 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|