fptest.c revision 60c45ed01d4f99571d468c42f609d11a099fab1e
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc.
* All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __lint
#endif
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <sys/dditypes.h>
#include <sys/ddidmareq.h>
#include <sys/ddi_impldefs.h>
#include <sys/processor.h>
#include <time.h>
#include <kstat.h>
#include <fp.h>
#include <fptest.h>
#include <fpstestmsg.h>
#include <externs.h>
#include <fps_ereport.h>
#include <fps_defines.h>
#define GetBoxStringLen SYS_NMLN
#define NANO_IN_MILI 1000000
#define MILI_IN_SEC 1000
#define str_v9 "sparcv9"
#define str_v9b "sparcv9+vis2"
#define testname "fptest"
static int fps_exec_time = 0;
static int fps_verbose_msg = 0;
static int fpu_cpu = -1;
static int test_group = 1;
static int stress_level = 1;
static int limit_group = 1;
static int proc_fr;
static int lowstresslapagroup_len;
static int lowstresslapagroup1000_len;
static int lowstresslapagroup1500_len;
static int lowstresslapagroup2000_len;
static int medstresslapagroup_len;
static int highstresslapagroup_len;
static struct LapaGroup *lowstresslapagroup;
static int check_proc(int cpu_id);
static int start_testing(int unit,
struct fps_test_ereport *report);
/*
* main(int argc, char *argv[])
* is the main entry into the test.
*/
int
{
int test_ret;
int procb;
int proc_setb;
int ret = 0;
static struct fps_test_ereport ereport_data;
/* these are % ( modulo ) values */
/* default frequency values */
proc_fr = 1000;
#ifdef V9B
#else
#endif
if (fpu_cpu < 0)
return (FPU_INVALID_ARG);
test_start = gethrtime();
if (procb) {
if ((pset_assign(PS_QUERY,
}
if (proc_setb) {
return (FPU_BIND_FAIL);
}
if (procb) {
return (FPU_BIND_FAIL);
}
}
/* start testing */
if (test_ret == FPU_FOROFFLINE) {
/*
* check bind and
* check if on supported plaform
*/
proc_used == PBIND_NONE) {
ret = FPU_BIND_FAIL;
ereport_data.is_valid_cpu = 0;
}
if (check_proc(fpu_cpu) != 0) {
ret = FPU_UNSUPPORT;
ereport_data.is_valid_cpu = 0;
}
if (ret != FPU_UNSUPPORT) {
!= 0)
else
}
}
if (fps_exec_time)
return (ret);
}
/*
* exe_time(hrtime_t timeStart, int unit)
* returns Execution time: H.M.S.Msec
*/
static void
{
long hour;
long minute;
long second;
long mili;
long dif_mili;
long mili_to_sec;
mili =
}
/*
* start_testing(int unit, int argc, char *argv[],
* struct fps_test_ereport *report) performs each sub-test
* sequentially and stores any failed test information in
* report.
*/
static int
{
int lim;
int sdclimit;
return (-1);
/*
* The non-lapack logic will be executed when -p 0 OR -p ALL
*/
/* turn on signal handlers */
(void) winitfp();
if (fpu_sysdiag(report) != 0) {
return (FPU_FOROFFLINE);
}
/* turn off signal handlers */
(void) restore_signals();
return (FPU_FOROFFLINE);
}
return (FPU_FOROFFLINE);
}
return (FPU_FOROFFLINE);
}
sdclimit = 100;
if (limit_group == 2)
sdclimit = 1000;
if (limit_group == 3)
sdclimit = 10000;
return (FPU_FOROFFLINE);
}
lim = 100;
if (limit_group == 2)
lim = 1000;
if (limit_group == 3)
lim = 100000;
return (FPU_FOROFFLINE);
}
return (FPU_FOROFFLINE);
}
return (FPU_FOROFFLINE);
}
#ifdef V9B
lim = 10;
if (limit_group == 2)
lim = 100;
if (limit_group == 3)
lim = 1000;
return (FPU_FOROFFLINE);
}
return (FPU_FOROFFLINE);
}
#endif
if (test_group == 0)
return (FPU_OK);
} /* end the non lapack area */
return (FPU_FOROFFLINE);
return (FPU_OK);
}
/*
* do_lapack(struct fps_test_ereport *report) calls the lapack
* tests and stores any error info into report.
*/
static int
{
int lapa_group_index;
int lapa_loop_stress;
int lapa_stress;
int lapa_loop;
int high_lim;
int low_lim;
switch (limit_group) {
case 1:
if (lapa_group_index <= 0)
lapa_group_index = 1;
if (test_group == 12345) {
low_lim = 1;
high_lim =
.limHigh;
}
break;
case 2:
if (lapa_group_index <= 0)
lapa_group_index = 1;
if (test_group == 12345) {
low_lim = 1;
high_lim =
.limHigh;
}
break;
case 3:
if (lapa_group_index <= 0)
lapa_group_index = 1;
if (test_group == 12345) {
low_lim = 1;
high_lim =
.limHigh;
}
/* hidden arg -s X */
if (stress_level > 4000) {
low_lim = 1;
}
break;
default:
low_lim = 100;
high_lim = 200;
break;
}
if (low_lim < 1)
low_lim = 101;
if (high_lim > 10000)
high_lim = 201;
if (lapa_stress > 999) {
if (lapa_loop_stress == 4000)
lapa_loop_stress = 4016;
if (lapa_loop_stress == 7000)
lapa_loop_stress = 7016;
if (lapa_loop_stress == 8000)
lapa_loop_stress = 8034;
return (-4);
return (-4);
}
break;
}
return (-4);
return (-4);
}
return (0);
}
/*
* spmath(int unit, struct fps_test_ereport *report)
* peforms basic tests of the arithmetic operations:
* +, -, *, and /. If any errors, they are stored in
* report.
*/
static int
{
char err_data[MAX_INFO_SIZE];
float a;
float ans;
float b;
float expect_ans;
a = 1.2345;
b = 0.9876;
#ifndef __lint
ans = a + b;
#endif
ans = a + b;
expect_ans = 2.2221000;
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = (a - b);
expect_ans = 0.2469000;
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = a * b;
expect_ans = 1.2191923;
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = a / b;
expect_ans = 1.2500000;
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = a + (a - b);
expect_ans = 1.4814000;
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = a - (a + b);
expect_ans = -(0.9876000);
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = a + (a * b);
expect_ans = 2.4536924;
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = a - (a * b);
expect_ans = 0.0153078;
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = a + (a / b);
expect_ans = 2.4844999;
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = a - (a / b);
if (ans != -(0.0155000)) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = a * (a + b);
expect_ans = 2.7431827;
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = a * (a - b);
expect_ans = 0.3047981;
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = a / (a + b);
expect_ans = 0.5555556;
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = a / (a - b);
expect_ans = 4.9999995;
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = a * (a / b);
expect_ans = 1.5431250;
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
ans = a / (a * b);
expect_ans = 1.0125557;
if (ans != expect_ans) {
"\nExpected: %.8f\nObserved: %.8f",
expect_ans, ans);
1, err_data);
return (-2);
}
}
return (0);
}
/*
* dpmath(int unit, struct fps_test_ereport *report)
* peforms basic tests of the arithmetic operations:
* +, -, *, and /. It also performs tests of cos,
* sine, tan, log, sqrt, and exp. If any errors,
* they are stored in report.
*/
static int
{
char err_data[MAX_INFO_SIZE];
double a;
double ans;
double b;
double expect_ans;
double expect_ans2;
double result;
double x;
a = 1.2345;
b = 0.9876;
ans = (a + b);
expect_ans = 2.222100000000000;
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = (a - b);
expect_ans = 0.246899999999999;
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = a * b;
expect_ans = 1.219192199999999;
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = a / b;
expect_ans = 1.249999999999999;
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = a + (a - b);
expect_ans = 1.481399999999999;
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = a - (a + b);
expect_ans = -(0.987600000000000);
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = a + (a * b);
expect_ans = 2.453692200000000;
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = a - (a * b);
expect_ans = 0.015307800000000;
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = a + (a / b);
expect_ans = 2.484500000000000;
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = a - (a / b);
expect_ans = -(0.015499999999999);
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = a * (a + b);
expect_ans = 2.743182449999999;
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = a * (a - b);
expect_ans = 0.304798049999999;
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = a / (a + b);
expect_ans = 0.555555555555555;
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = a / (a - b);
expect_ans = 5.000000000000002;
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = a * (a / b);
expect_ans = 1.543124999999999;
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
ans = a / (a * b);
expect_ans = 1.012555690562980;
if (ans != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, ans);
err_data);
return (-3);
}
}
/* Start Double Precision test of trg functions */
/* sin of values in the range of -2pi to +2pi */
expect_ans = -(0.000000000820413);
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = 1.0000000000000000;
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
#ifndef i86pc
"\nExpected: %.16f\nObserved: %.16f",
-0.000000000000000, result);
err_data);
return (-3);
}
#endif
}
expect_ans = 0.000000000410206;
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = -(1.0000000000000000);
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = 0.0000000000000000;
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = 1.0000000000000000;
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = -(0.000000000410206);
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = -(1.0000000000000000);
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = 0.000000000820143;
expect_ans2 = 0.00000000820143;
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
/* cos of values in the range of -2pi to +2pi */
expect_ans = 1.0000000000000000;
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = 0.000000000615310;
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = -(1.0000000000000000);
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = -(0.000000000205103);
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = 1.0000000000000000;
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = (-0.000000000205103);
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = (-1.0000000000000000);
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = 0.000000000615310;
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = 1.0000000000000000;
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
/* sin and cos of: pi/4, 3pi/4, 5pi/4 and 7pi/4 */
expect_ans = 0.707106781259062;
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = 0.707106780969002;
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = -(0.707106781549122);
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = -(0.707106780678942);
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = 0.707106781114032;
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = -(0.707106781404092);
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = -(0.707106780823972);
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
expect_ans = 0.707106781694152;
if (result != expect_ans) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, result);
err_data);
return (-3);
}
}
/* exponential */
x = exp(0.0);
expect_ans = 1.0000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = exp(1.0);
expect_ans = 2.718281828459045;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = exp(2.0);
expect_ans = 7.389056098930650;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = exp(5.0);
expect_ans = 148.413159102576600;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = exp(10.0);
expect_ans = 22026.465794806718000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = exp(-1.0);
expect_ans = 0.367879441171442;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = exp(-2.0);
expect_ans = 0.135335283236612;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = exp(-5.0);
expect_ans = 0.006737946999085;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = exp(-10.0);
expect_ans = 0.000045399929762;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = 1.0000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = 10.000000000000002;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
/* logarithms */
x = log(1.0);
expect_ans = 0.0000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = log(2.0);
expect_ans = 0.693147180559945;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = log(10.0);
expect_ans = 2.302585092994045;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = log(100.0);
expect_ans = 4.605170185988091;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = 0.0000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = 1.0000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = 10.0000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
/*
* These functions are supported by the 68881
* but not the FPA
*/
expect_ans = -(0.000000000820414);
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = 0.999999998564275;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = -(1.000000001025517);
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = -(0.000000000410207);
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = 0.999999999384690;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = -(1.000000000205103);
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = tan(0.0);
expect_ans = 0.000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = 1.000000000205103;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = -(0.999999999384690);
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = 0.000000000410207;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = 1.000000001025517;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = -(0.999999998564275);
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
expect_ans = 0.000000000820414;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = sqrt(0.0);
expect_ans = 0.000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = sqrt(1.0);
expect_ans = 1.000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = sqrt(4.0);
expect_ans = 2.000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = sqrt(9.0);
expect_ans = 3.000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = sqrt(16.0);
expect_ans = 4.000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = sqrt(25.0);
expect_ans = 5.000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = sqrt(36.0);
expect_ans = 6.000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = sqrt(49.0);
expect_ans = 7.000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = sqrt(64.0);
expect_ans = 8.000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = sqrt(81.0);
expect_ans = 9.000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
x = sqrt(100.0);
expect_ans = 10.000000000000000;
if (x != expect_ans) {
if (x < (expect_ans - DPMARGIN) ||
x > (expect_ans + DPMARGIN)) {
"\nExpected: %.16f\nObserved: %.16f",
expect_ans, x);
err_data);
return (-3);
}
}
return (0);
}
/*
* process_fpu_args(int argc, char *argv[])
* processes the args passed into main()
* and sets the appropriate global vars.
*/
static void
{
char l_buf[32];
char *px;
int opt;
switch (opt) {
case 'P': /* -p N or -p all or no -p */
case 'p':
test_group = -1;
test_group = 12345;
break;
}
test_group = -1;
}
if (test_group < 0) {
}
break;
case 'f': /* 1000,1500,2000 freq */
case 'F':
switch (proc_fr) {
case 1000 :
break;
case 1500 :
break;
case 2000 :
break;
default :
if (proc_fr < 1500) {
break;
} else if (proc_fr < 2000) {
break;
} else {
break;
}
}
}
break;
case 'd':
break;
case 'E':
case 'e':
fps_exec_time = 1;
break;
case 'V':
case 'v':
fps_verbose_msg = 1;
break;
case 'S':
case 's':
stress_level = 1;
l_buf[0] = 'E';
switch (l_buf[0]) {
case 'l':
case 'L':
case '1':
stress_level = 1;
limit_group = 1;
break;
case 'm':
case 'M':
case '2':
stress_level = 1000;
limit_group = 2;
break;
case 'h':
case 'H':
case '3':
stress_level = 4000;
limit_group = 3;
break;
case 'X':
stress_level = 10000;
limit_group = 3;
if ((0 == stress_level) ||
(stress_level > 10000) ||
(stress_level < 1000) ||
(0 != stress_level % 1000))
stress_level = 10000;
}
break;
default:
stress_level = 1;
limit_group = 1;
break;
}
}
break;
default:
break;
}
}
}
/*
* is_cpu_on(int unit) checks to see if processor
* unit is online.
*/
static int
{
int proc_stat;
return (0);
return (1);
}
/*
* check_proc(int cpu_id) checks to see that we're on an
* fpscrubber supported processor specified by cpu_id.
*/
static int
check_proc(int cpu_id)
{
char brand[40];
/* grab kstat info */
return (1);
return (1);
}
return (1);
}
return (1);
}
KSTAT_NAMED_STR_PTR(knp))) < 0) {
return (1);
}
/* check against supported CPUs */
return (2);
}
return (0);
}