Float wont print

Normal in C++ the print command can print a float but it seems that Arduino cant do that. Below the simple test sketch. Any idea or suggestions?

int      stepsPerRotation  = 200;          // 200 steps per rotation (1.8 degrees per step)
int      xGearRatio        =  42;          // stepper ratio per X degree of rotation (1:42)
int      xMicroSteps       =   2;          // Value of the microsteps
float    stepPerDeg        = 0.0;
int      stepsPerRev       =   0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(19200);                     // Start the Serial communication
  while (!Serial);
  stepsPerRev = xMicroSteps * stepsPerRotation;
  stepPerDeg = (stepsPerRev * xGearRatio) / 360;

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


Yep, try dtostrf().

Normal in C++ the print command

What's "normal" about a "print" command in C++?

println supports printing a float - what's the problem?

Does it print the expected 0.0?

When you need a floating point result but there's a mix of data types in the expressions, play it safe and add a decimal point. Try changing to this:

 stepPerDeg = (stepsPerRev * xGearRatio) / 360.0;   // Note the 360.0