mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 04:28:20 +00:00
GH-1860: Add double_to_int() bif
This commit is contained in:
parent
f2b74d21f7
commit
7de9a7d76f
3 changed files with 29 additions and 0 deletions
13
src/zeek.bif
13
src/zeek.bif
|
@ -2422,6 +2422,19 @@ function int_to_count%(n: int%): count
|
|||
## d: The :zeek:type:`double` to convert.
|
||||
##
|
||||
## Returns: The :zeek:type:`double` *d* as unsigned integer, or 0 if *d* < 0.0.
|
||||
## The value returned follows typical rounding rules, as implemented
|
||||
## by rint().
|
||||
function double_to_int%(d: double%): count
|
||||
%{
|
||||
return zeek::val_mgr->Int(bro_int_t(rint(d)));
|
||||
%}
|
||||
|
||||
## Converts a :zeek:type:`double` to a :zeek:type:`int`.
|
||||
##
|
||||
## d: The :zeek:type:`double` to convert.
|
||||
##
|
||||
## Returns: The :zeek:type:`double` *d* as signed integer. The value returned
|
||||
## follows typical rounding rules, as implemented by rint().
|
||||
##
|
||||
## .. zeek:see:: double_to_time
|
||||
function double_to_count%(d: double%): count
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue