tor  0.4.1.0-alpha-dev
Functions
fp.h File Reference
#include "lib/cc/compat_compiler.h"
#include "lib/cc/torint.h"

Go to the source code of this file.

Functions

double tor_mathlog (double d) ATTR_CONST
 
long tor_lround (double d) ATTR_CONST
 
int64_t tor_llround (double d) ATTR_CONST
 
int64_t clamp_double_to_int64 (double number)
 
int tor_isinf (double x)
 

Detailed Description

Header for fp.c.

Definition in file fp.h.

Function Documentation

◆ clamp_double_to_int64()

int64_t clamp_double_to_int64 ( double  number)

Cast a given double value to a int64_t. Return 0 if number is NaN. Returns either INT64_MIN or INT64_MAX if number is outside of the int64_t range.

Definition at line 61 of file fp.c.

Referenced by sample_laplace_distribution().

◆ tor_llround()

int64_t tor_llround ( double  d)

Return the 64-bit integer closest to d. We define this wrapper here so that not all users of math.h need to use the right incantations to get the c99 functions.

Definition at line 46 of file fp.c.

Referenced by scale_array_elements_to_u64().

◆ tor_lround()

long tor_lround ( double  d)

Return the long integer closest to d. We define this wrapper here so that not all users of math.h need to use the right incantations to get the c99 functions.

Definition at line 31 of file fp.c.

Referenced by circuit_build_times_close_quantile(), and circuit_build_times_set_timeout().

◆ tor_mathlog()

double tor_mathlog ( double  d)

Returns the natural logarithm of d base e. We defined this wrapper here so to avoid conflicts with old versions of tor_log(), which were named log().

Definition at line 22 of file fp.c.

Referenced by circuit_build_times_update_alpha(), and sample_laplace_distribution().