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
This commit is contained in:
@@ -153,6 +153,8 @@ KDouble Kotlin_math_round(KDouble x) { return rint(x); }
|
||||
|
||||
KDouble Kotlin_math_abs(KDouble x) { return fabs(x); }
|
||||
|
||||
KDouble Kotlin_math_cbrt(KDouble x) { return cbrt(x); }
|
||||
|
||||
// extensions
|
||||
|
||||
KDouble Kotlin_math_Double_pow(KDouble thiz, KDouble x) {
|
||||
@@ -228,6 +230,8 @@ KFloat Kotlin_math_roundf(KFloat x) { return rintf(x); }
|
||||
|
||||
KFloat Kotlin_math_absf(KFloat x) { return fabsf(x); }
|
||||
|
||||
KFloat Kotlin_math_cbrtf(KFloat x) { return cbrtf(x); }
|
||||
|
||||
// extensions
|
||||
|
||||
KFloat Kotlin_math_Float_pow(KFloat thiz, KFloat x) {
|
||||
@@ -311,6 +315,8 @@ KDouble Kotlin_math_abs(KDouble x) { RETURN_RESULT_OF_JS_CALL(knjs__Math_abs,
|
||||
KDouble Kotlin_math_atan2(KDouble y, KDouble x) { RETURN_RESULT_OF_JS_CALL2(knjs__Math_atan2, y, x); }
|
||||
KDouble Kotlin_math_hypot(KDouble x, KDouble y) { RETURN_RESULT_OF_JS_CALL2(knjs__Math_hypot, x, y); }
|
||||
|
||||
KDouble Kotlin_math_cbrt(KDouble x) { RETURN_RESULT_OF_JS_CALL(knjs__Math_cbrt, x); }
|
||||
|
||||
// extensions
|
||||
|
||||
KDouble Kotlin_math_Double_pow(KDouble thiz, KDouble x) { RETURN_RESULT_OF_JS_CALL2(knjs__Math_pow, thiz, x); }
|
||||
@@ -406,6 +412,8 @@ KFloat Kotlin_math_absf(KFloat x) { return (KFloat)Kotlin_math_abs (x); }
|
||||
KFloat Kotlin_math_atan2f(KFloat y, KFloat x) { return (KFloat)Kotlin_math_atan2(y, x); }
|
||||
KFloat Kotlin_math_hypotf(KFloat x, KFloat y) { return (KFloat)Kotlin_math_hypot(x, y); }
|
||||
|
||||
KDouble Kotlin_math_cbrtf(KFloat x) { return (KFloat)Kotlin_math_cbrt(x); }
|
||||
|
||||
// extensions
|
||||
|
||||
KFloat Kotlin_math_Float_pow(KFloat thiz, KFloat x) { return (KFloat)Kotlin_math_Double_pow(thiz, x); }
|
||||
@@ -504,6 +512,8 @@ KDouble Kotlin_math_round(KDouble x) { NotImplemented(); }
|
||||
|
||||
KDouble Kotlin_math_abs(KDouble x) { NotImplemented(); }
|
||||
|
||||
KDouble Kotlin_math_cbrt(KDouble x) { NotImplemented(); }
|
||||
|
||||
// extensions
|
||||
|
||||
KDouble Kotlin_math_Double_pow(KDouble thiz, KDouble x) { NotImplemented(); }
|
||||
@@ -551,6 +561,8 @@ KFloat Kotlin_math_roundf(KFloat x) { NotImplemented(); }
|
||||
|
||||
KFloat Kotlin_math_absf(KFloat x) { NotImplemented(); }
|
||||
|
||||
KFloat Kotlin_math_cbrtf(KFloat x) { NotImplemented(); }
|
||||
|
||||
// extensions
|
||||
|
||||
KFloat Kotlin_math_Float_pow(KFloat thiz, KFloat x) { NotImplemented(); }
|
||||
|
||||
Reference in New Issue
Block a user