Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Adding an include to make the CS compile; uncertain the CS is valid, though

...

Code Block
bgColor#ccccff
langc
#include <float.h>
#include <math.h>
 
void func(double d_a, long double big_d) {
  double d_b;
  float f_a;
  float f_b;

  if (isgreater(d_a, FLT_MAX) || isless(d_a, FLT_MIN)) {
    /* Handle error */
  } else {
    f_a = (float)d_a;
  }
  if (isgreater(big_d, FLT_MAX) || isless(big_d, FLT_MIN)) {
    /* Handle error */
  } else {
    f_b = (float)big_d;
  }
  if (isgreater (big_d, DBL_MAX) || isless(big_d, DBL_MIN)) {
    /* Handle error */
  } else {
    d_b = (double)big_d;
  }  
}

...