Skip to content

Serial Print Float / Double #112

Closed
Closed
@oclyke

Description

@oclyke

Subject of the issue

Serial print functions cause a hard fault when handling float/double precision variables.

Your workbench

Steps to reproduce

void setup() {
  Serial.begin(9600);

  Serial.println("Float / Double print failure");
  delay(100); // allow banner to print before crash

  Serial.println(10); // print(int) works

  Serial.println(1000.0/960); // print(float/double) crashes into a HardFault

  Serial.println("I should be displayed but instead there is a crash");
}

void loop() {
  // put your main code here, to run repeatedly:

}

Expected behaviour

Serial output should read:

Float / Double print failure
10
1.04
I should be displayed but instead there is a crash

Actual behaviour

Serial output actually shows:

Float / Double print failure
10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions