Created
April 7, 2020 21:57
-
-
Save uberto/a68a00a2290a520f21dfc322bc74e16e 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