ReactOS 0.4.15-dev-7918-g2a2556c
math.c File Reference
#include <math.h>
#include <limits.h>
#include "jscript.h"
#include "ntsecapi.h"
#include "wine/debug.h"
Include dependency graph for math.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (jscript)
 
static HRESULT Math_abs (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_acos (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_asin (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_atan (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_atan2 (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_ceil (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_cos (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_exp (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_floor (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_log (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_max (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_min (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_pow (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_random (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_round (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_sin (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_sqrt (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Math_tan (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
HRESULT create_math (script_ctx_t *ctx, jsdisp_t **ret)
 

Variables

static const WCHAR EW [] = {'E',0}
 
static const WCHAR LOG2EW [] = {'L','O','G','2','E',0}
 
static const WCHAR LOG10EW [] = {'L','O','G','1','0','E',0}
 
static const WCHAR LN2W [] = {'L','N','2',0}
 
static const WCHAR LN10W [] = {'L','N','1','0',0}
 
static const WCHAR PIW [] = {'P','I',0}
 
static const WCHAR SQRT2W [] = {'S','Q','R','T','2',0}
 
static const WCHAR SQRT1_2W [] = {'S','Q','R','T','1','_','2',0}
 
static const WCHAR absW [] = {'a','b','s',0}
 
static const WCHAR acosW [] = {'a','c','o','s',0}
 
static const WCHAR asinW [] = {'a','s','i','n',0}
 
static const WCHAR atanW [] = {'a','t','a','n',0}
 
static const WCHAR atan2W [] = {'a','t','a','n','2',0}
 
static const WCHAR ceilW [] = {'c','e','i','l',0}
 
static const WCHAR cosW [] = {'c','o','s',0}
 
static const WCHAR expW [] = {'e','x','p',0}
 
static const WCHAR floorW [] = {'f','l','o','o','r',0}
 
static const WCHAR logW [] = {'l','o','g',0}
 
static const WCHAR maxW [] = {'m','a','x',0}
 
static const WCHAR minW [] = {'m','i','n',0}
 
static const WCHAR powW [] = {'p','o','w',0}
 
static const WCHAR randomW [] = {'r','a','n','d','o','m',0}
 
static const WCHAR roundW [] = {'r','o','u','n','d',0}
 
static const WCHAR sinW [] = {'s','i','n',0}
 
static const WCHAR sqrtW [] = {'s','q','r','t',0}
 
static const WCHAR tanW [] = {'t','a','n',0}
 
static const builtin_prop_t Math_props []
 
static const builtin_info_t Math_info
 

Function Documentation

◆ create_math()

HRESULT create_math ( script_ctx_t ctx,
jsdisp_t **  ret 
)

Definition at line 533 of file math.c.

534{
535 jsdisp_t *math;
536 unsigned i;
538
539 struct {
540 const WCHAR *name;
541 DOUBLE val;
542 }constants[] = {
543 {EW, M_E}, /* ECMA-262 3rd Edition 15.8.1.1 */
544 {LN10W, M_LN10}, /* ECMA-262 3rd Edition 15.8.1.2 */
545 {LN2W, M_LN2}, /* ECMA-262 3rd Edition 15.8.1.3 */
546 {LOG2EW, M_LOG2E}, /* ECMA-262 3rd Edition 15.8.1.4 */
547 {LOG10EW, M_LOG10E}, /* ECMA-262 3rd Edition 15.8.1.5 */
548 {PIW, M_PI}, /* ECMA-262 3rd Edition 15.8.1.6 */
549 {SQRT1_2W, M_SQRT1_2}, /* ECMA-262 3rd Edition 15.8.1.7 */
550 {SQRT2W, M_SQRT2}, /* ECMA-262 3rd Edition 15.8.1.8 */
551 };
552
553 math = heap_alloc_zero(sizeof(jsdisp_t));
554 if(!math)
555 return E_OUTOFMEMORY;
556
557 hres = init_dispex_from_constr(math, ctx, &Math_info, ctx->object_constr);
558 if(FAILED(hres)) {
559 heap_free(math);
560 return hres;
561 }
562
563 for(i=0; i < ARRAY_SIZE(constants); i++) {
566 if(FAILED(hres)) {
567 jsdisp_release(math);
568 return hres;
569 }
570 }
571
572 *ret = math;
573 return S_OK;
574}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define ARRAY_SIZE(A)
Definition: main.h:33
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const WCHAR LOG10EW[]
Definition: math.c:37
static const builtin_info_t Math_info
Definition: math.c:524
static const WCHAR SQRT2W[]
Definition: math.c:41
static const WCHAR LOG2EW[]
Definition: math.c:36
static const WCHAR LN2W[]
Definition: math.c:38
static const WCHAR PIW[]
Definition: math.c:40
static const WCHAR LN10W[]
Definition: math.c:39
static const WCHAR SQRT1_2W[]
Definition: math.c:42
static const WCHAR EW[]
Definition: math.c:35
GLuint GLfloat * val
Definition: glext.h:7180
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
Definition: dispex.c:1801
HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *constr)
Definition: dispex.c:1030
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
static jsval_t jsval_number(double n)
Definition: jsval.h:144
#define M_PI
Definition: macros.h:263
HRESULT hres
Definition: protocol.c:465
constants
Definition: resource.c:29
#define M_SQRT2
Definition: name.c:39
double DOUBLE
Definition: typedefs.h:70
int ret
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by init_global().

◆ Math_abs()

static HRESULT Math_abs ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 63 of file math.c.

65{
66 double d;
68
69 TRACE("\n");
70
71 if(!argc) {
72 if(r)
73 *r = jsval_number(NAN);
74 return S_OK;
75 }
76
77 hres = to_number(ctx, argv[0], &d);
78 if(FAILED(hres))
79 return hres;
80
81 if(r)
82 *r = jsval_number(d < 0.0 ? -d : d);
83 return S_OK;
84}
static int argc
Definition: ServiceArgs.c:12
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
HRESULT to_number(script_ctx_t *, jsval_t, double *) DECLSPEC_HIDDEN
Definition: jsutils.c:609
#define d
Definition: ke_i.h:81
#define NAN
Definition: mesh.c:39
#define argv
Definition: mplay32.c:18
#define TRACE(s)
Definition: solgame.cpp:4

◆ Math_acos()

static HRESULT Math_acos ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 86 of file math.c.

88{
89 double x;
91
92 TRACE("\n");
93
94 if(!argc) {
95 if(r)
96 *r = jsval_number(NAN);
97 return S_OK;
98 }
99
100 hres = to_number(ctx, argv[0], &x);
101 if(FAILED(hres))
102 return hres;
103
104 if(r)
105 *r = jsval_number(x < -1.0 || x > 1.0 ? NAN : acos(x));
106 return S_OK;
107}
valarray< _Tp > acos(const valarray< _Tp > &__x)
Definition: _valarray.h:901
GLint GLint GLint GLint GLint x
Definition: gl.h:1548

◆ Math_asin()

static HRESULT Math_asin ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 109 of file math.c.

111{
112 double x;
114
115 TRACE("\n");
116
117 if(!argc) {
118 if(r)
119 *r = jsval_number(NAN);
120 return S_OK;
121 }
122
123 hres = to_number(ctx, argv[0], &x);
124 if(FAILED(hres))
125 return hres;
126
127 if(r)
128 *r = jsval_number(x < -1.0 || x > 1.0 ? NAN : asin(x));
129 return S_OK;
130}
valarray< _Tp > asin(const valarray< _Tp > &__x)
Definition: _valarray.h:910

◆ Math_atan()

static HRESULT Math_atan ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 132 of file math.c.

134{
135 double x;
137
138 TRACE("\n");
139
140 if(!argc) {
141 if(r)
142 *r = jsval_number(NAN);
143 return S_OK;
144 }
145
146 hres = to_number(ctx, argv[0], &x);
147 if(FAILED(hres))
148 return hres;
149
150 if(r)
151 *r = jsval_number(atan(x));
152 return S_OK;
153}
valarray< _Tp > atan(const valarray< _Tp > &__x)
Definition: _valarray.h:919

◆ Math_atan2()

static HRESULT Math_atan2 ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 155 of file math.c.

157{
158 double x, y;
160
161 TRACE("\n");
162
163 if(argc<2) {
164 if(r)
165 *r = jsval_number(NAN);
166 return S_OK;
167 }
168
169 hres = to_number(ctx, argv[0], &y);
170 if(FAILED(hres))
171 return hres;
172
173 hres = to_number(ctx, argv[1], &x);
174 if(FAILED(hres))
175 return hres;
176
177 if(r)
178 *r = jsval_number(atan2(y, x));
179 return S_OK;
180}
valarray< _Tp > atan2(const valarray< _Tp > &__x, const valarray< _Tp > &__y)
Definition: _valarray.h:928
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ Math_ceil()

static HRESULT Math_ceil ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 183 of file math.c.

185{
186 double x;
188
189 TRACE("\n");
190
191 if(!argc) {
192 if(r)
193 *r = jsval_number(NAN);
194 return S_OK;
195 }
196
197 hres = to_number(ctx, argv[0], &x);
198 if(FAILED(hres))
199 return hres;
200
201 if(r)
202 *r = jsval_number(ceil(x));
203 return S_OK;
204}
_Check_return_ _CRTIMP double __cdecl ceil(_In_ double x)

◆ Math_cos()

static HRESULT Math_cos ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 206 of file math.c.

208{
209 double x;
211
212 TRACE("\n");
213
214 if(!argc) {
215 if(r)
216 *r = jsval_number(NAN);
217 return S_OK;
218 }
219
220 hres = to_number(ctx, argv[0], &x);
221 if(FAILED(hres))
222 return hres;
223
224 if(r)
225 *r = jsval_number(cos(x));
226 return S_OK;
227}
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)

◆ Math_exp()

static HRESULT Math_exp ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 229 of file math.c.

231{
232 double x;
234
235 TRACE("\n");
236
237 if(!argc) {
238 if(r)
239 *r = jsval_number(NAN);
240 return S_OK;
241 }
242
243 hres = to_number(ctx, argv[0], &x);
244 if(FAILED(hres))
245 return hres;
246
247 if(r)
248 *r = jsval_number(exp(x));
249 return S_OK;
250}
DWORD exp
Definition: msg.c:16058

◆ Math_floor()

static HRESULT Math_floor ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 252 of file math.c.

254{
255 double x;
257
258 TRACE("\n");
259
260 if(!argc) {
261 if(r)
262 *r = jsval_number(NAN);
263 return S_OK;
264 }
265
266 hres = to_number(ctx, argv[0], &x);
267 if(FAILED(hres))
268 return hres;
269
270 if(r)
271 *r = jsval_number(floor(x));
272 return S_OK;
273}
_Check_return_ _CRTIMP double __cdecl floor(_In_ double x)

◆ Math_log()

static HRESULT Math_log ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 275 of file math.c.

277{
278 double x;
280
281 TRACE("\n");
282
283 if(!argc) {
284 if(r)
285 *r = jsval_number(NAN);
286 return S_OK;
287 }
288
289 hres = to_number(ctx, argv[0], &x);
290 if(FAILED(hres))
291 return hres;
292
293 if(r)
294 *r = jsval_number(x < -0.0 ? NAN : log(x));
295 return S_OK;
296}
#define log(outFile, fmt,...)
Definition: util.h:15

◆ Math_max()

static HRESULT Math_max ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 299 of file math.c.

301{
302 DOUBLE max, d;
303 DWORD i;
305
306 TRACE("\n");
307
308 if(!argc) {
309 if(r)
311 return S_OK;
312 }
313
314 hres = to_number(ctx, argv[0], &max);
315 if(FAILED(hres))
316 return hres;
317
318 for(i=1; i < argc; i++) {
319 hres = to_number(ctx, argv[i], &d);
320 if(FAILED(hres))
321 return hres;
322
323 if(d > max || isnan(d))
324 max = d;
325 }
326
327 if(r)
328 *r = jsval_number(max);
329 return S_OK;
330}
unsigned long DWORD
Definition: ntddk_ex.h:95
#define isnan(x)
Definition: mingw_math.h:133
#define INFINITY
Definition: misc.c:36
#define max(a, b)
Definition: svc.c:63

◆ Math_min()

static HRESULT Math_min ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 333 of file math.c.

335{
336 DOUBLE min, d;
337 DWORD i;
339
340 TRACE("\n");
341
342 if(!argc) {
343 if(r)
345 return S_OK;
346 }
347
348 hres = to_number(ctx, argv[0], &min);
349 if(FAILED(hres))
350 return hres;
351
352 for(i=1; i < argc; i++) {
353 hres = to_number(ctx, argv[i], &d);
354 if(FAILED(hres))
355 return hres;
356
357 if(d < min || isnan(d))
358 min = d;
359 }
360
361 if(r)
362 *r = jsval_number(min);
363 return S_OK;
364}
#define min(a, b)
Definition: monoChain.cc:55

◆ Math_pow()

static HRESULT Math_pow ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 367 of file math.c.

369{
370 double x, y;
372
373 TRACE("\n");
374
375 if(argc < 2) {
376 if(r)
377 *r = jsval_number(NAN);
378 return S_OK;
379 }
380
381 hres = to_number(ctx, argv[0], &x);
382 if(FAILED(hres))
383 return hres;
384
385 hres = to_number(ctx, argv[1], &y);
386 if(FAILED(hres))
387 return hres;
388
389 if(r)
390 *r = jsval_number(pow(x, y));
391 return S_OK;
392}
double pow(double x, double y)
Definition: freeldr.c:112

◆ Math_random()

static HRESULT Math_random ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 395 of file math.c.

397{
398 UINT x;
399
400 TRACE("\n");
401
402 if(!RtlGenRandom(&x, sizeof(x)))
403 return E_UNEXPECTED;
404
405 if(r)
406 *r = jsval_number((double)x/(double)UINT_MAX);
407 return S_OK;
408}
#define UINT_MAX
Definition: limits.h:41
unsigned int UINT
Definition: ndis.h:50
#define RtlGenRandom
Definition: ntsecapi.h:691
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ Math_round()

static HRESULT Math_round ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 411 of file math.c.

413{
414 double x;
416
417 TRACE("\n");
418
419 if(!argc) {
420 if(r)
421 *r = jsval_number(NAN);
422 return S_OK;
423 }
424
425 hres = to_number(ctx, argv[0], &x);
426 if(FAILED(hres))
427 return hres;
428
429 if(r)
430 *r = jsval_number(floor(x+0.5));
431 return S_OK;
432}

◆ Math_sin()

static HRESULT Math_sin ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 434 of file math.c.

436{
437 double x;
439
440 TRACE("\n");
441
442 if(!argc) {
443 if(r)
444 *r = jsval_number(NAN);
445 return S_OK;
446 }
447
448 hres = to_number(ctx, argv[0], &x);
449 if(FAILED(hres))
450 return hres;
451
452 if(r)
453 *r = jsval_number(sin(x));
454 return S_OK;
455}
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)

◆ Math_sqrt()

static HRESULT Math_sqrt ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 457 of file math.c.

459{
460 double x;
462
463 TRACE("\n");
464
465 if(!argc) {
466 if(r)
467 *r = jsval_number(NAN);
468 return S_OK;
469 }
470
471 hres = to_number(ctx, argv[0], &x);
472 if(FAILED(hres))
473 return hres;
474
475 if(r)
476 *r = jsval_number(sqrt(x));
477 return S_OK;
478}
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
Definition: complex.cpp:188

◆ Math_tan()

static HRESULT Math_tan ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 480 of file math.c.

482{
483 double x;
485
486 TRACE("\n");
487
488 if(!argc) {
489 if(r)
490 *r = jsval_number(NAN);
491 return S_OK;
492 }
493
494 hres = to_number(ctx, argv[0], &x);
495 if(FAILED(hres))
496 return hres;
497
498 if(r)
499 *r = jsval_number(tan(x));
500 return S_OK;
501}
_STLP_DECLSPEC complex< float > _STLP_CALL tan(const complex< float > &)

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( jscript  )

Variable Documentation

◆ absW

const WCHAR absW[] = {'a','b','s',0}
static

Definition at line 43 of file math.c.

◆ acosW

const WCHAR acosW[] = {'a','c','o','s',0}
static

Definition at line 44 of file math.c.

◆ asinW

const WCHAR asinW[] = {'a','s','i','n',0}
static

Definition at line 45 of file math.c.

◆ atan2W

const WCHAR atan2W[] = {'a','t','a','n','2',0}
static

Definition at line 47 of file math.c.

◆ atanW

const WCHAR atanW[] = {'a','t','a','n',0}
static

Definition at line 46 of file math.c.

◆ ceilW

const WCHAR ceilW[] = {'c','e','i','l',0}
static

Definition at line 48 of file math.c.

◆ cosW

const WCHAR cosW[] = {'c','o','s',0}
static

Definition at line 49 of file math.c.

◆ EW

const WCHAR EW[] = {'E',0}
static

Definition at line 35 of file math.c.

Referenced by create_math().

◆ expW

const WCHAR expW[] = {'e','x','p',0}
static

Definition at line 50 of file math.c.

Referenced by test_message_from_64bit_number().

◆ floorW

const WCHAR floorW[] = {'f','l','o','o','r',0}
static

Definition at line 51 of file math.c.

◆ LN10W

const WCHAR LN10W[] = {'L','N','1','0',0}
static

Definition at line 39 of file math.c.

Referenced by create_math().

◆ LN2W

const WCHAR LN2W[] = {'L','N','2',0}
static

Definition at line 38 of file math.c.

Referenced by create_math().

◆ LOG10EW

const WCHAR LOG10EW[] = {'L','O','G','1','0','E',0}
static

Definition at line 37 of file math.c.

Referenced by create_math().

◆ LOG2EW

const WCHAR LOG2EW[] = {'L','O','G','2','E',0}
static

Definition at line 36 of file math.c.

Referenced by create_math().

◆ logW

const WCHAR logW[] = {'l','o','g',0}
static

Definition at line 52 of file math.c.

◆ Math_info

const builtin_info_t Math_info
static
Initial value:
= {
{NULL, NULL, 0},
}
#define NULL
Definition: types.h:112
static const builtin_prop_t Math_props[]
Definition: math.c:503
@ JSCLASS_MATH
Definition: jscript.h:128

Definition at line 524 of file math.c.

Referenced by create_math().

◆ Math_props

const builtin_prop_t Math_props[]
static
Initial value:
= {
}
static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:367
static const WCHAR roundW[]
Definition: math.c:57
static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:411
static const WCHAR atan2W[]
Definition: math.c:47
static const WCHAR sqrtW[]
Definition: math.c:59
static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:63
static const WCHAR ceilW[]
Definition: math.c:48
static HRESULT Math_max(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:299
static const WCHAR powW[]
Definition: math.c:55
static const WCHAR tanW[]
Definition: math.c:60
static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:183
static HRESULT Math_random(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:395
static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:206
static HRESULT Math_min(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:333
static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:480
static const WCHAR minW[]
Definition: math.c:54
static const WCHAR atanW[]
Definition: math.c:46
static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:275
static const WCHAR expW[]
Definition: math.c:50
static const WCHAR cosW[]
Definition: math.c:49
static const WCHAR absW[]
Definition: math.c:43
static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:434
static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:252
static const WCHAR randomW[]
Definition: math.c:56
static const WCHAR logW[]
Definition: math.c:52
static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:229
static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:457
static const WCHAR acosW[]
Definition: math.c:44
static const WCHAR asinW[]
Definition: math.c:45
static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:132
static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:86
static const WCHAR sinW[]
Definition: math.c:58
static const WCHAR floorW[]
Definition: math.c:51
static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:109
static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: math.c:155
static const WCHAR maxW[]
Definition: math.c:53
#define PROPF_METHOD
Definition: jscript.h:97

Definition at line 503 of file math.c.

◆ maxW

const WCHAR maxW[] = {'m','a','x',0}
static

Definition at line 53 of file math.c.

Referenced by HUF_readDTableX2_wksp().

◆ minW

const WCHAR minW[] = {'m','i','n',0}
static

Definition at line 54 of file math.c.

◆ PIW

const WCHAR PIW[] = {'P','I',0}
static

Definition at line 40 of file math.c.

Referenced by create_math().

◆ powW

const WCHAR powW[] = {'p','o','w',0}
static

Definition at line 55 of file math.c.

◆ randomW

const WCHAR randomW[] = {'r','a','n','d','o','m',0}
static

Definition at line 56 of file math.c.

◆ roundW

const WCHAR roundW[] = {'r','o','u','n','d',0}
static

Definition at line 57 of file math.c.

◆ sinW

const WCHAR sinW[] = {'s','i','n',0}
static

Definition at line 58 of file math.c.

◆ SQRT1_2W

const WCHAR SQRT1_2W[] = {'S','Q','R','T','1','_','2',0}
static

Definition at line 42 of file math.c.

Referenced by create_math().

◆ SQRT2W

const WCHAR SQRT2W[] = {'S','Q','R','T','2',0}
static

Definition at line 41 of file math.c.

Referenced by create_math().

◆ sqrtW

const WCHAR sqrtW[] = {'s','q','r','t',0}
static

Definition at line 59 of file math.c.

◆ tanW

const WCHAR tanW[] = {'t','a','n',0}
static

Definition at line 60 of file math.c.