Actions
Bug #524
closedmodf
Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
VM
Target version:
-
Start date:
05/31/2015
Due date:
% Done:
100%
Estimated time:
Description
This Scol function in the std lib is wrong (or its documentation is wrong).
mod returns the modulo between two integers. It's right.
modf should the same thing with two float numbers. It is incorrect.
More, the current source code of modf is :
(...) double x = MTOF(val0); double y = MTOF(val1); m->top[m->pp] = FTOM((float)(modf(x, &y)));
In C and C++, modf doesn't return a such "modulo" !
In the code above, y points to the integral part of x. In the top of the heap, it is its decimal part. So, the Scol modf returns only the decimal part of the first given float number.
The current state is this :
fun main ()= _showconsole; _fooId mod 390 360; // 30 _fooF modf 390.0 360.0; // 0.000000 0;;
Actions