I create a double n=3.33333 how do I have that printed out on the serial port?
I have a maple r5 running linux 64 bit ubuntu
I am fallowing the tutorial http://people.revoledu.com/kardi/tutorial/LDA/index.html
and used the manga guide to linear algebra to figure parts out.
I create a double n=3.33333 how do I have that printed out on the serial port?
(9 posts) (3 voices)-
Posted 3 years ago #
-
@josheeg,
Please read the Guidelines for Posting. For example "use a short, descriptive title" and "the version of Maple IDE (e.g. "0.0.11") you are using".
If you describe what you have tried doing it would help.
You mentioned the tutorial, but you did not say what worked and what did not work.
A short piece of code or a pastbin link would be helpful.
Rather than invoking "Linear Discriminant Analysis" can you phrase your question in a simpler way? It is not clear to me what you asking and mentioning LDA and linear algebra does not help me interpret your question.
For example, are you trying to print to a physical printer, printing to a file, printing to a terminal window, etc.?
Posted 3 years ago # -
@josheeg - Have you taken mbolivar's advice?
http://forums.leaflabs.com/topic.php?id=1979#post-11457Posted 3 years ago # -
I learned some linear algebra from the manga guide to linear algebra and used the excel spread sheet tutorial sample data to guide me through it. So I was able to do that example on paper with a simple hand calculator the ones without all the functions.
I have had the maple print to the terminal in linux Hello World.
Now I am trying to print a floating point doulble.
The number is 33.33333.
I get back 33.33 or 33.34 or something like that.
I looked in the documentation here:
http://leaflabs.com/docs/lang/api/serialusb.html#lang-serialusb
It said this "USBSerial::print(double n)Print n, accurate to 2 digits after the decimal point.
"how do I get it to print more after the decimal point?
Posted 3 years ago # -
The version of my maple ide is around "maple-ide-0.0.9-linux64.tgz" because I installed 64 bit ubuntu on my laptop and all sort of errors happen trying to get a new one and windows 7 on the other boot.
Posted 3 years ago # -
josheeg - have a look in the file "Print.cpp".
In my distribution, the function to print a double has the prototype:void Print::print(double n, int digits)
so if you have that version in your installation, try supplying a second parameter to set the number of digits.
Posted 3 years ago # -
A second parameter? I looked where double was defined and still do not know what to modify to make it print further than 2 digits past the decimal.
Posted 3 years ago # -
josheeg - have you looked in your distribution to find the file "Print.cpp"?
Does that contain this code:
void Print::print(double n, int digits) { printFloat(n, digits); }
If it does, then HardwareSerial has a version of
print
which takes two parameters.
The first parameter is the double to be printed.
The second parameter is the number of digits after the decimal point, so set this value to be the number of decimal places you want to print.Posted 3 years ago # -
It worked I did that.
example.
void setup() {}
void loop() {
SerialUSB.println("Hello World!");
ufsum=12.04l;
SerialUSB.println(ufsum,5);
}Posted 3 years ago #
Reply
You must log in to post.