MCPcopy Create free account
hub / github.com/MarlinFirmware/Marlin / value_float

Method value_float

Marlin/src/gcode/parser.h:257–272  ·  view source on GitHub ↗

Float removes 'E' to prevent scientific notation interpretation

Source from the content-addressed store, hash-verified

255
256 // Float removes 'E' to prevent scientific notation interpretation
257 static float value_float() {
258 if (!value_ptr) return 0;
259 char *e = value_ptr;
260 for (;;) {
261 const char c = *e;
262 if (c == '\0' || c == ' ') break;
263 if (c == 'E' || c == 'e' || c == 'X' || c == 'x') {
264 *e = '\0';
265 const float ret = strtof(value_ptr, nullptr);
266 *e = c;
267 return ret;
268 }
269 ++e;
270 }
271 return strtof(value_ptr, nullptr);
272 }
273
274 // Code value as a long or ulong
275 static int32_t value_long() { return value_ptr ? strtol(value_ptr, nullptr, 10) : 0L; }

Callers 15

autotemp_M104_M109Method · 0.80
M306Method · 0.80
M3_M4Method · 0.80
M206Method · 0.80
G33Method · 0.80
M425Method · 0.80
M665Method · 0.80
M423Method · 0.80
M851Method · 0.80
M951Method · 0.80
M73Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected