Created Tue, 01 May 2012 17:40:09 +0000 by alvesjc
Tue, 01 May 2012 17:40:09 +0000
Hi.
I'm an arduino user, and i need double precision floating point (64bit) for my project.
I'm thinking to move to chipkit since it is a 32bits platform and it should support this.
I've been able to see that mplab does support it my using "long double".
But, I'vent found any statement saying the same por MPIDE.
Is it supported in MPIDE also?
Thank you.
BR,
Joao
Wed, 02 May 2012 14:02:56 +0000
Hi again.
18 views and no answer, can someone help?
Thanks
Wed, 02 May 2012 16:39:02 +0000
A quick query program running on the chipKIT UNO32
chipKIT UNO32
Little Endian
Lo Byte '0xDEAD': AD
Hi Byte '0xDEAD': DE
Reporting size of 'intrinc' data types -
bool: 1
char: 1
short: 2
int: 4
long: 4
long long: 8
float: 4
double: 8
long double: 8
Pointer: 4
Reporting size of some 'Wiring' data types -
byte size: 1
word size: 4
Wed, 02 May 2012 21:25:49 +0000
Hi lloyddean.
Thank you very much for your time doing this.
I'm perfectly aware that this was probably the noobest question around, but I realy didn't know how to get there.
I'm re-learning c++, as it has all been gone a few years ago when ended school and never used it again.
I've re-learned a lot with arduino, and now I need to move in a better platform because I was stuck with some astronomical calcultaions with arduino giving lagging results.
From your table I can see that its 8 byte size, so I've my needed resolution.
I'll buy one of this and move my program there.
Once again, thank you very much for wasting your time with a noob like me. ;)
Wed, 02 May 2012 21:55:21 +0000
When I first quick read your question I figured you had a chipKIT device already and would soon be able to answer your own question. Then with todays post I realized my mistake!
Here's the sketch used to retrieve you information. It will also work on your Arduino boards.
EDIT: WHY DOES WORD WRAP HAPPEN HERE? COULD SOMEONE TURN IT OFF!!!
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
uint8_t lsb(uint16_t number) { return number & 0xFF; }
uint8_t msb(uint16_t number) { return number >> 8; }
void loop()
{}
void setup()
{
Serial.begin(9600);
// --- Identify Endian Ordering
short number = 0x0001L;
Serial.println((1 == ((char*)&number)[sizeof(number) - 1]) ? "Big Endian\n" : "Little Endian\n");
Serial.print("Lo Byte '0xDEAD': \t"); Serial.println(lowByte(0xDEAD), HEX);
Serial.print("Hi Byte '0xDEAD': \t"); Serial.println(highByte(0xDEAD), HEX);
// --- Report Size Of Data Types
Serial.println("\n\nReporting size of \'intrinc\' data types -");
Serial.print("\tbool: \t\t"); Serial.println(sizeof(bool));
Serial.print("\tchar: \t\t"); Serial.println(sizeof(char));
Serial.print("\tshort: \t\t"); Serial.println(sizeof(short));
Serial.print("\tint: \t\t"); Serial.println(sizeof(int));
Serial.print("\tlong: \t\t"); Serial.println(sizeof(long));
Serial.print("\tlong long: \t"); Serial.println(sizeof(long long));
Serial.print("\tfloat: \t\t"); Serial.println(sizeof(float));
Serial.print("\tdouble: \t"); Serial.println(sizeof(double));
Serial.print("\tlong double: \t"); Serial.println(sizeof(long double));
Serial.print("\tPointer: \t"); Serial.println(sizeof(void*));
Serial.println("\n\nReporting size of some \'Wiring\' data types -");
Serial.print("\tbyte size: \t"); Serial.println(sizeof(byte));
Serial.print("\tword size: \t"); Serial.println(sizeof(word));
Serial.end();
}
Wed, 02 May 2012 22:20:06 +0000
Ok, clear. :D
Thank you again.
I'll test that code to try to learn a bit more.
It messes with something that I'm lost a lot of times, pointers.... " Serial.println((1 == ((char*)&number)[sizeof(number) - 1]) ? "Big Endian\n" : "Little Endian\n"); "
I'll try to get to understanding on this statement, if not able to do so, I'll request help on this.
For now, I'll order my chipkit! ;)
BR,
Joao