Teensy 3.6 double precision

Status
Not open for further replies.

ted

Active member
I have project that requires high precision (up to 10 digits). Unfortunately my experiences is that the double type is only 32 bit not 64 bit on this board.
Can you please confirm?

My simple test code:
Code:
void setup() {
  Serial.begin(115200);
  delay(1000);
  double hi1 = 1.1234567890123;
  double hi2 = 0.0000000000001;
  double hi3 = hi1 - hi2;
  Serial.println(hi3, 20);
}

void loop() {}

Output from Arduino Due 64 bit double: 1.12345678901220002998
Output from Teensy 3.6 double: 1.123456835746665

Thanks
 
On Teensy, uou need to add "L" to those constants, like this:

Code:
void setup() {
  Serial.begin(115200);
  delay(1000);
  double hi1 = 1.1234567890123L;
  double hi2 = 0.0000000000001L;
  double hi3 = hi1 - hi2;
  Serial.println(hi3, 20);
}

void loop() {}
 
many thanks Paul!

On Teensy, uou need to add "L" to those constants, like this:

Code:
void setup() {
  Serial.begin(115200);
  delay(1000);
  double hi1 = 1.1234567890123L;
  double hi2 = 0.0000000000001L;
  double hi3 = hi1 - hi2;
  Serial.println(hi3, 20);
}

void loop() {}
 
On Teensy, uou need to add "L" to those constants, like this:

Code:
void setup() {
  Serial.begin(115200);
  delay(1000);
  double hi1 = 1.1234567890123L;
  double hi2 = 0.0000000000001L;
  double hi3 = hi1 - hi2;
  Serial.println(hi3, 20);
}

void loop() {}

Does Teensy 3.6 actually do dp floating-point arithmetic (e.g., multiplication/division) in hardware? Or is this stuff emulated somehow?
 
Status
Not open for further replies.
Back
Top