Created
April 7, 2020 21:57
-
-
Save uberto/3fd668beea2bde0b4f85e3f37901a166 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.Math.round as jround | |
import kotlin.math.round | |
fun main() { | |
val r = round(4.5) + round(9.5) | |
println("kotlin round 4.5+9.5 $r") | |
val r2 = round(5.5) + round(9.5) | |
println("kotlin round 5.5+9.5 $r2") | |
val r3 = jround(4.5) + jround(9.5) | |
println("java round 4.5+9.5 $r3") | |
val r4 = jround(5.5) + jround(9.5) | |
println("java round 5.5+9.5 $r4") | |
val r5 = round(-4.5) + round(-9.5) | |
println("kotlin round 4.5+9.5 $r5") | |
val r6 = jround(-4.5) + jround(-9.5) | |
println("java round -4.5-9.5 $r6") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment