Commit Graph

68 Commits

Author SHA1 Message Date
Igor Yakovlev 3e9b2573c5 [Wasm/std] Fix invalid sign for FP rem operator
Fixed #KT-64829
2024-01-24 15:40:48 +00:00
Romain Guy 02a3915fdf KT-48232: Implement kotlin.math.cbrt() (cubic roots)
cbrt() is the standard cubic root function that provides several advantages over pow(x, 1.0/3.0):
- Better precision
- Faster
- Behaves better with negative values
2022-06-16 20:27:43 +03:00
Alexander Korepanov d584cfc31d Remove workaround for KT-45620 from NumbersTest.kt. 2022-01-28 17:10:01 +00:00
Alexander Udalov 3bc0eaff59 Fix warnings in stdlib samples and test modules 2021-08-10 17:57:50 +02:00
Ilya Gorbunov d062f54360 Remove test exclusions after KT-45136 is fixed 2021-04-09 06:45:11 +03:00
Ilya Gorbunov b64b96eee6 Deprecate Char-to-Number conversions in stdlib (JVM and JS)
- Int.toChar was left non-deprecated because the replacement is not intrinsic yet.
- Number.toChar was left non-deprecated because otherwise the deprecation propagates to the override, Int.toChar.

KT-23451
2021-04-07 18:30:20 +03:00
Dmitriy Dolovov 9aa16faa27 Test integer overflow on div/rem of Int.MIN_VALUE by -1
^KT-45136
2021-03-24 09:55:52 +03:00
Ilya Gorbunov 50d4979531 Floor division and remainder for numeric types KT-26234
- floorDiv/mod for unsigned types
- floorDiv/mod for signed types
- mod for floating point types

- mod return type: same as divisor for integer types

- Update JS API dump
- Avoid triggering division overflow in tests due to K/N
- Workaround failing test in JS-legacy
2021-03-05 07:32:16 +03:00
Ilya Gorbunov ca6ce151a2 Unify test package names in kotlin-stdlib tests
This makes 'test.' an implicit package prefix, thus fixing the inspection
"Package directive doesn't match file location" positive in almost all
test files.
2021-02-25 09:58:14 +03:00
Abduqodiri Qurbonzoda 36e6247125 Add more details about bit shift operations #KT-41112 2020-09-16 04:05:12 +03:00
Abduqodiri Qurbonzoda 846a7823ad Introduce minOrNull and maxOrNull extension functions #KT-39064 2020-06-19 04:53:49 +03:00
Ilya Gorbunov b4ba00ca36 Document and test NaN propagation of maxOf/minOf
Also simplify minOf/maxOf implementations

#KT-38708
2020-06-02 19:01:44 +03:00
Ilya Gorbunov a225842f9b Test that known Floats can fit in FloatArray without over/underflow
But some precision loss can still happen in JS.

Relates to KT-24975
2020-04-02 04:04:04 +03:00
Ilya Gorbunov d88d2cb058 Test new Double/Float constants
Split test expectations based on actual support of enforced Float range

KT-29182, KT-13887
2020-04-02 04:04:04 +03:00
Abduqodiri Qurbonzoda 1f721796b8 Add vararg overloads for maxOf/minOf functions #KT-33906 2020-02-26 04:17:19 +03:00
Ilya Gorbunov bbdbc2896b Workaround in FloatMathTest.powers to avoid failures with js-ir runtime
Include kotlin-stdlib-js-ir in local core libs build/test and
enable failing build on test failures.

Relates to: KT-24975
2019-10-16 17:48:47 +03:00
Abduqodiri Qurbonzoda 01a613dca4 Add tests for floating-point to integral conversion 2019-08-15 00:57:27 +03:00
Ilya Gorbunov f8724654a1 Bit query and bit rotation functions for Int, Long, Short, Byte
#KT-12749
2019-07-08 19:09:32 +03:00
nikita.movshin 65244b4bea Update copyright.
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
Update only 2 lines copyright.
2019-04-23 20:09:22 +03:00
Pavel Punegov f543170998 Increase tolerance for Float asin test 2018-10-10 19:05:44 +03:00
Alexander Udalov 55c8b35eee Remove unneeded default imports in stdlib and tests 2018-10-01 13:39:02 +02:00
Ilya Gorbunov 8f6d2b70a9 Add stdlib test for Boolean companion 2018-08-30 14:55:48 +03:00
Ilya Gorbunov 5f3a7f0147 Use Char.MIN_VALUE and MAX_VALUE in tests 2018-08-30 14:55:45 +03:00
Ilya Gorbunov 92e149fa40 Add tests for SIZE_BYTES and SIZE_BITS constants
#KT-8247 Fixed
2018-08-30 14:55:43 +03:00
Ilya Gorbunov cbc3480d9e Split common builtin companion tests from JVM-only tests
Remove duplicated tests from NumbersJVMTest.
2018-07-03 19:58:53 +03:00
Ilya Gorbunov ecf0d7ec0d Reformat stdlib tests and samples
#KT-5558
2018-04-27 05:28:57 +03:00
Ilya Gorbunov e21c235bbb Add or update copyrights in the standard library sources 2018-04-26 21:57:50 +03:00
Ilya Gorbunov 9b38e5e7b5 stdlib tests: move JVM-only test source files 2018-04-12 17:53:00 +03:00
Anton Bannykh ed80252ba8 JS: fix double compareTo behaviour for NaN and +-0 (KT-22723) 2018-02-28 15:01:58 +03:00
Ilya Gorbunov 20b122c1dd Use kotlin.test.Test instead of org.junit.Test in common stdlib tests
(and in jvm-only and js-only tests also)
2017-10-15 17:40:53 +03:00
Ilya Gorbunov 0454bd9e28 Detect endianness when reinterpreting Float64 as two Int32
#KT-18264

Use Int32Array instead of Uint32Array since ints are required to be singed.
2017-10-11 19:20:24 +03:00
Ilya Gorbunov aa3bfc55c3 Implement in JS nextUp(), nextDown(), nextTowards() and ulp extensions
#KT-4900
2017-10-11 19:20:24 +03:00
Ilya Gorbunov 480d4a0093 Make withSign(NaN) behave as in JVM
#KT-4900

Where only the sign of the result is undefined, but the absolute value is unchanged.
2017-10-11 19:20:24 +03:00
Ilya Gorbunov 132f2f88c2 Provide Double and Float bit conversion functions as extensions in JS and Common
Instance extension: Double/Float.toBits/toRawBits
Companion extension: Double/Float.Companion.fromBits

#KT-18264 Fixed
2017-10-11 19:20:24 +03:00
Ilya Gorbunov 044ccf1532 Introduce inverse hyperbolic functions
#KT-4900

Improve accuracy of JS polyfills of hyperbolic functions and expm1/log1p
2017-10-11 19:20:24 +03:00
Ilya Gorbunov 86b23ffe49 Integer math functions and tests for them
#KT-4900
2017-10-11 19:20:24 +03:00
Ilya Gorbunov a832db48f6 Float Math API
#KT-4900
2017-10-11 19:20:24 +03:00
Ilya Gorbunov f3ea499d2c JVM-specific math functions and tests
#KT-4900
2017-10-11 19:20:24 +03:00
Ilya Gorbunov 7e48f8b180 Provide Double and Float bit conversion functions as extensions
Instance extension: Double/Float.toBits/toRawBits
Companion extension: Double/Float.Companion.fromBits

 #KT-18264 Fixed
2017-10-11 19:20:24 +03:00
Ilya Gorbunov 6373ac7ef0 Rename log to ln, log1p to ln1p, keep pow only as extension
#KT-4900
2017-10-11 19:20:24 +03:00
Ilya Gorbunov 805d1c90b7 Rename sgn to sign, add docs and tests
#KT-4900
2017-10-11 19:20:24 +03:00
Ilya Gorbunov d0b12e3872 Use HALF_EVEN rounding mode for round()
Add docs and tests for rounding.

 #KT-4900
2017-10-11 19:20:24 +03:00
Ilya Gorbunov 5e9e6d5951 Common math tests and document for trigonometric functions and powers.
#KT-4900
2017-10-11 19:20:24 +03:00
Ilya Gorbunov c2cee2e405 Update binary api dump, rearrage bignumbers tests 2017-10-11 19:20:24 +03:00
Ilya Gorbunov b89e5b2708 Add missing api: radix overloads, mathContext and scale overloads, orNull overloads
Move string-to-number conversions and their tests near to existing ones

Add documentation and copyrights.
2017-10-11 19:20:24 +03:00
voddan e86e080088 KEEP-49: extending Kotlin API for BigInteger and BigDecimal 2017-10-11 19:20:24 +03:00
Ilya Gorbunov 6ae19e03d5 Clean warnings and refactor stdlib tests.
Merge RangeJVMTest into RangeTest.
2017-04-18 18:51:20 +03:00
Ilya Gorbunov 897e9658ac Do not run total order tests on JS 2017-01-11 14:45:19 +03:00
Ilya Gorbunov 74331f8eaa Add NaN propagation and total ordering tests. 2017-01-11 14:45:16 +03:00
Ilya Gorbunov c43e4f6682 Uncomment some assertions for overflow behavior that now can pass in JS 2016-12-23 18:14:32 +03:00