mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 17:28:23 +00:00
vim-patch:8.0.0614
Problem: float2nr() is not exactly right.
Solution: Make float2nr() more accurate. Turn test64 into a new style test.
(Hirohito Higashi, closes vim/vim#1688)
863e80b445
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <float.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
@@ -8562,9 +8563,9 @@ static void f_float2nr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
float_T f;
|
||||
|
||||
if (tv_get_float_chk(argvars, &f)) {
|
||||
if (f < -VARNUMBER_MAX) {
|
||||
if (f <= -VARNUMBER_MAX + DBL_EPSILON) {
|
||||
rettv->vval.v_number = -VARNUMBER_MAX;
|
||||
} else if (f > VARNUMBER_MAX) {
|
||||
} else if (f >= VARNUMBER_MAX - DBL_EPSILON) {
|
||||
rettv->vval.v_number = VARNUMBER_MAX;
|
||||
} else {
|
||||
rettv->vval.v_number = (varnumber_T)f;
|
||||
|
Reference in New Issue
Block a user