ecma_date_make_day (ecma_number_t year, /**< year value */
                    ecma_number_t month, /**< month value */
                    ecma_number_t date) /**< date value */
{
  /* 1. */
  if (!ecma_number_is_finite (year)
      || !ecma_number_is_finite (month)
      || !ecma_number_is_finite (date)
      || fabs (year) > INT32_MAX)
  {
    return ecma_number_make_nan ();
  }

  /* 2., 3., 4. */
  int32_t y = (int32_t) (year);
  ecma_number_t m = ecma_number_trunc (month);
  ecma_number_t dt = ecma_number_trunc (date);

  /* 5. */
  int32_t ym = y + (int32_t) (floor (m / 12));

  /* 6. */
  int32_t mn = (int32_t) fmod (m, 12);

  if (mn < 0)
  {
    mn += 12;
  }

  /* 7. */
  ecma_number_t days = (ecma_date_day_from_year (ym)
                        + first_day_in_month[ecma_date_in_leap_year (ym)][mn]
                        + (dt - 1));
  return days * ECMA_DATE_MS_PER_DAY;
} /* ecma_date_make_day */
ecma_date_make_day (ecma_number_t year,  
                    ecma_number_t month,  
                    ecma_number_t date)  
{
   
  if (!ecma_number_is_finite (year)
      || !ecma_number_is_finite (month)
      || !ecma_number_is_finite (date)
      || fabs (year) > INT32_MAX)
  {
    return ecma_number_make_nan ();
  }

   
  int32_t y = (int32_t) (year);
  ecma_number_t m = ecma_number_trunc (month);
  ecma_number_t dt = ecma_number_trunc (date);

   
  int32_t ym = y + (int32_t) (floor (m / 12));

   
  int32_t mn = (int32_t) fmod (m, 12);

  if (mn < 0)
  {
    mn += 12;
  }

   
  ecma_number_t days = (ecma_date_day_from_year (ym)
                        + first_day_in_month[ecma_date_in_leap_year (ym)][mn]
                        + (dt - 1));
  return days * ECMA_DATE_MS_PER_DAY;
}  