+ 1

Can't import kotlin.math methods.

Title says it all, example at https://code.sololearn.com/cYo4WM2A3cl4/?ref=app. I've tried using java.lang.Math.round(), then casting to Int, but that doesn't work either. Any workarounds?

14th Oct 2018, 2:49 AM
LunarCoffee
LunarCoffee - avatar
10 Answers
+ 4
SoloLearn doesn't as yet support 1.2 library features.
11th Nov 2018, 5:12 PM
John Wells
John Wells - avatar
+ 3
John Wells Well that's quite unfortunate. Thanks for the answer, though!
12th Nov 2018, 4:21 AM
LunarCoffee
LunarCoffee - avatar
+ 2
I am not able to see the code for some reason can you post the code?
14th Oct 2018, 8:10 PM
Tanay
Tanay - avatar
+ 2
roundToInt() Basically all the math stuff.
23rd Oct 2018, 11:24 AM
LunarCoffee
LunarCoffee - avatar
+ 1
Tanay Dang. I basically just tried to import kotlin.math.roundToInt, and it didn't find the math package. Works in everything else I've tried, running in an IDE, running an artifact, and even running it on my phone.
14th Oct 2018, 8:23 PM
LunarCoffee
LunarCoffee - avatar
+ 1
what function are you going to call?
22nd Oct 2018, 7:47 PM
Mohsen Cadir
Mohsen Cadir - avatar
+ 1
call Math.round(<value>)
23rd Oct 2018, 3:52 PM
Mohsen Cadir
Mohsen Cadir - avatar
+ 1
what? it exists.
23rd Oct 2018, 4:05 PM
Mohsen Cadir
Mohsen Cadir - avatar
0
That's what I'm doing for a replacement. I was just wondering why the Kotlin standard library seemed to not exist.
23rd Oct 2018, 3:57 PM
LunarCoffee
LunarCoffee - avatar
0
Not to Sololearn, at least. Doesn't matter too much, I usually just dump codes here for a tertiary backup if it's not a web code or challenge code.
24th Oct 2018, 2:55 AM
LunarCoffee
LunarCoffee - avatar