/mobile Handheld Friendly website

 performance measurements

Each table row shows performance measurements for this Scala program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
2,000Failed  355   

Read the ↓ make, command line, and program output logs to see how this program was run.

Read pidigits benchmark to see what this program should do.

 notes

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

Scala compiler version 2.10.3 -- Copyright 2002-2013, LAMP/EPFL

 pidigits Scala program source code

/* 
 * The Computer Language Benchmarks Game
 * http://benchmarksgame.alioth.debian.org/
 * contributed by Joseph Tang
*/

import math._

def pi(n: Int) = {
  val pr = 1.0 / pow(10, n)
  def t(initial: BigDecimal = 2, i: Int = 0): Int = {
    val current = (i + 1) * 1.0 / (2 * i + 3) * initial
    if (current < pr) i else t(current, i + 1)
  }
  val ts = t()
  def calPi(i: Int): BigDecimal = if (i > ts) 2.5 else 2 + i * calPi(i + 1) / (2 * i + 1)
  calPi(1)
}

def p10(s: String, offset: Int = 0) {
  val (s1, r) = s.splitAt(10)
  println(s"$s1\t:${offset + s1.length}")
  if (!r.isEmpty) p10(r, 10 + offset)
}

val n = if (args.isEmpty) 27 else args(0).toInt
p10(pi(n).toString().filterNot(_ == '.').substring(0, n))

 make, command-line, and program output logs

Wed, 19 Mar 2014 02:43:58 GMT

MAKE:
mv pidigits.scala pidigits.scala
mv: ‘pidigits.scala’ and ‘pidigits.scala’ are the same file
make: [pidigits.scala_run] Error 1 (ignored)
/usr/local/src/scala-2.10.3/bin/scalac -optimise -target:jvm-1.7 pidigits.scala
pidigits.scala:9: error: expected class or object definition
def pi(n: Int) = {
^
pidigits.scala:20: error: expected class or object definition
def p10(s: String, offset: Int = 0) {
^
pidigits.scala:26: error: expected class or object definition
val n = if (args.isEmpty) 27 else args(0).toInt
^
pidigits.scala:27: error: expected class or object definition
p10(pi(n).toString().filterNot(_ == '.').substring(0, n))
^
four errors found
make: [pidigits.scala_run] Error 1 (ignored)
1.27s to complete and log all make actions

COMMAND LINE:
 /usr/local/src/jdk1.8.0/bin/java -server -XX:+TieredCompilation -XX:+AggressiveOpts -Djava.library.path=Include/java -Xbootclasspath/a:/usr/local/src/scala-2.10.3/lib/scala-library.jar:/usr/local/src/scala-2.10.3/lib/akka-actors.jar:/usr/local/src/scala-2.10.3/lib/typesafe-config.jar pidigits 2000

PROGRAM FAILED 


PROGRAM OUTPUT:

Error: Could not find or load main class pidigits

Revised BSD license

  Home   Conclusions   License   Play