MobilityDB  1.0
Functions
tnumber_mathfuncs.c File Reference

Temporal mathematical operators (+, -, *, /) and functions (round, degrees). More...

#include "general/tnumber_mathfuncs.h"
#include <assert.h>
#include <math.h>
#include <utils/builtins.h>
#include "general/period.h"
#include "general/timeops.h"
#include "general/temporaltypes.h"
#include "general/temporal_util.h"
#include "general/lifting.h"
Include dependency graph for tnumber_mathfuncs.c:

Functions

Datum datum_round (Datum value, Datum prec)
 Round the number to the number of decimal places. More...
 
static Datum datum_degrees (Datum value)
 Convert the number from radians to degrees. More...
 
static bool tnumber_arithop_tp_at_timestamp1 (const TInstant *start1, const TInstant *end1, bool linear1, const TInstant *start2, const TInstant *end2, bool linear2, TimestampTz *t)
 Find the single timestamptz at which the multiplication of two temporal number segments is at a local minimum/maximum. More...
 
static bool tnumber_arithop_tp_at_timestamp (const TInstant *start1, const TInstant *end1, bool linear1, const TInstant *start2, const TInstant *end2, bool linear2, char op, Datum *value, TimestampTz *t)
 
static bool tnumber_mult_tp_at_timestamp (const TInstant *start1, const TInstant *end1, bool linear1, const TInstant *start2, const TInstant *end2, bool linear2, Datum *value, TimestampTz *t)
 
static bool tnumber_div_tp_at_timestamp (const TInstant *start1, const TInstant *end1, bool linear1, const TInstant *start2, const TInstant *end2, bool linear2, Datum *value, TimestampTz *t)
 
Temporalarithop_tnumber_base1 (FunctionCallInfo fcinfo, Datum(*func)(Datum, Datum, Oid, Oid), TArithmetic oper, Temporal *temp, Datum value, Oid basetypid, bool invert)
 Generic arithmetic operator on a temporal number and a number. More...
 
Datum arithop_base_tnumber (FunctionCallInfo fcinfo, Datum(*func)(Datum, Datum, Oid, Oid), TArithmetic oper)
 Generic arithmetic operator on a number an a temporal number. More...
 
Datum arithop_tnumber_base (FunctionCallInfo fcinfo, Datum(*func)(Datum, Datum, Oid, Oid), TArithmetic oper)
 Generic arithmetic operator on a temporal number an a number. More...
 
static Datum arithop_tnumber_tnumber (FunctionCallInfo fcinfo, Datum(*func)(Datum, Datum, Oid, Oid), TArithmetic oper, bool(*tpfunc)(const TInstant *, const TInstant *, bool, const TInstant *, const TInstant *, bool, Datum *, TimestampTz *))
 Generic arithmetic operator on a temporal number an a number. More...
 
PGDLLEXPORT Datum add_base_tnumber (PG_FUNCTION_ARGS)
 Returns the temporal addition of the number and the temporal number. More...
 
PGDLLEXPORT Datum add_tnumber_base (PG_FUNCTION_ARGS)
 Returns the temporal addition of the temporal number and the number. More...
 
PGDLLEXPORT Datum add_tnumber_tnumber (PG_FUNCTION_ARGS)
 Returns the temporal addition of the temporal numbers. More...
 
PGDLLEXPORT Datum sub_base_tnumber (PG_FUNCTION_ARGS)
 Returns the temporal subtraction of the number and the temporal number. More...
 
PGDLLEXPORT Datum sub_tnumber_base (PG_FUNCTION_ARGS)
 Returns the temporal subtraction of the temporal number and the number. More...
 
PGDLLEXPORT Datum sub_tnumber_tnumber (PG_FUNCTION_ARGS)
 Returns the temporal subtraction of the temporal numbers. More...
 
PGDLLEXPORT Datum mult_base_tnumber (PG_FUNCTION_ARGS)
 Returns the temporal multiplication of the number and the temporal number. More...
 
PGDLLEXPORT Datum mult_tnumber_base (PG_FUNCTION_ARGS)
 Returns the temporal multiplication of the temporal number and the number. More...
 
PGDLLEXPORT Datum mult_tnumber_tnumber (PG_FUNCTION_ARGS)
 Returns the temporal multiplication of the temporal numbers. More...
 
PGDLLEXPORT Datum div_base_tnumber (PG_FUNCTION_ARGS)
 Returns the temporal division of the number and the temporal number. More...
 
PGDLLEXPORT Datum div_tnumber_base (PG_FUNCTION_ARGS)
 Returns the temporal division of the temporal number and the number. More...
 
PGDLLEXPORT Datum div_tnumber_tnumber (PG_FUNCTION_ARGS)
 Returns the temporal multiplication of the temporal numbers. More...
 
PGDLLEXPORT Datum tnumber_round (PG_FUNCTION_ARGS)
 Round the temporal number to the number of decimal places. More...
 
PGDLLEXPORT Datum tnumber_degrees (PG_FUNCTION_ARGS)
 Convert the temporal number from radians to degrees. More...
 
static TSequencetnumberseq_derivative (const TSequence *seq)
 Returns the derivative of the temporal number. More...
 
static TSequenceSettnumberseqset_derivative (const TSequenceSet *ts)
 Returns the derivative of the temporal number. More...
 
PGDLLEXPORT Datum tnumber_derivative (PG_FUNCTION_ARGS)
 Returns the derivative of the temporal number. More...
 

Detailed Description

Temporal mathematical operators (+, -, *, /) and functions (round, degrees).