Browse Source

Fixed comparison of float values to NaN

Max Matveev 8 years ago
parent
commit
2031fb913b
1 changed files with 7 additions and 7 deletions
  1. 7
    7
      Marlin/Marlin_main.cpp

+ 7
- 7
Marlin/Marlin_main.cpp View File

2400
       for (uint8_t x = 0; x < sx; x++) {
2400
       for (uint8_t x = 0; x < sx; x++) {
2401
         SERIAL_PROTOCOLCHAR(' ');
2401
         SERIAL_PROTOCOLCHAR(' ');
2402
         const float offset = fn(x, y);
2402
         const float offset = fn(x, y);
2403
-        if (offset != NAN) {
2403
+        if (!isnan(offset)) {
2404
           if (offset >= 0) SERIAL_PROTOCOLCHAR('+');
2404
           if (offset >= 0) SERIAL_PROTOCOLCHAR('+');
2405
           SERIAL_PROTOCOL_F(offset, precision);
2405
           SERIAL_PROTOCOL_F(offset, precision);
2406
         }
2406
         }
2452
         SERIAL_CHAR(']');
2452
         SERIAL_CHAR(']');
2453
       }
2453
       }
2454
     #endif
2454
     #endif
2455
-    if (bed_level_grid[x][y] != NAN) {
2455
+    if (!isnan(bed_level_grid[x][y])) {
2456
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2456
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2457
         if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM(" (done)");
2457
         if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM(" (done)");
2458
       #endif
2458
       #endif
2466
           c1 = bed_level_grid[x + xdir][y + ydir], c2 = bed_level_grid[x + xdir * 2][y + ydir * 2];
2466
           c1 = bed_level_grid[x + xdir][y + ydir], c2 = bed_level_grid[x + xdir * 2][y + ydir * 2];
2467
 
2467
 
2468
     // Treat far unprobed points as zero, near as equal to far
2468
     // Treat far unprobed points as zero, near as equal to far
2469
-    if (a2 == NAN) a2 = 0.0; if (a1 == NAN) a1 = a2;
2470
-    if (b2 == NAN) b2 = 0.0; if (b1 == NAN) b1 = b2;
2471
-    if (c2 == NAN) c2 = 0.0; if (c1 == NAN) c1 = c2;
2469
+    if (isnan(a2)) a2 = 0.0; if (isnan(a1)) a1 = a2;
2470
+    if (isnan(b2)) b2 = 0.0; if (isnan(b1)) b1 = b2;
2471
+    if (isnan(c2)) c2 = 0.0; if (isnan(c1)) c1 = c2;
2472
 
2472
 
2473
     const float a = 2 * a1 - a2, b = 2 * b1 - b2, c = 2 * c1 - c2;
2473
     const float a = 2 * a1 - a2, b = 2 * b1 - b2, c = 2 * c1 - c2;
2474
 
2474
 
4498
 
4498
 
4499
             measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
4499
             measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
4500
 
4500
 
4501
-            if (measured_z == NAN) {
4501
+            if (isnan(measured_z)) {
4502
               planner.abl_enabled = abl_should_enable;
4502
               planner.abl_enabled = abl_should_enable;
4503
               return;
4503
               return;
4504
             }
4504
             }
4534
           measured_z = points[i].z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
4534
           measured_z = points[i].z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
4535
         }
4535
         }
4536
 
4536
 
4537
-        if (measured_z == NAN) {
4537
+        if (isnan(measured_z)) {
4538
           planner.abl_enabled = abl_should_enable;
4538
           planner.abl_enabled = abl_should_enable;
4539
           return;
4539
           return;
4540
         }
4540
         }

Loading…
Cancel
Save