void *ST_dtime(void) { double dt; dt = dtime(); Tset((ATerm)ATmakeReal(dt)); return NULL; }
ATerm STR_REALS_ceil(ATerm t) { double r; if(ATgetType(t) != AT_REAL && ATgetType(t) != AT_INT) return NULL; NUMERIC_ATERM_TO_REAL(r, t); return (ATerm) ATmakeReal(ceil(r)); }
void *_div(void) { int k, l; double r1, r2; int res = number_pair(&k, &l, &r1, &r2); if(res == 0) return fail_address; else if(res == 1) { if(k % l == 0) { Tset((ATerm) ATmakeInt(k / l)); } else { Tset((ATerm) ATmakeReal((double)k / (double)l)); } } else { Tset((ATerm) ATmakeReal(r1 / r2)); } return NULL; }
void *_min(void) { int k, l; double r1, r2; int res = number_pair(&k, &l, &r1, &r2); if(res == 0) return fail_address; else if(res == 1) { Tset((ATerm) ATmakeInt(k <= l ? k : l)); } else { Tset((ATerm) ATmakeReal(r1 <= r2 ? r1 : r2)); } return NULL; }
void *_plus(void) { int k, l; double r1, r2; int res = number_pair(&k, &l, &r1, &r2); if(res == 0) return fail_address; else if(res == 1) { Tset((ATerm) ATmakeInt(k + l)); } else { Tset((ATerm) ATmakeReal(r1 + r2)); } return NULL; }
void *_sin(void) { int k; double r; if(ATmatch(Ttop(), "<int>", &k)) { r = (double)k; } else if(ATmatch(Ttop(), "<real>", &r)) { ; } else return fail_address; Tset((ATerm) ATmakeReal(sin(r))); return NULL; }
ATerm SSL_modr(ATerm x, ATerm y) { assert_is_real(x); assert_is_real(y); return((ATerm) ATmakeReal(fmod(_get_real(x), _get_real(y)))); }
ATerm SSL_divr(ATerm x, ATerm y) { assert_is_real(x); assert_is_real(y); return((ATerm) ATmakeReal(_get_real(x) / _get_real(y))); }