diff --git a/src/library.js b/src/library.js index 162c3f9ec..961533122 100644 --- a/src/library.js +++ b/src/library.js @@ -4714,6 +4714,13 @@ LibraryManager.library = { {{{ makeSetValue('cosine', '0', 'cosineVal', 'double') }}}; }, + sincosf: function(x, sine, cosine) { + var sineVal = Math.sin(x), + cosineVal = Math.cos(x); + {{{ makeSetValue('sine', '0', 'sineVal', 'float') }}}; + {{{ makeSetValue('cosine', '0', 'cosineVal', 'float') }}}; + }, + __div_t_struct_layout: Runtime.generateStructInfo([ ['i32', 'quot'], ['i32', 'rem'], diff --git a/tests/runner.py b/tests/runner.py index 503458c0b..b214c2026 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -760,6 +760,7 @@ if 'benchmark' not in str(sys.argv) and 'sanity' not in str(sys.argv): def test_math(self): src = ''' #include + #include #include int main() { @@ -772,11 +773,22 @@ if 'benchmark' not in str(sys.argv) and 'sanity' not in str(sys.argv): printf(",%d", isinf(INFINITY) != 0); printf(",%d", isinf(-INFINITY) != 0); printf(",%d", isinf(12.3) != 0); + div_t div_result = div(23, 10); + printf(",%d", div_result.quot); + printf(",%d", div_result.rem); + double sine = -1.0, cosine = -1.0; + sincos(0.0, &sine, &cosine); + printf(",%1.1lf", sine); + printf(",%1.1lf", cosine); + float fsine = -1.0f, fcosine = -1.0f; + sincosf(0.0, &fsine, &fcosine); + printf(",%1.1f", fsine); + printf(",%1.1f", fcosine); printf("*\\n"); return 0; } ''' - self.do_run(src, '*3.14,-3.14,1,0,0,0,1,0,1,1,0*') + self.do_run(src, '*3.14,-3.14,1,0,0,0,1,0,1,1,0,2,3,0.0,1.0,0.0,1.0*') def test_math_hyperbolic(self): src = open(path_from_root('tests', 'hyperbolic', 'src.c'), 'r').read()