Subject: Re: Benchmarking scientific Java

From: "Fred J. Tydeman" <[email-masked]>
Date: Wed, 19 Feb 97 20:02:27 +0100

/*
 * Benchmark of accuracy of sine() function with exact integer arguments.
 *
 * This is based upon part of the test of sine() in the C9X Floating-Point
 * C Extensions (FPCE) Test Suite.  The C language is being revised and
 * we hope to be done by 1999, hence the name C9X.  FPCE is one of the
 * major additions to C9X and it came from the Numerical C Extensions Group
 * (NCEG).  For information:  ftp://ftp.netcom.com/pub/ty/tydeman/readme.1st
 *
 * I would be interested in how various Java implementations do with
 * respect to this test.  On my OS/2 Warp with IBM's beta Java, all but
 * the last test have no error.  On a friends Windows NT 4 with Microsoft's
 * Java, there are 7 bit or 128 ULP errors with argument of 355.
 *
 * -- Fred Tydeman, [email-masked], Voting member of X3J11 (ANSI "C")
 */

import java.lang.Math;  /* sin() */

class fpcesin2 {
    static final double tests[][] = {
      { 3.,  0.1411200080598672221007448028081102798469 },
      { 22.,  -0.008851309290403875921690256815772332463289 },
      { 333.,  -0.008821166113885877006219004546656019816162 },
      { 355.,  -3.014435335948844921433028000865009959025e-5 },
      { 1.03993e5,  -1.912933577842375022430719872695874427491e-5 },
      { 1.04348e5,  -1.101501758424055688621168230459696452484e-5 },
      { 2.08341e5,  8.114318195038077209773327760926281832092e-6 },
      { 3.12689e5,  2.900699389332111000449710765980492315487e-6 },
      { 8.33719e5,  2.312919416452701500600480039068230636020e-6 },
      { 1.146408e6,  -5.877799728813812324370607306023798567022e-7 },
      { 4.272943e6,  -5.495794978104908005031386643096134921349e-7 },
      { 5.419351e6,  -3.820047507089660191845987249928614346965e-8 },
      { 8.0143857e7,  -1.477284681796590864991624557530997292064e-8 },
      { 1.65707065e8,  -8.654781434964792726759985393635564874554e-9 },
      { 2.45850922e8,  6.118065383001116314271210985987376942726e-9 },
      { 4.11557987e8,  2.536716051963676479648989773970813487609e-9 },
      { 1.068966896e9,  1.044633279073763387509311412084278779982e-9 },
      { 2.549491779e9,  4.474494938161497069560455111766419779553e-10 },
      { 6.167950454e9,  1.497342914414639737567936196228910303780e-10 },
      { 1.4885392687e10,  1.479809109332217594557298722864333901077e-10 },
      { 2.1053343141e10,  1.753380508242214301083172878538645332641e-12 },
      { 1.783366216531e12,  6.969482408757581652833645960277770161352e-13 },
      { 3.587785776203e12,  3.594840264906979705164444643115730410274e-13 },
      { 5.371151992734e12,  -3.374642143850601947669201739906430603344e-13 },
      { 8.958937768937e12,  -2.201981210563777574952429165657465404519e-14 },
      { 1.39755218526789e14,  -7.167032800493558524055805520458585525531e-15 },
      { 4.28224593349304e14,  5.187137041571001773568750967942675321726e-16 },
      { 5.706674932067741e15,  4.237546464512562184164292621941499265244e-16 },
      { 6.134899525417045e15,  9.495905770584395894044583460012804199730e-17 },
    };
  public static void main(String args[]){
    double arg;
    double res;
    int i;

    for( i=0; i<tests.length; i++ ){
      arg = tests[i][0];
      res = Math.sin(arg);
      System.out.println("sin(" + arg + ") is " + res + "; diff is " + (res-tests[i][1]));
    }/* for */
  }/* main */
}/* class fpcesin2 */

---
Fred J. Tydeman    +49 (7031) 288-964  Tydeman Consulting
Meisenweg 20       [email-masked]   Programming, testing, C/C++ training
D-71032 Boeblingen                     Voting member of X3J11 (ANSI "C")
Germany            Sample FPCE tests:  ftp://ftp.netcom.com/pub/ty/tydeman

---

From: Dave Brillhart - SMCC SE - Orlando <[email-masked]>
Date: Wed, 19 Feb 1997 09:59:08 -0500 (EST)

> From: "Dan E. Kelley" <[email-masked]
> Subject: Re: Benchmarking scientific Java
>
> The main exception at present seems to be the lack of a suite of
> object libraries for such things as matrix operations, mathematical
> operations including optimization and differential equation solution,
> etc.  Such things exist in several forms in the C, C++ and FORTRAN
> (yup, I said I was a scientist!) worlds, and in the increasingly
> popular matlab community.

Have you seen the 12/23 issue of EE Times?  The first item listed
under their "What's Hot" column is mediaLib...

MULTIMEDIA MADE EASY
Sun Microelectronics has unveiled mediaLib, a software library for
easing the task of writing optimized multimedia applications.  The
library comes in two versions:  one for Sun's VIS multimedia
instruction set for Sparc, and a generic version for use with other
architectures.  mediaLib implements algorithms for linear algebra,
image processing, signal processing, and graphics.  Access
http://www.sun.com/sparc/vis/mediaLib.html for more information.

> I've read that java is 15 times slower than C++. Given a doubling of
> computing power every 1.5 years,

Stay tuned... JIT compilers and other advancements are very quickly
closing the gap - if one still exists - between Java applications and
C++. Moore's Law appies to raw H/W advances - how much "work" a CPU
can get done per time unit. It does not address compiler optimization
advances, which are occuring almost daily in the Java space.

> I've read that java is 15 times slower than C++. Given a doubling of
> computing power every 1.5 years,

Best Regards,

-- Dave
      ______
     /_____/\      Dave Brillhart - Systems Engineer
    /____ \\ \     Sun Microsystems Incorporated, SMCC
   /_____\ \\ /    3504 Lake Lynda Drive, Suite 410
  /_____/ \/ / /   Orlando, Florida 32817
 /_____/ /   \//\
 \_____\//\   / /  Voice/Pager:   407-384-4644/800-314-1259
  \_____/ / /\ /   E-mail:        [email-masked]
   \_____/ \\ \    Urgent E-Mail: [email-masked]
    \_____\ \\     Internal URL:  http://turbo.east/~dave
     \_____\/