The sign of integral part given by the modf() should be same as sign of input.
But for inputs between 0 and 1, the sign of integral part was not same as sign of input.
Signed-off-by: Lokesh B V <lokesh.bv@partner.samsung.com>
/****************************************************************************
*
- * Copyright 2016 Samsung Electronics All Rights Reserved.
+ * Copyright 2016-2017 Samsung Electronics All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*iptr = x;
return 0.0;
} else if (fabs(x) < 1.0) {
- *iptr = 0.0;
+ *iptr = (x * 0.0);
return x;
} else {
*iptr = (double)(int64_t)x;
/****************************************************************************
*
- * Copyright 2016 Samsung Electronics All Rights Reserved.
+ * Copyright 2016-2017 Samsung Electronics All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*iptr = x;
return 0.0;
} else if (fabs(x) < 1.0) {
- *iptr = 0.0;
+ *iptr = (x * 0.0);
return x;
} else {
*iptr = (float)(int)x;
/****************************************************************************
*
- * Copyright 2016 Samsung Electronics All Rights Reserved.
+ * Copyright 2016-2017 Samsung Electronics All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*iptr = x;
return 0.0;
} else if (fabs(x) < 1.0) {
- *iptr = 0.0;
+ *iptr = (x * 0.0);
return x;
} else {
*iptr = (long double)(int64_t)x;