diff options
Diffstat (limited to 'src/main/kotlin/Extensions.kt')
| -rw-r--r-- | src/main/kotlin/Extensions.kt | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/main/kotlin/Extensions.kt b/src/main/kotlin/Extensions.kt index 8c11af1..5678a48 100644 --- a/src/main/kotlin/Extensions.kt +++ b/src/main/kotlin/Extensions.kt @@ -1,11 +1,9 @@ -fun Double.sine(): Double { - return kotlin.math.sin(toRadians(this)) -} +fun Double.toRadians() = this * kotlin.math.PI / 180 -fun Double.cosine(): Double { - return kotlin.math.cos(toRadians(this)) -} +fun Double.sine() = kotlin.math.sin(this.toRadians()) -fun Double.toFlooredInt(): Int { - return kotlin.math.floor(this).toInt() -}
\ No newline at end of file +fun Double.cosine() = kotlin.math.cos(this.toRadians()) + +fun Double.toFlooredInt() = kotlin.math.floor(this).toInt() + +fun Double.toRoundedString() = this.asDynamic().toFixed(2) as String
\ No newline at end of file |