diff options
author | tomsmeding <tom.smeding@gmail.com> | 2016-08-23 20:58:50 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2016-08-23 20:58:50 +0200 |
commit | cac651cd88f8da1e5957b0cc13fa25d79e1887fc (patch) | |
tree | 38b2645803df92661b797a64f18772e691d3d8fd /util.c | |
parent | 44602cb35735575c15cfcb92779337778649df8a (diff) |
Many things
- two-letter AST union members
- AST_QUOTED
- AST_LAMBDA
- an interpreter that works
- function registering in the interpreter
- some builtins
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1,6 +1,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <math.h> #include "util.h" @@ -26,6 +27,14 @@ __attribute__((noreturn)) void outofmem(void){ } +double floatmod(double a,double b){ + if(b==0)return nan(""); + int sa=a<0?-1:1; + a=fabs(a); b=fabs(b); + return sa*(a-b*floor(a/b)); +} + + void* malloccheck(size_t n){ void *p=mallocreal(n); if(!p)outofmem(); |