Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
9
Task/Variable-size-Get/Scala/variable-size-get.scala
Normal file
9
Task/Variable-size-Get/Scala/variable-size-get.scala
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
def nBytes(x: Double) = ((Math.log(x) / Math.log(2) + 1e-10).round + 1) / 8
|
||||
|
||||
val primitives: List[(Any, Long)] =
|
||||
List((Byte, Byte.MaxValue),
|
||||
(Short, Short.MaxValue),
|
||||
(Int, Int.MaxValue),
|
||||
(Long, Long.MaxValue))
|
||||
|
||||
primitives.foreach(t => println(f"A Scala ${t._1.toString.drop(13)}%-5s has ${nBytes(t._2)} bytes"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue