To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 1897
1896  |  1898
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: 
1422 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:
  Re: problem with floating point numbers (legOS 0.2.5)
 
(...) You are the second person to report something like this, so there must be something wrong somewhere. I will take a closer look at this when I get a chance. I am busy until Tuesday though. I know I will forget, so keep e-mailing me until I fix (...) (23 years ago, 26-May-01, to lugnet.robotics.rcx.legos)

7 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR