type conversion

I developed my initial code in MS Visual Studio 2019 and using std::stof() works very well. In another forum a couple of those ‘Smartest Guy in the Room’ characters are telling me that the Arduino UNO processor is not suitable for processing single precision numbers. I have loaded the sketch but it will be a while before I will be able to see it in action. There is some basic math involved and I prefer to work with 6 places after the decimal point. Am I headed for a disappointment or are those two characters full of themselves?

Thanks,
Ron

Depends on your hardware, you may not have access to stl libraries.

Arduino boards are capable of handling single precision float.

OldRon:
...I prefer to work with 6 places after the decimal point.

Any Arduino is quite capable of working with single-precision floating point numbers, but that does not necessarily mean you will achieve six significant digits right of the decimal point. You have a grand total of ~6-1/2 MAXIMUM significant digits on EACH calculation. But any given calculation can easily lose one or more digits, depending on the numbers being used, and the exact operation being performed. Your exact sequence of operations, and the potential dynamic range of each variable needs to be carefully analyzed to achieve the best possible result.

Regards,
Ray L.

OldRon:
...using std::stof()...

dtostrf is a better choice for an AVR processor.

OldRon:
Am I headed for a disappointment or are those two characters full of themselves?

The latter.

Ask them what part of the IEEE 754 standard for 32 bit floating point arithmetic is not implemented on an AVR Arduino. The correct answer is "none".

Gentlemen,

Thank you for taking time to respond.

Coding Badly, I'm converting a string value to a real number. Isn't dtostrf a display function?

Ron

OldRon:
Gentlemen,

Thank you for taking time to respond.

Coding Badly, I’m converting a string value to a real number. Isn’t dtostrf a display function?

Ron

He probably meant atof.

Aye.

Hey Guys,

I borrowed a display and my sketch was good to go (to a point). The Arduino UNO crunches the numbers and prints the result on the display before my finger has cleared the key. So, the two ‘Smartest Guy in the Room’ were full of ##IT. I encountered people on the Fakebook group that told me the same about the limitations.

I noticed that the steps for 12.75º was 32640 and for 13º was 33280. The variable steps is declared as a float and I initially declared i as an integer so I was up against 32768. The variable i can be a float if the index increment is a factional value so I changed the declaration to float and my project likes it.

for (float i = 0; i < steps; i++)  
{
    digitalWrite(step, HIGH);
    delayMicroseconds(dwell);
    digitalWrite(step, LOW);
    delayMicroseconds(dwell);
}