public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* RFC: Test for java.lang.StrictMath#cbrt
@ 2006-07-14 21:00 Carsten Neumann
  2006-07-14 21:14 ` Tom Tromey
  2006-07-20 19:23 ` Carsten Neumann
  0 siblings, 2 replies; 3+ messages in thread
From: Carsten Neumann @ 2006-07-14 21:00 UTC (permalink / raw)
  To: mauve-patches

[-- Attachment #1: Type: text/plain, Size: 425 bytes --]


	Hi,

attached is a new test for the cbrt method of StrictMath.
This file should probably be placed as
gnu/testlet/java/lang/StrictMath/cbrt.java
which I can't add since I don't have write access to the cvs, hence this
is not a proper patch, just the file, sorry.

Please comment and/or commit.

	Thanks,
		Carsten

2006-07-14  Carsten Neumann  <cn-develop@gmx.net>

	* gnu/testlet/java/lang/StrictMath/cbrt.java: New test.

[-- Attachment #2: cbrt.java --]
[-- Type: text/x-java, Size: 2212 bytes --]

// Tags: JDK1.5

//  Copyright (C) 2006 Carsten Neumann <cn-develop@gmx.net>

//  This file is part of Mauve.

//  Mauve is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2, or (at your option)
//  any later version.

//  Mauve is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.

//  You should have received a copy of the GNU General Public License
//  along with Mauve; see the file COPYING.  If not, write to
//  the Free Software Foundation, 59 Temple Place - Suite 330,
//  Boston, MA 02111-1307, USA.

package gnu.testlet.java.lang.StrictMath;

import gnu.testlet.Testlet;
import gnu.testlet.TestHarness;

public class cbrt implements Testlet
{
  // some values to test cbrt
  private static double[] inputValues =
    {
      0.0,
      Double.NaN,
      Double.POSITIVE_INFINITY,
      Double.NEGATIVE_INFINITY,
      123456789e-9,
      -123456789e-6,
      123456789e+2,
      -123456789e+4,
      987654321e-7,
      -987654321e-4,
      987654321e+3,
      -987654321e+5,
      1234509876e-320,  // subnormal number
      9756272385e-325,  // subnormal number
      Math.PI,
      Math.E
    };

  // expected output - obtained from the reference implementation
  private static double[] outputValues =
    {
      0.0,
      Double.NaN,
      Double.POSITIVE_INFINITY,
      Double.NEGATIVE_INFINITY,
      0.49793385921817446,
      -4.979338592181745,
      2311.204240824796,
      -10727.659796410873,
      4.622408495690158,
      -46.224084956901585,
      9958.677214612972,
      -46224.08495690158,
      2.3111680380625372e-104,
      9.918088333941088e-106,
      1.4645918875615231,
      1.3956124250860895
    };

  public void test(TestHarness harness)
  {
    double res;

    for (int i = 0; i < inputValues.length; ++i)
      {
	res = StrictMath.cbrt(inputValues[i]);

	// exact equality is appropriate for StrictMath
	harness.check(res, outputValues[i]);
      }
  }
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFC: Test for java.lang.StrictMath#cbrt
  2006-07-14 21:00 RFC: Test for java.lang.StrictMath#cbrt Carsten Neumann
@ 2006-07-14 21:14 ` Tom Tromey
  2006-07-20 19:23 ` Carsten Neumann
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2006-07-14 21:14 UTC (permalink / raw)
  To: Carsten Neumann; +Cc: mauve-patches

>>>>> "Carsten" == Carsten Neumann <cn-develop@gmx.net> writes:

Carsten> Please comment and/or commit.

Let's set you up with commit access so you can check it in yourself.

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFC: Test for java.lang.StrictMath#cbrt
  2006-07-14 21:00 RFC: Test for java.lang.StrictMath#cbrt Carsten Neumann
  2006-07-14 21:14 ` Tom Tromey
@ 2006-07-20 19:23 ` Carsten Neumann
  1 sibling, 0 replies; 3+ messages in thread
From: Carsten Neumann @ 2006-07-20 19:23 UTC (permalink / raw)
  To: mauve-patches

[-- Attachment #1: Type: text/plain, Size: 634 bytes --]

	Hi,

i commited this on 2006-07-20 as

2006-07-20  Carsten Neumann  <cn-develop@gmx.net>

	* gnu/testlet/java/lang/StrictMath/cbrt.java: New test.

Carsten Neumann wrote:
> 	Hi,
> 
> attached is a new test for the cbrt method of StrictMath.
> This file should probably be placed as
> gnu/testlet/java/lang/StrictMath/cbrt.java
> which I can't add since I don't have write access to the cvs, hence this
> is not a proper patch, just the file, sorry.
> 
> Please comment and/or commit.
> 
> 	Thanks,
> 		Carsten
> 
> 2006-07-14  Carsten Neumann  <cn-develop@gmx.net>
> 
> 	* gnu/testlet/java/lang/StrictMath/cbrt.java: New test.
> 
> 

[-- Attachment #2: java.lang.StrictMath.cbrt-2006-07-20.diff --]
[-- Type: text/x-patch, Size: 2698 bytes --]

Index: gnu/testlet/java/lang/StrictMath/cbrt.java
===================================================================
RCS file: gnu/testlet/java/lang/StrictMath/cbrt.java
diff -N gnu/testlet/java/lang/StrictMath/cbrt.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/lang/StrictMath/cbrt.java	20 Jul 2006 19:16:06 -0000
@@ -0,0 +1,87 @@
+// Tags: JDK1.5
+
+//  Copyright (C) 2006 Carsten Neumann <cn-develop@gmx.net>
+
+//  This file is part of Mauve.
+
+//  Mauve is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2, or (at your option)
+//  any later version.
+
+//  Mauve is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+
+//  You should have received a copy of the GNU General Public License
+//  along with Mauve; see the file COPYING.  If not, write to
+//  the Free Software Foundation, 59 Temple Place - Suite 330,
+//  Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.lang.StrictMath;
+
+import gnu.testlet.Testlet;
+import gnu.testlet.TestHarness;
+
+public class cbrt implements Testlet
+{
+  /**
+   * These values are used as arguments to cbrt.
+   */
+  private static double[] inputValues =
+    {
+      0.0,
+      Double.NaN,
+      Double.POSITIVE_INFINITY,
+      Double.NEGATIVE_INFINITY,
+      123456789e-9,
+      -123456789e-6,
+      123456789e+2,
+      -123456789e+4,
+      987654321e-7,
+      -987654321e-4,
+      987654321e+3,
+      -987654321e+5,
+      1234509876e-320,  // subnormal number
+      9756272385e-325,  // subnormal number
+      Math.PI,
+      Math.E
+    };
+
+  /**
+   * These values are the expected results, obtained from the RI.
+   */
+  private static double[] outputValues =
+    {
+      0.0,
+      Double.NaN,
+      Double.POSITIVE_INFINITY,
+      Double.NEGATIVE_INFINITY,
+      0.49793385921817446,
+      -4.979338592181745,
+      2311.204240824796,
+      -10727.659796410873,
+      4.622408495690158,
+      -46.224084956901585,
+      9958.677214612972,
+      -46224.08495690158,
+      2.3111680380625372e-104,
+      9.918088333941088e-106,
+      1.4645918875615231,
+      1.3956124250860895
+    };
+
+  public void test(TestHarness harness)
+  {
+    double res;
+
+    for (int i = 0; i < inputValues.length; ++i)
+      {
+	res = StrictMath.cbrt(inputValues[i]);
+
+	// exact equality seems appropriate for StrictMath
+	harness.check(res, outputValues[i]);
+      }
+  }
+}

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-07-20 19:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-14 21:00 RFC: Test for java.lang.StrictMath#cbrt Carsten Neumann
2006-07-14 21:14 ` Tom Tromey
2006-07-20 19:23 ` Carsten Neumann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).