@@ -1386,112 +1386,34 @@ typedef struct
1386
1386
#define ECMA_PROPERTY_FLAGS_MASK \
1387
1387
((uint16_t) (JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_ENUMERABLE | JERRY_PROP_IS_WRITABLE))
1388
1388
1389
- #if !JERRY_NUMBER_TYPE_FLOAT64
1390
- /**
1391
- * Description of an ecma-number
1392
- */
1393
- typedef float ecma_number_t ;
1394
-
1395
- /**
1396
- * It makes possible to read/write an ecma_number_t as uint32_t without strict aliasing rule violation.
1397
- */
1398
- typedef union
1399
- {
1400
- ecma_number_t as_ecma_number_t ;
1401
- uint32_t as_uint32_t ;
1402
- } ecma_number_accessor_t ;
1403
-
1404
- #define DOUBLE_TO_ECMA_NUMBER_T (value ) (ecma_number_t) (value)
1405
-
1406
- /**
1407
- * Maximum number of significant digits that ecma-number can store
1408
- */
1409
- #define ECMA_NUMBER_MAX_DIGITS (9)
1410
-
1411
- /**
1412
- * Width of sign field
1413
- *
1414
- * See also:
1415
- * IEEE-754 2008, 3.6, Table 3.5
1416
- */
1417
- #define ECMA_NUMBER_SIGN_WIDTH (1)
1418
-
1419
- /**
1420
- * Width of biased exponent field
1421
- *
1422
- * See also:
1423
- * IEEE-754 2008, 3.6, Table 3.5
1424
- */
1425
- #define ECMA_NUMBER_BIASED_EXP_WIDTH (8)
1426
-
1427
- /**
1428
- * Width of fraction field
1429
- *
1430
- * See also:
1431
- * IEEE-754 2008, 3.6, Table 3.5
1432
- */
1433
- #define ECMA_NUMBER_FRACTION_WIDTH (23)
1434
- #elif JERRY_NUMBER_TYPE_FLOAT64
1435
1389
/**
1436
1390
* Description of an ecma-number
1437
1391
*/
1392
+ #if JERRY_NUMBER_TYPE_FLOAT64
1438
1393
typedef double ecma_number_t ;
1394
+ #else /* !JERRY_NUMBER_TYPE_FLOAT64 */
1395
+ typedef float ecma_number_t ;
1396
+ #endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
1439
1397
1440
1398
/**
1441
- * It makes possible to read/write an ecma_number_t as uint64_t without strict aliasing rule violation.
1442
- */
1443
- typedef union
1444
- {
1445
- ecma_number_t as_ecma_number_t ;
1446
- uint64_t as_uint64_t ;
1447
- } ecma_number_accessor_t ;
1448
-
1449
- #define DOUBLE_TO_ECMA_NUMBER_T (value ) value
1450
-
1451
- /**
1452
- * Maximum number of significant digits that ecma-number can store
1453
- */
1454
- #define ECMA_NUMBER_MAX_DIGITS (19)
1455
-
1456
- /**
1457
- * Width of sign field
1458
- *
1459
- * See also:
1460
- * IEEE-754 2008, 3.6, Table 3.5
1461
- */
1462
- #define ECMA_NUMBER_SIGN_WIDTH (1)
1463
-
1464
- /**
1465
- * Width of biased exponent field
1466
- *
1467
- * See also:
1468
- * IEEE-754 2008, 3.6, Table 3.5
1469
- */
1470
- #define ECMA_NUMBER_BIASED_EXP_WIDTH (11)
1471
-
1472
- /**
1473
- * Width of fraction field
1474
- *
1475
- * See also:
1476
- * IEEE-754 2008, 3.6, Table 3.5
1399
+ * Convert double to an ecma-number.
1477
1400
*/
1478
- #define ECMA_NUMBER_FRACTION_WIDTH (52)
1479
- #endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
1401
+ #define DOUBLE_TO_ECMA_NUMBER_T (value ) ((ecma_number_t) (value))
1480
1402
1481
1403
/**
1482
1404
* Value '0' of ecma_number_t
1483
1405
*/
1484
- #define ECMA_NUMBER_ZERO ((ecma_number_t) 0)
1406
+ #define ECMA_NUMBER_ZERO ((ecma_number_t) 0.0f )
1485
1407
1486
1408
/**
1487
1409
* Value '1' of ecma_number_t
1488
1410
*/
1489
- #define ECMA_NUMBER_ONE ((ecma_number_t) 1)
1411
+ #define ECMA_NUMBER_ONE ((ecma_number_t) 1.0f )
1490
1412
1491
1413
/**
1492
1414
* Value '2' of ecma_number_t
1493
1415
*/
1494
- #define ECMA_NUMBER_TWO ((ecma_number_t) 2)
1416
+ #define ECMA_NUMBER_TWO ((ecma_number_t) 2.0f )
1495
1417
1496
1418
/**
1497
1419
* Value '0.5' of ecma_number_t
@@ -1501,117 +1423,7 @@ typedef union
1501
1423
/**
1502
1424
* Value '-1' of ecma_number_t
1503
1425
*/
1504
- #define ECMA_NUMBER_MINUS_ONE ((ecma_number_t) -1)
1505
-
1506
- #if !JERRY_NUMBER_TYPE_FLOAT64
1507
- /**
1508
- * Number.MIN_VALUE (i.e., the smallest positive value of ecma-number)
1509
- *
1510
- * See also: ECMA_262 v5, 15.7.3.3
1511
- */
1512
- #define ECMA_NUMBER_MIN_VALUE (FLT_MIN)
1513
- /**
1514
- * Number.MAX_VALUE (i.e., the maximum value of ecma-number)
1515
- *
1516
- * See also: ECMA_262 v5, 15.7.3.2
1517
- */
1518
- #define ECMA_NUMBER_MAX_VALUE (FLT_MAX)
1519
- /**
1520
- * Number.EPSILON
1521
- *
1522
- * See also: ECMA_262 v6, 20.1.2.1
1523
- */
1524
- #define ECMA_NUMBER_EPSILON ((ecma_number_t) 1.1920928955078125e-7)
1525
-
1526
- /**
1527
- * Number.MAX_SAFE_INTEGER
1528
- *
1529
- * See also: ECMA_262 v6, 20.1.2.6
1530
- */
1531
- #define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0xFFFFFF)
1532
-
1533
- /**
1534
- * Number.MIN_SAFE_INTEGER
1535
- *
1536
- * See also: ECMA_262 v6, 20.1.2.8
1537
- */
1538
- #define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0xFFFFFF)
1539
- #elif JERRY_NUMBER_TYPE_FLOAT64
1540
- /**
1541
- * Number.MAX_VALUE (i.e., the maximum value of ecma-number)
1542
- *
1543
- * See also: ECMA_262 v5, 15.7.3.2
1544
- */
1545
- #define ECMA_NUMBER_MAX_VALUE ((ecma_number_t) 1.7976931348623157e+308)
1546
-
1547
- /**
1548
- * Number.MIN_VALUE (i.e., the smallest positive value of ecma-number)
1549
- *
1550
- * See also: ECMA_262 v5, 15.7.3.3
1551
- */
1552
- #define ECMA_NUMBER_MIN_VALUE ((ecma_number_t) 5e-324)
1553
-
1554
- /**
1555
- * Number.EPSILON
1556
- *
1557
- * See also: ECMA_262 v6, 20.1.2.1
1558
- */
1559
- #define ECMA_NUMBER_EPSILON ((ecma_number_t) 2.2204460492503130808472633361816e-16)
1560
-
1561
- /**
1562
- * Number.MAX_SAFE_INTEGER
1563
- *
1564
- * See also: ECMA_262 v6, 20.1.2.6
1565
- */
1566
- #define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0x1FFFFFFFFFFFFF)
1567
-
1568
- /**
1569
- * Number.MIN_SAFE_INTEGER
1570
- *
1571
- * See also: ECMA_262 v6, 20.1.2.8
1572
- */
1573
- #define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0x1FFFFFFFFFFFFF)
1574
- #endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
1575
-
1576
- /**
1577
- * Euler number
1578
- */
1579
- #define ECMA_NUMBER_E ((ecma_number_t) 2.7182818284590452354)
1580
-
1581
- /**
1582
- * Natural logarithm of 10
1583
- */
1584
- #define ECMA_NUMBER_LN10 ((ecma_number_t) 2.302585092994046)
1585
-
1586
- /**
1587
- * Natural logarithm of 2
1588
- */
1589
- #define ECMA_NUMBER_LN2 ((ecma_number_t) 0.6931471805599453)
1590
-
1591
- /**
1592
- * Logarithm base 2 of the Euler number
1593
- */
1594
- #define ECMA_NUMBER_LOG2E ((ecma_number_t) 1.4426950408889634)
1595
-
1596
- /**
1597
- * Logarithm base 10 of the Euler number
1598
- */
1599
- #define ECMA_NUMBER_LOG10E ((ecma_number_t) 0.4342944819032518)
1600
-
1601
- /**
1602
- * Pi number
1603
- */
1604
- #define ECMA_NUMBER_PI ((ecma_number_t) 3.1415926535897932)
1605
-
1606
- /**
1607
- * Square root of 0.5
1608
- */
1609
- #define ECMA_NUMBER_SQRT_1_2 ((ecma_number_t) 0.7071067811865476)
1610
-
1611
- /**
1612
- * Square root of 2
1613
- */
1614
- #define ECMA_NUMBER_SQRT2 ((ecma_number_t) 1.4142135623730951)
1426
+ #define ECMA_NUMBER_MINUS_ONE ((ecma_number_t) -1.0f)
1615
1427
1616
1428
/**
1617
1429
* Maximum number of characters in string representation of ecma-number
0 commit comments