Home | History | Annotate | Download | only in fptest
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License (the "License").
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets "[]" replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  */
     21 
     22 /*
     23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     24  * Use is subject to license terms.
     25  */
     26 
     27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
     28 
     29 #ifdef __lint
     30 #pragma error_messages(off, E_VALUE_TYPE)
     31 #endif
     32 
     33 #include <stdio.h>
     34 #include <stdlib.h>
     35 #include <signal.h>
     36 #include <unistd.h>
     37 #include <string.h>
     38 #include <sys/types.h>
     39 #include <sys/file.h>
     40 #include <sys/fcntl.h>
     41 #include <math.h>
     42 #include <sys/dditypes.h>
     43 #include <sys/ddidmareq.h>
     44 #include <sys/ddi_impldefs.h>
     45 #include <sys/processor.h>
     46 #include <sys/pset.h>
     47 #include <time.h>
     48 #include <kstat.h>
     49 #include <fp.h>
     50 #include <fptest.h>
     51 #include <fpstestmsg.h>
     52 #include <externs.h>
     53 #include <fps_ereport.h>
     54 #include <fps_defines.h>
     55 
     56 #define	GetBoxStringLen SYS_NMLN
     57 #define	NANO_IN_MILI 1000000
     58 #define	MILI_IN_SEC 1000
     59 #define	str_v9 "sparcv9"
     60 #define	str_v9b "sparcv9+vis2"
     61 #define	testname "fptest"
     62 
     63 static int fps_exec_time = 0;
     64 static int fps_verbose_msg = 0;
     65 static int fpu_cpu = -1;
     66 static int test_group = 1;
     67 static int stress_level = 1;
     68 static int limit_group = 1;
     69 static int proc_fr;
     70 static int lowstresslapagroup_len;
     71 static int lowstresslapagroup1000_len;
     72 static int lowstresslapagroup1500_len;
     73 static int lowstresslapagroup2000_len;
     74 static int medstresslapagroup_len;
     75 static int highstresslapagroup_len;
     76 static struct LapaGroup *lowstresslapagroup;
     77 
     78 static void exe_time(hrtime_t timeStart);
     79 static void process_fpu_args(int argc, char *argv[]);
     80 static int check_proc(int cpu_id);
     81 static int do_lapack(int unit, struct fps_test_ereport *report);
     82 static int dpmath(struct fps_test_ereport *report);
     83 static int is_cpu_on(int unit);
     84 static int spmath(struct fps_test_ereport *report);
     85 static int start_testing(int unit,
     86     struct fps_test_ereport *report);
     87 
     88 /*
     89  * main(int argc, char *argv[])
     90  * is the main entry into the test.
     91  */
     92 int
     93 main(int argc, char *argv[])
     94 {
     95 	int test_ret;
     96 	int procb;
     97 	int proc_setb;
     98 	int ret = FPU_OK;
     99 	hrtime_t test_start;
    100 	psetid_t opset = PS_NONE;
    101 	processorid_t proc_used = PBIND_NONE;
    102 	static struct fps_test_ereport ereport_data;
    103 
    104 	/* these are % ( modulo ) values */
    105 	lowstresslapagroup1000_len =
    106 	    (sizeof (LowStressLapaGroup_1000) / sizeof (struct LapaGroup)) - 1;
    107 	lowstresslapagroup1500_len =
    108 	    (sizeof (LowStressLapaGroup_1500) / sizeof (struct LapaGroup)) - 1;
    109 	lowstresslapagroup2000_len =
    110 	    (sizeof (LowStressLapaGroup_2000) / sizeof (struct LapaGroup)) - 1;
    111 	medstresslapagroup_len =
    112 	    (sizeof (MedStressLapaGroup) / sizeof (struct LapaGroup)) - 1;
    113 	highstresslapagroup_len =
    114 	    (sizeof (HighStressLapaGroup) / sizeof (struct LapaGroup)) - 1;
    115 
    116 	/* default frequency values */
    117 	proc_fr = 1000;
    118 	lowstresslapagroup_len = lowstresslapagroup1000_len;
    119 	lowstresslapagroup = LowStressLapaGroup_1000;
    120 
    121 	initialize_fps_test_struct(&ereport_data);
    122 
    123 	process_fpu_args(argc, argv);
    124 
    125 	fps_msg(fps_verbose_msg, gettext(FPSM_04), lowstresslapagroup_len,
    126 	    medstresslapagroup_len, highstresslapagroup_len);
    127 
    128 #ifdef V9B
    129 	fps_msg(fps_verbose_msg, gettext(FPSM_03), testname, "V9B");
    130 #else
    131 	fps_msg(fps_verbose_msg, gettext(FPSM_03), testname, "V9");
    132 #endif
    133 
    134 	if (fpu_cpu < 0)
    135 		return (FPU_INVALID_ARG);
    136 
    137 	test_start = gethrtime();
    138 
    139 	procb = processor_bind(P_PID, P_MYID, fpu_cpu, NULL);
    140 
    141 	if (procb) {
    142 		if ((pset_assign(PS_QUERY,
    143 		    (processorid_t)fpu_cpu, &opset) == 0) &&
    144 		    (opset != PS_NONE)) {
    145 			proc_setb = pset_bind(opset, P_PID, P_MYID, NULL);
    146 		}
    147 
    148 		if (proc_setb) {
    149 			return (FPU_BIND_FAIL);
    150 		}
    151 
    152 		procb = processor_bind(P_PID, P_MYID, fpu_cpu, NULL);
    153 
    154 		if (procb) {
    155 			(void) pset_bind(PS_NONE, P_PID, P_MYID, NULL);
    156 			return (FPU_BIND_FAIL);
    157 		}
    158 	}
    159 
    160 	/* start testing */
    161 	ereport_data.cpu_id = fpu_cpu;
    162 	test_ret = start_testing(fpu_cpu, &ereport_data);
    163 
    164 	/*
    165 	 * Testing is now done and a return code is selected.
    166 	 * FPU_OK: No problems found on FPU tested.
    167 	 *
    168 	 * FPU_BIND_FAIL: CPU currently bound to is not the
    169 	 * one started on. Attempt to file ereport if CPU
    170 	 * is supported,  but don't include resource so
    171 	 * CPU isn't offlined.
    172 	 *
    173 	 * FPU_UNSUPPORT: Test wasn't run on a supported CPU.
    174 	 * Error was found, but no ereport will be filed since
    175 	 * CPU is unsupported and test values may not be valid.
    176 	 *
    177 	 * FPU_FOROFFLINE: Error found on FPU and ereport
    178 	 * payload successfully sent.
    179 	 *
    180 	 * FPU_EREPORT_INCOM: Error found on FPU, ereport payload
    181 	 * sent, but some nonessential information failed to add
    182 	 * to that payload. CPU will still be offlined.
    183 	 *
    184 	 * FPU_EREPORT_FAIL: Error found on FPU, but ereport payload
    185 	 * failed to transfer either due to lack of mandatory data
    186 	 * or unable to send on FPScrubber systevent channel.
    187 	 */
    188 
    189 	if (test_ret == FPU_FOROFFLINE) {
    190 		/*
    191 		 * check bind and
    192 		 * check if on supported plaform
    193 		 */
    194 		(void) processor_bind(P_PID, P_MYID, PBIND_QUERY, &proc_used);
    195 
    196 		if (proc_used != (processorid_t)fpu_cpu ||
    197 		    proc_used == PBIND_NONE) {
    198 			ret = FPU_BIND_FAIL;
    199 			ereport_data.is_valid_cpu = 0;
    200 		}
    201 
    202 		if (check_proc(fpu_cpu) != 0) {
    203 			ret = FPU_UNSUPPORT;
    204 			ereport_data.is_valid_cpu = 0;
    205 		}
    206 
    207 		if (ret != FPU_UNSUPPORT) {
    208 			test_ret = fps_generate_ereport_struct(&ereport_data);
    209 			if (ret != FPU_BIND_FAIL) {
    210 				ret = test_ret;
    211 			}
    212 		}
    213 	}
    214 
    215 	if (fps_exec_time)
    216 		exe_time(test_start);
    217 
    218 	return (ret);
    219 }
    220 
    221 /*
    222  * exe_time(hrtime_t timeStart, int unit)
    223  * returns Execution time: H.M.S.Msec
    224  */
    225 static void
    226 exe_time(hrtime_t time_start)
    227 {
    228 	hrtime_t mili_now;
    229 	hrtime_t mili_start;
    230 	long hour;
    231 	long minute;
    232 	long second;
    233 	long mili;
    234 	long dif_mili;
    235 	long mili_to_sec;
    236 
    237 	mili_start = time_start / NANO_IN_MILI;
    238 	mili_now = gethrtime() / NANO_IN_MILI;
    239 
    240 	dif_mili = (long)(mili_now - mili_start);
    241 	mili_to_sec = dif_mili / MILI_IN_SEC;
    242 	hour = mili_to_sec / 3600;
    243 	minute = (mili_to_sec - (hour * 3600)) / 60;
    244 	second = (mili_to_sec - ((hour * 3600) + (minute * 60)));
    245 	mili =
    246 	    (dif_mili - ((second * 1000) + (((hour * 3600) +
    247 	    (minute * 60)) * 1000)));
    248 
    249 	(void) printf("Execution time: %ldH.%ldM.%ldS.%ldMsec\n", hour, minute,
    250 	    second, mili);
    251 	(void) fflush(NULL);
    252 }
    253 
    254 /*
    255  * start_testing(int unit, int argc, char *argv[],
    256  * struct fps_test_ereport *report) performs each sub-test
    257  * sequentially and stores any failed test information in
    258  * report.
    259  */
    260 static int
    261 start_testing(int unit, struct fps_test_ereport *report)
    262 {
    263 	int lim;
    264 	int sdclimit;
    265 
    266 	if (report == NULL)
    267 		return (-1);
    268 
    269 	/*
    270 	 * The non-lapack logic will be executed when -p 0 OR -p ALL
    271 	 */
    272 	if ((0 == test_group) || (12345 == test_group)) {
    273 		fps_msg(fps_verbose_msg, gettext(FPSM_01), unit, limit_group);
    274 
    275 		/* turn on signal handlers */
    276 		(void) winitfp();
    277 
    278 		if (fpu_sysdiag(report) != 0) {
    279 			return (FPU_FOROFFLINE);
    280 		}
    281 
    282 		/* turn off signal handlers */
    283 		(void) restore_signals();
    284 
    285 		if (spmath(report) != 0) {
    286 			return (FPU_FOROFFLINE);
    287 		}
    288 
    289 		if (dpmath(report) != 0) {
    290 			return (FPU_FOROFFLINE);
    291 		}
    292 
    293 		if (cbbcopy(report) != 0) {
    294 			return (FPU_FOROFFLINE);
    295 		}
    296 
    297 		sdclimit = 100;
    298 
    299 		if (limit_group == 2)
    300 			sdclimit = 1000;
    301 		if (limit_group == 3)
    302 			sdclimit = 10000;
    303 
    304 		if (cheetah_sdc_test(sdclimit, report) != 0) {
    305 			return (FPU_FOROFFLINE);
    306 		}
    307 
    308 		lim = 100;
    309 
    310 		if (limit_group == 2)
    311 			lim = 1000;
    312 		if (limit_group == 3)
    313 			lim = 100000;
    314 
    315 		if (fpu_fdivd(lim, report) != 0) {
    316 			return (FPU_FOROFFLINE);
    317 		}
    318 
    319 		if (fpu_fmuld(lim, report) != 0) {
    320 			return (FPU_FOROFFLINE);
    321 		}
    322 
    323 		if (fpu_fmulx(lim, report) != 0) {
    324 			return (FPU_FOROFFLINE);
    325 		}
    326 
    327 #ifdef V9B
    328 
    329 		lim = 10;
    330 
    331 		if (limit_group == 2)
    332 			lim = 100;
    333 		if (limit_group == 3)
    334 			lim = 1000;
    335 
    336 		if (align_data(lim, report) != 0) {
    337 			return (FPU_FOROFFLINE);
    338 		}
    339 
    340 		if (vis_test(report) != 0) {
    341 			return (FPU_FOROFFLINE);
    342 		}
    343 
    344 #endif
    345 
    346 		if (test_group == 0)
    347 			return (FPU_OK);
    348 
    349 	} /* end the non lapack area */
    350 
    351 	if (do_lapack(unit, report) != 0)
    352 		return (FPU_FOROFFLINE);
    353 
    354 	return (FPU_OK);
    355 }
    356 
    357 /*
    358  * do_lapack(struct fps_test_ereport *report) calls the lapack
    359  * tests and stores any error info into report.
    360  */
    361 static int
    362 do_lapack(int unit, struct fps_test_ereport *report)
    363 {
    364 	int lapa_group_index;
    365 	int lapa_loop_stress;
    366 	int lapa_stress;
    367 	int lapa_loop;
    368 	int high_lim;
    369 	int low_lim;
    370 
    371 	fps_msg(fps_verbose_msg, gettext(FPSM_05), limit_group);
    372 
    373 	switch (limit_group) {
    374 	case 1:
    375 		lapa_group_index = test_group % lowstresslapagroup_len;
    376 
    377 		if (lapa_group_index <= 0)
    378 			lapa_group_index = 1;
    379 
    380 		low_lim = lowstresslapagroup[lapa_group_index].limLow;
    381 		high_lim = lowstresslapagroup[lapa_group_index].limHigh;
    382 
    383 		if (test_group == 12345) {
    384 			low_lim = 1;
    385 			high_lim =
    386 			    lowstresslapagroup[lowstresslapagroup_len - 1]
    387 			    .limHigh;
    388 		}
    389 
    390 		break;
    391 	case 2:
    392 		lapa_group_index = test_group % medstresslapagroup_len;
    393 
    394 		if (lapa_group_index <= 0)
    395 			lapa_group_index = 1;
    396 
    397 		low_lim = MedStressLapaGroup[lapa_group_index].limLow;
    398 		high_lim = MedStressLapaGroup[lapa_group_index].limHigh;
    399 
    400 		if (test_group == 12345) {
    401 			low_lim = 1;
    402 			high_lim =
    403 			    MedStressLapaGroup[medstresslapagroup_len - 1]
    404 			    .limHigh;
    405 		}
    406 		break;
    407 	case 3:
    408 		lapa_group_index = test_group % highstresslapagroup_len;
    409 
    410 		if (lapa_group_index <= 0)
    411 			lapa_group_index = 1;
    412 
    413 		low_lim = HighStressLapaGroup[lapa_group_index].limLow;
    414 		high_lim = HighStressLapaGroup[lapa_group_index].limHigh;
    415 
    416 		if (test_group == 12345) {
    417 			low_lim = 1;
    418 			high_lim =
    419 			    HighStressLapaGroup[highstresslapagroup_len - 1]
    420 			    .limHigh;
    421 		}
    422 
    423 		/* hidden arg -s X */
    424 		if (stress_level > 4000) {
    425 			low_lim = 1;
    426 			high_lim = stress_level;
    427 		}
    428 		break;
    429 	default:
    430 		low_lim = 100;
    431 		high_lim = 200;
    432 		break;
    433 	}
    434 
    435 	if (low_lim < 1)
    436 		low_lim = 101;
    437 
    438 	if (high_lim > 10000)
    439 		high_lim = 201;
    440 
    441 	for (lapa_stress = low_lim; lapa_stress <= high_lim;
    442 	    lapa_stress = lapa_stress + 1) {
    443 		if (lapa_stress > 999) {
    444 			for (lapa_loop = lapa_stress; lapa_loop <= high_lim;
    445 			    lapa_loop = lapa_loop + 1000) {
    446 				lapa_loop_stress = lapa_loop;
    447 
    448 				if (lapa_loop_stress == 4000)
    449 					lapa_loop_stress = 4016;
    450 				if (lapa_loop_stress == 7000)
    451 					lapa_loop_stress = 7016;
    452 				if (lapa_loop_stress == 8000)
    453 					lapa_loop_stress = 8034;
    454 
    455 				if (slinpack_test(lapa_loop_stress, unit,
    456 				    report, fps_verbose_msg))
    457 					return (-4);
    458 #ifndef __lint
    459 				if (dlinpack_test(lapa_loop_stress, unit,
    460 				    report, fps_verbose_msg))
    461 					return (-4);
    462 #endif
    463 			}
    464 		break;
    465 		}
    466 
    467 		if (slinpack_test(lapa_stress, unit, report, fps_verbose_msg))
    468 			return (-4);
    469 #ifndef __lint
    470 		if (dlinpack_test(lapa_stress, unit, report, fps_verbose_msg))
    471 			return (-4);
    472 #endif
    473 	}
    474 
    475 	return (0);
    476 }
    477 
    478 
    479 /*
    480  * spmath(int unit, struct fps_test_ereport *report)
    481  * peforms basic tests of the arithmetic operations:
    482  * +, -, *, and /. If any errors, they are stored in
    483  * report.
    484  */
    485 static int
    486 spmath(struct fps_test_ereport *report)
    487 {
    488 	char err_data[MAX_INFO_SIZE];
    489 	float a;
    490 	float ans;
    491 	float b;
    492 	float expect_ans;
    493 	uint64_t expected;
    494 	uint64_t observed;
    495 
    496 	a = 1.2345;
    497 	b = 0.9876;
    498 
    499 #ifndef __lint
    500 	ans = a + b;
    501 #endif
    502 	ans = a + b;
    503 	expect_ans = 2.2221000;
    504 	if (ans != expect_ans) {
    505 		if (ans < (2.2221000 - SPMARGIN) ||
    506 		    ans > (2.2221000 + SPMARGIN)) {
    507 			(void) snprintf(err_data, sizeof (err_data),
    508 			    "\nExpected: %.8f\nObserved: %.8f",
    509 			    expect_ans, ans);
    510 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    511 			observed = (uint64_t)(*(uint32_t *)&ans);
    512 			setup_fps_test_struct(IS_EREPORT_INFO,
    513 			    report, 6112, &observed, &expected, 1,
    514 			    1, err_data);
    515 
    516 			return (-2);
    517 		}
    518 	}
    519 
    520 	ans = (a - b);
    521 	expect_ans = 0.2469000;
    522 	if (ans != expect_ans) {
    523 		if (ans < (0.2469000 - SPMARGIN) ||
    524 		    ans > (0.2469000 + SPMARGIN)) {
    525 			(void) snprintf(err_data, sizeof (err_data),
    526 			    "\nExpected: %.8f\nObserved: %.8f",
    527 			    expect_ans, ans);
    528 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    529 			observed = (uint64_t)(*(uint32_t *)&ans);
    530 			setup_fps_test_struct(IS_EREPORT_INFO,
    531 			    report, 6113, &observed, &expected, 1,
    532 			    1, err_data);
    533 
    534 			return (-2);
    535 		}
    536 	}
    537 
    538 	ans = a * b;
    539 	expect_ans = 1.2191923;
    540 	if (ans != expect_ans) {
    541 		if (ans < (1.2191923 - SPMARGIN) ||
    542 		    ans > (1.2191923 + SPMARGIN)) {
    543 			(void) snprintf(err_data, sizeof (err_data),
    544 			    "\nExpected: %.8f\nObserved: %.8f",
    545 			    expect_ans, ans);
    546 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    547 			observed = (uint64_t)(*(uint32_t *)&ans);
    548 			setup_fps_test_struct(IS_EREPORT_INFO,
    549 			    report, 6114, &observed, &expected, 1,
    550 			    1, err_data);
    551 
    552 			return (-2);
    553 		}
    554 	}
    555 
    556 	ans = a / b;
    557 	expect_ans = 1.2500000;
    558 	if (ans != expect_ans) {
    559 		if (ans < (1.2500000 - SPMARGIN) ||
    560 		    ans > (1.2500000 + SPMARGIN)) {
    561 			(void) snprintf(err_data, sizeof (err_data),
    562 			    "\nExpected: %.8f\nObserved: %.8f",
    563 			    expect_ans, ans);
    564 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    565 			observed = (uint64_t)(*(uint32_t *)&ans);
    566 			setup_fps_test_struct(IS_EREPORT_INFO,
    567 			    report, 6115, &observed, &expected, 1,
    568 			    1, err_data);
    569 
    570 			return (-2);
    571 		}
    572 	}
    573 
    574 	ans = a + (a - b);
    575 	expect_ans = 1.4814000;
    576 	if (ans != expect_ans) {
    577 		if (ans < (1.4814000 - SPMARGIN) ||
    578 		    ans > (1.4814000 + SPMARGIN)) {
    579 			(void) snprintf(err_data, sizeof (err_data),
    580 			    "\nExpected: %.8f\nObserved: %.8f",
    581 			    expect_ans, ans);
    582 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    583 			observed = (uint64_t)(*(uint32_t *)&ans);
    584 			setup_fps_test_struct(IS_EREPORT_INFO,
    585 			    report, 6116, &observed, &expected, 1,
    586 			    1, err_data);
    587 
    588 			return (-2);
    589 		}
    590 	}
    591 
    592 	ans = a - (a + b);
    593 	expect_ans = -(0.9876000);
    594 	if (ans != expect_ans) {
    595 		if (ans < (-(0.9876000) - SPMARGIN) ||
    596 		    ans > (-(0.9876000) + SPMARGIN)) {
    597 			(void) snprintf(err_data, sizeof (err_data),
    598 			    "\nExpected: %.8f\nObserved: %.8f",
    599 			    expect_ans, ans);
    600 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    601 			observed = (uint64_t)(*(uint32_t *)&ans);
    602 			setup_fps_test_struct(IS_EREPORT_INFO,
    603 			    report, 6117, &observed, &expected, 1,
    604 			    1, err_data);
    605 
    606 			return (-2);
    607 		}
    608 	}
    609 
    610 	ans = a + (a * b);
    611 	expect_ans = 2.4536924;
    612 	if (ans != expect_ans) {
    613 		if (ans < (2.4536924 - SPMARGIN) ||
    614 		    ans > (2.4536924 + SPMARGIN)) {
    615 			(void) snprintf(err_data, sizeof (err_data),
    616 			    "\nExpected: %.8f\nObserved: %.8f",
    617 			    expect_ans, ans);
    618 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    619 			observed = (uint64_t)(*(uint32_t *)&ans);
    620 			setup_fps_test_struct(IS_EREPORT_INFO,
    621 			    report, 6118, &observed, &expected, 1,
    622 			    1, err_data);
    623 
    624 			return (-2);
    625 		}
    626 	}
    627 
    628 	ans = a - (a * b);
    629 	expect_ans = 0.0153078;
    630 	if (ans != expect_ans) {
    631 		if (ans < (0.0153078 - SPMARGIN) ||
    632 		    ans > (0.0153078 + SPMARGIN)) {
    633 			(void) snprintf(err_data, sizeof (err_data),
    634 			    "\nExpected: %.8f\nObserved: %.8f",
    635 			    expect_ans, ans);
    636 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    637 			observed = (uint64_t)(*(uint32_t *)&ans);
    638 			setup_fps_test_struct(IS_EREPORT_INFO,
    639 			    report, 6119, &observed, &expected, 1,
    640 			    1, err_data);
    641 
    642 			return (-2);
    643 		}
    644 	}
    645 
    646 	ans = a + (a / b);
    647 	expect_ans = 2.4844999;
    648 	if (ans != expect_ans) {
    649 		if (ans < (2.4844999 - SPMARGIN) ||
    650 		    ans > (2.4844999 + SPMARGIN)) {
    651 			(void) snprintf(err_data, sizeof (err_data),
    652 			    "\nExpected: %.8f\nObserved: %.8f",
    653 			    expect_ans, ans);
    654 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    655 			observed = (uint64_t)(*(uint32_t *)&ans);
    656 			setup_fps_test_struct(IS_EREPORT_INFO,
    657 			    report, 6120, &observed, &expected, 1,
    658 			    1, err_data);
    659 
    660 			return (-2);
    661 		}
    662 	}
    663 
    664 	ans = a - (a / b);
    665 	expect_ans = expect_ans;
    666 	if (ans != -(0.0155000)) {
    667 		if (ans < (-(0.0155000) - SPMARGIN) ||
    668 		    ans > (-(0.0155000) + SPMARGIN)) {
    669 			(void) snprintf(err_data, sizeof (err_data),
    670 			    "\nExpected: %.8f\nObserved: %.8f",
    671 			    expect_ans, ans);
    672 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    673 			observed = (uint64_t)(*(uint32_t *)&ans);
    674 			setup_fps_test_struct(IS_EREPORT_INFO,
    675 			    report, 6121, &observed, &expected, 1,
    676 			    1, err_data);
    677 
    678 			return (-2);
    679 		}
    680 	}
    681 
    682 	ans = a * (a + b);
    683 	expect_ans = 2.7431827;
    684 	if (ans != expect_ans) {
    685 		if (ans < (2.7431827 - SPMARGIN) ||
    686 		    ans > (2.7431827 + SPMARGIN)) {
    687 			(void) snprintf(err_data, sizeof (err_data),
    688 			    "\nExpected: %.8f\nObserved: %.8f",
    689 			    expect_ans, ans);
    690 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    691 			observed = (uint64_t)(*(uint32_t *)&ans);
    692 			setup_fps_test_struct(IS_EREPORT_INFO,
    693 			    report, 6122, &observed, &expected, 1,
    694 			    1, err_data);
    695 
    696 			return (-2);
    697 		}
    698 	}
    699 
    700 	ans = a * (a - b);
    701 	expect_ans = 0.3047981;
    702 	if (ans != expect_ans) {
    703 		if (ans < (0.3047981 - SPMARGIN) ||
    704 		    ans > (0.3047981 + SPMARGIN)) {
    705 			(void) snprintf(err_data, sizeof (err_data),
    706 			    "\nExpected: %.8f\nObserved: %.8f",
    707 			    expect_ans, ans);
    708 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    709 			observed = (uint64_t)(*(uint32_t *)&ans);
    710 			setup_fps_test_struct(IS_EREPORT_INFO,
    711 			    report, 6123, &observed, &expected, 1,
    712 			    1, err_data);
    713 
    714 			return (-2);
    715 		}
    716 	}
    717 
    718 	ans = a / (a + b);
    719 	expect_ans = 0.5555556;
    720 	if (ans != expect_ans) {
    721 		if (ans < (0.5555556 - SPMARGIN) ||
    722 		    ans > (0.5555556 + SPMARGIN)) {
    723 			(void) snprintf(err_data, sizeof (err_data),
    724 			    "\nExpected: %.8f\nObserved: %.8f",
    725 			    expect_ans, ans);
    726 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    727 			observed = (uint64_t)(*(uint32_t *)&ans);
    728 			setup_fps_test_struct(IS_EREPORT_INFO,
    729 			    report, 6124, &observed, &expected, 1,
    730 			    1, err_data);
    731 
    732 			return (-2);
    733 		}
    734 	}
    735 
    736 	ans = a / (a - b);
    737 	expect_ans = 4.9999995;
    738 	if (ans != expect_ans) {
    739 		if (ans < (4.9999995 - SPMARGIN) ||
    740 		    ans > (4.9999995 + SPMARGIN)) {
    741 			(void) snprintf(err_data, sizeof (err_data),
    742 			    "\nExpected: %.8f\nObserved: %.8f",
    743 			    expect_ans, ans);
    744 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    745 			observed = (uint64_t)(*(uint32_t *)&ans);
    746 			setup_fps_test_struct(IS_EREPORT_INFO,
    747 			    report, 6125, &observed, &expected, 1,
    748 			    1, err_data);
    749 
    750 			return (-2);
    751 		}
    752 	}
    753 
    754 	ans = a * (a / b);
    755 	expect_ans = 1.5431250;
    756 	if (ans != expect_ans) {
    757 		if (ans < (1.5431250 - SPMARGIN) ||
    758 		    ans > (1.5431250 + SPMARGIN)) {
    759 			(void) snprintf(err_data, sizeof (err_data),
    760 			    "\nExpected: %.8f\nObserved: %.8f",
    761 			    expect_ans, ans);
    762 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    763 			observed = (uint64_t)(*(uint32_t *)&ans);
    764 			setup_fps_test_struct(IS_EREPORT_INFO,
    765 			    report, 6126, &observed, &expected, 1,
    766 			    1, err_data);
    767 
    768 		return (-2);
    769 		}
    770 	}
    771 
    772 	ans = a / (a * b);
    773 	expect_ans = 1.0125557;
    774 	if (ans != expect_ans) {
    775 		if (ans < (1.0125557 - SPMARGIN) ||
    776 		    ans > (1.0125557 + SPMARGIN)) {
    777 			(void) snprintf(err_data, sizeof (err_data),
    778 			    "\nExpected: %.8f\nObserved: %.8f",
    779 			    expect_ans, ans);
    780 			expected = (uint64_t)(*(uint32_t *)&expect_ans);
    781 			observed = (uint64_t)(*(uint32_t *)&ans);
    782 			setup_fps_test_struct(IS_EREPORT_INFO,
    783 			    report, 6127, &observed, &expected, 1,
    784 			    1, err_data);
    785 
    786 			return (-2);
    787 		}
    788 	}
    789 
    790 	return (0);
    791 }
    792 
    793 /*
    794  * dpmath(int unit, struct fps_test_ereport *report)
    795  * peforms basic tests of the arithmetic operations:
    796  * +, -, *, and /. It also performs tests of cos,
    797  * sine, tan, log, sqrt, and exp. If any errors,
    798  * they are stored in report.
    799  */
    800 static int
    801 dpmath(struct fps_test_ereport *report)
    802 {
    803 	char err_data[MAX_INFO_SIZE];
    804 	double a;
    805 	double ans;
    806 	double b;
    807 	double expect_ans;
    808 	double expect_ans2;
    809 	double result;
    810 	double x;
    811 	uint64_t expected;
    812 	uint64_t observed;
    813 
    814 	a = 1.2345;
    815 	b = 0.9876;
    816 
    817 	ans = (a + b);
    818 	expect_ans = 2.222100000000000;
    819 	if (ans != expect_ans) {
    820 		if (ans < (expect_ans - DPMARGIN) ||
    821 		    ans > (expect_ans + DPMARGIN)) {
    822 			expected = *(uint64_t *)&expect_ans;
    823 			observed = *(uint64_t *)&ans;
    824 			(void) snprintf(err_data, sizeof (err_data),
    825 			    "\nExpected: %.16f\nObserved: %.16f",
    826 			    expect_ans, ans);
    827 			setup_fps_test_struct(IS_EREPORT_INFO,
    828 			    report, 6128, &observed, &expected, 1, 1,
    829 			    err_data);
    830 
    831 			return (-3);
    832 		}
    833 	}
    834 
    835 	ans = (a - b);
    836 	expect_ans = 0.246899999999999;
    837 	if (ans != expect_ans) {
    838 		if (ans < (expect_ans - DPMARGIN) ||
    839 		    ans > (expect_ans + DPMARGIN)) {
    840 			expected = *(uint64_t *)&expect_ans;
    841 			observed = *(uint64_t *)&ans;
    842 			(void) snprintf(err_data, sizeof (err_data),
    843 			    "\nExpected: %.16f\nObserved: %.16f",
    844 			    expect_ans, ans);
    845 			setup_fps_test_struct(IS_EREPORT_INFO,
    846 			    report, 6129, &observed, &expected, 1, 1,
    847 			    err_data);
    848 
    849 			return (-3);
    850 		}
    851 	}
    852 
    853 	ans = a * b;
    854 	expect_ans = 1.219192199999999;
    855 	if (ans != expect_ans) {
    856 		if (ans < (expect_ans - DPMARGIN) ||
    857 		    ans > (expect_ans + DPMARGIN)) {
    858 			expected = *(uint64_t *)&expect_ans;
    859 			observed = *(uint64_t *)&ans;
    860 			(void) snprintf(err_data, sizeof (err_data),
    861 			    "\nExpected: %.16f\nObserved: %.16f",
    862 			    expect_ans, ans);
    863 			setup_fps_test_struct(IS_EREPORT_INFO,
    864 			    report, 6130, &observed, &expected, 1, 1,
    865 			    err_data);
    866 
    867 			return (-3);
    868 		}
    869 	}
    870 
    871 	ans = a / b;
    872 	expect_ans = 1.249999999999999;
    873 	if (ans != expect_ans) {
    874 		if (ans < (expect_ans - DPMARGIN) ||
    875 		    ans > (expect_ans + DPMARGIN)) {
    876 			expected = *(uint64_t *)&expect_ans;
    877 			observed = *(uint64_t *)&ans;
    878 			(void) snprintf(err_data, sizeof (err_data),
    879 			    "\nExpected: %.16f\nObserved: %.16f",
    880 			    expect_ans, ans);
    881 			setup_fps_test_struct(IS_EREPORT_INFO,
    882 			    report, 6131, &observed, &expected, 1, 1,
    883 			    err_data);
    884 
    885 			return (-3);
    886 		}
    887 	}
    888 
    889 	ans = a + (a - b);
    890 	expect_ans = 1.481399999999999;
    891 	if (ans != expect_ans) {
    892 		if (ans < (expect_ans - DPMARGIN) ||
    893 		    ans > (expect_ans + DPMARGIN)) {
    894 			expected = *(uint64_t *)&expect_ans;
    895 			observed = *(uint64_t *)&ans;
    896 			(void) snprintf(err_data, sizeof (err_data),
    897 			    "\nExpected: %.16f\nObserved: %.16f",
    898 			    expect_ans, ans);
    899 			setup_fps_test_struct(IS_EREPORT_INFO,
    900 			    report, 6132, &observed, &expected, 1, 1,
    901 			    err_data);
    902 
    903 			return (-3);
    904 		}
    905 	}
    906 
    907 	ans = a - (a + b);
    908 	expect_ans = -(0.987600000000000);
    909 	if (ans != expect_ans) {
    910 		if (ans < (expect_ans - DPMARGIN) ||
    911 		    ans > (expect_ans + DPMARGIN)) {
    912 			expected = *(uint64_t *)&expect_ans;
    913 			observed = *(uint64_t *)&ans;
    914 			(void) snprintf(err_data, sizeof (err_data),
    915 			    "\nExpected: %.16f\nObserved: %.16f",
    916 			    expect_ans, ans);
    917 			setup_fps_test_struct(IS_EREPORT_INFO,
    918 			    report, 6133, &observed, &expected, 1, 1,
    919 			    err_data);
    920 
    921 			return (-3);
    922 		}
    923 	}
    924 
    925 	ans = a + (a * b);
    926 	expect_ans = 2.453692200000000;
    927 	if (ans != expect_ans) {
    928 		if (ans < (expect_ans - DPMARGIN) ||
    929 		    ans > (expect_ans + DPMARGIN)) {
    930 			expected = *(uint64_t *)&expect_ans;
    931 			observed = *(uint64_t *)&ans;
    932 			(void) snprintf(err_data, sizeof (err_data),
    933 			    "\nExpected: %.16f\nObserved: %.16f",
    934 			    expect_ans, ans);
    935 			setup_fps_test_struct(IS_EREPORT_INFO,
    936 			    report, 6134, &observed, &expected, 1, 1,
    937 			    err_data);
    938 
    939 			return (-3);
    940 		}
    941 	}
    942 
    943 	ans = a - (a * b);
    944 	expect_ans = 0.015307800000000;
    945 	if (ans != expect_ans) {
    946 		if (ans < (expect_ans - DPMARGIN) ||
    947 		    ans > (expect_ans + DPMARGIN)) {
    948 			expected = *(uint64_t *)&expect_ans;
    949 			observed = *(uint64_t *)&ans;
    950 			(void) snprintf(err_data, sizeof (err_data),
    951 			    "\nExpected: %.16f\nObserved: %.16f",
    952 			    expect_ans, ans);
    953 			setup_fps_test_struct(IS_EREPORT_INFO,
    954 			    report, 6135, &observed, &expected, 1, 1,
    955 			    err_data);
    956 
    957 			return (-3);
    958 		}
    959 	}
    960 
    961 	ans = a + (a / b);
    962 	expect_ans = 2.484500000000000;
    963 	if (ans != expect_ans) {
    964 		if (ans < (expect_ans - DPMARGIN) ||
    965 		    ans > (expect_ans + DPMARGIN)) {
    966 			expected = *(uint64_t *)&expect_ans;
    967 			observed = *(uint64_t *)&ans;
    968 			(void) snprintf(err_data, sizeof (err_data),
    969 			    "\nExpected: %.16f\nObserved: %.16f",
    970 			    expect_ans, ans);
    971 			setup_fps_test_struct(IS_EREPORT_INFO,
    972 			    report, 6136, &observed, &expected, 1, 1,
    973 			    err_data);
    974 
    975 			return (-3);
    976 		}
    977 	}
    978 
    979 	ans = a - (a / b);
    980 	expect_ans = -(0.015499999999999);
    981 	if (ans != expect_ans) {
    982 		if (ans < (expect_ans - DPMARGIN) ||
    983 		    ans > (expect_ans + DPMARGIN)) {
    984 			expected = *(uint64_t *)&expect_ans;
    985 			observed = *(uint64_t *)&ans;
    986 			(void) snprintf(err_data, sizeof (err_data),
    987 			    "\nExpected: %.16f\nObserved: %.16f",
    988 			    expect_ans, ans);
    989 			setup_fps_test_struct(IS_EREPORT_INFO,
    990 			    report, 6137, &observed, &expected, 1, 1,
    991 			    err_data);
    992 
    993 			return (-3);
    994 		}
    995 	}
    996 
    997 	ans = a * (a + b);
    998 	expect_ans = 2.743182449999999;
    999 	if (ans != expect_ans) {
   1000 		if (ans < (expect_ans - DPMARGIN) ||
   1001 		    ans > (expect_ans + DPMARGIN)) {
   1002 			expected = *(uint64_t *)&expect_ans;
   1003 			observed = *(uint64_t *)&ans;
   1004 			(void) snprintf(err_data, sizeof (err_data),
   1005 			    "\nExpected: %.16f\nObserved: %.16f",
   1006 			    expect_ans, ans);
   1007 			setup_fps_test_struct(IS_EREPORT_INFO,
   1008 			    report, 6138, &observed, &expected, 1, 1,
   1009 			    err_data);
   1010 
   1011 			return (-3);
   1012 		}
   1013 	}
   1014 
   1015 	ans = a * (a - b);
   1016 	expect_ans = 0.304798049999999;
   1017 	if (ans != expect_ans) {
   1018 		if (ans < (expect_ans - DPMARGIN) ||
   1019 		    ans > (expect_ans + DPMARGIN)) {
   1020 			expected = *(uint64_t *)&expect_ans;
   1021 			observed = *(uint64_t *)&ans;
   1022 			(void) snprintf(err_data, sizeof (err_data),
   1023 			    "\nExpected: %.16f\nObserved: %.16f",
   1024 			    expect_ans, ans);
   1025 			setup_fps_test_struct(IS_EREPORT_INFO,
   1026 			    report, 6139, &observed, &expected, 1, 1,
   1027 			    err_data);
   1028 
   1029 			return (-3);
   1030 		}
   1031 	}
   1032 
   1033 
   1034 	ans = a / (a + b);
   1035 	expect_ans = 0.555555555555555;
   1036 	if (ans != expect_ans) {
   1037 		if (ans < (expect_ans - DPMARGIN) ||
   1038 		    ans > (expect_ans + DPMARGIN)) {
   1039 			expected = *(uint64_t *)&expect_ans;
   1040 			observed = *(uint64_t *)&ans;
   1041 			(void) snprintf(err_data, sizeof (err_data),
   1042 			    "\nExpected: %.16f\nObserved: %.16f",
   1043 			    expect_ans, ans);
   1044 			setup_fps_test_struct(IS_EREPORT_INFO,
   1045 			    report, 6140, &observed, &expected, 1, 1,
   1046 			    err_data);
   1047 
   1048 			return (-3);
   1049 		}
   1050 	}
   1051 
   1052 	ans = a / (a - b);
   1053 	expect_ans = 5.000000000000002;
   1054 	if (ans != expect_ans) {
   1055 		if (ans < (expect_ans - DPMARGIN) ||
   1056 		    ans > (expect_ans + DPMARGIN)) {
   1057 			expected = *(uint64_t *)&expect_ans;
   1058 			observed = *(uint64_t *)&ans;
   1059 			(void) snprintf(err_data, sizeof (err_data),
   1060 			    "\nExpected: %.16f\nObserved: %.16f",
   1061 			    expect_ans, ans);
   1062 			setup_fps_test_struct(IS_EREPORT_INFO,
   1063 			    report, 6141, &observed, &expected, 1, 1,
   1064 			    err_data);
   1065 
   1066 			return (-3);
   1067 		}
   1068 	}
   1069 
   1070 	ans = a * (a / b);
   1071 	expect_ans = 1.543124999999999;
   1072 	if (ans != expect_ans) {
   1073 		if (ans < (expect_ans - DPMARGIN) ||
   1074 		    ans > (expect_ans + DPMARGIN)) {
   1075 			expected = *(uint64_t *)&expect_ans;
   1076 			observed = *(uint64_t *)&ans;
   1077 			(void) snprintf(err_data, sizeof (err_data),
   1078 			    "\nExpected: %.16f\nObserved: %.16f",
   1079 			    expect_ans, ans);
   1080 			setup_fps_test_struct(IS_EREPORT_INFO,
   1081 			    report, 6142, &observed, &expected, 1, 1,
   1082 			    err_data);
   1083 
   1084 			return (-3);
   1085 		}
   1086 	}
   1087 
   1088 	ans = a / (a * b);
   1089 	expect_ans = 1.012555690562980;
   1090 	if (ans != expect_ans) {
   1091 		if (ans < (expect_ans - DPMARGIN) ||
   1092 		    ans > (expect_ans + DPMARGIN)) {
   1093 			expected = *(uint64_t *)&expect_ans;
   1094 			observed = *(uint64_t *)&ans;
   1095 			(void) snprintf(err_data, sizeof (err_data),
   1096 			    "\nExpected: %.16f\nObserved: %.16f",
   1097 			    expect_ans, ans);
   1098 			setup_fps_test_struct(IS_EREPORT_INFO,
   1099 			    report, 6143, &observed, &expected, 1, 1,
   1100 			    err_data);
   1101 
   1102 			return (-3);
   1103 		}
   1104 	}
   1105 
   1106 	/* Start Double Precision test of trg functions */
   1107 
   1108 	/* sin of values in the range of -2pi to +2pi   */
   1109 	result = sin(-(pi * 2));
   1110 	expect_ans = -(0.000000000820413);
   1111 	if (result != expect_ans) {
   1112 		if (result < (expect_ans - DPMARGIN) ||
   1113 		    result > (expect_ans + DPMARGIN)) {
   1114 			expected = *(uint64_t *)&expect_ans;
   1115 			observed = *(uint64_t *)&result;
   1116 			(void) snprintf(err_data, sizeof (err_data),
   1117 			    "\nExpected: %.16f\nObserved: %.16f",
   1118 			    expect_ans, result);
   1119 			setup_fps_test_struct(IS_EREPORT_INFO,
   1120 			    report, 6144, &observed, &expected, 1, 1,
   1121 			    err_data);
   1122 
   1123 			return (-3);
   1124 		}
   1125 	}
   1126 
   1127 	result = sin((pi * (-3)) / 2);
   1128 	expect_ans = 1.0000000000000000;
   1129 	if (result != expect_ans) {
   1130 		if (result < (expect_ans - DPMARGIN)) {
   1131 			expected = *(uint64_t *)&expect_ans;
   1132 			observed = *(uint64_t *)&result;
   1133 			(void) snprintf(err_data, sizeof (err_data),
   1134 			    "\nExpected: %.16f\nObserved: %.16f",
   1135 			    expect_ans, result);
   1136 			setup_fps_test_struct(IS_EREPORT_INFO,
   1137 			    report, 6145, &observed, &expected, 1, 1,
   1138 			    err_data);
   1139 
   1140 			return (-3);
   1141 		}
   1142 #ifndef i86pc
   1143 		else if (result > (-(0.000000000000000) + DPMARGIN)) {
   1144 			expected = (uint64_t)-(0.000000000000000);
   1145 			observed = *(uint64_t *)&result;
   1146 			(void) snprintf(err_data, sizeof (err_data),
   1147 			    "\nExpected: %.16f\nObserved: %.16f",
   1148 			    -0.000000000000000, result);
   1149 			setup_fps_test_struct(IS_EREPORT_INFO,
   1150 			    report, 6146, &observed, &expected, 1, 1,
   1151 			    err_data);
   1152 
   1153 			return (-3);
   1154 		}
   1155 #endif
   1156 	}
   1157 
   1158 	result = sin(-(pi));
   1159 	expect_ans = 0.000000000410206;
   1160 	if (result != expect_ans) {
   1161 		if (result < (expect_ans - DPMARGIN) ||
   1162 		    result > (expect_ans + DPMARGIN)) {
   1163 			expected = *(uint64_t *)&expect_ans;
   1164 			observed = *(uint64_t *)&result;
   1165 			(void) snprintf(err_data, sizeof (err_data),
   1166 			    "\nExpected: %.16f\nObserved: %.16f",
   1167 			    expect_ans, result);
   1168 			setup_fps_test_struct(IS_EREPORT_INFO,
   1169 			    report, 6147, &observed, &expected, 1, 1,
   1170 			    err_data);
   1171 
   1172 			return (-3);
   1173 		}
   1174 	}
   1175 
   1176 	result = sin(-(pi / 2));
   1177 	expect_ans = -(1.0000000000000000);
   1178 	if (result != expect_ans) {
   1179 		if (result < (expect_ans - DPMARGIN) ||
   1180 		    result > (expect_ans + DPMARGIN)) {
   1181 			expected = *(uint64_t *)&expect_ans;
   1182 			observed = *(uint64_t *)&result;
   1183 			(void) snprintf(err_data, sizeof (err_data),
   1184 			    "\nExpected: %.16f\nObserved: %.16f",
   1185 			    expect_ans, result);
   1186 			setup_fps_test_struct(IS_EREPORT_INFO,
   1187 			    report, 6148, &observed, &expected, 1, 1,
   1188 			    err_data);
   1189 
   1190 			return (-3);
   1191 		}
   1192 	}
   1193 
   1194 	result = sin(0.0);
   1195 	expect_ans = 0.0000000000000000;
   1196 	if (result != expect_ans) {
   1197 		if (result < (expect_ans - DPMARGIN) ||
   1198 		    result > (expect_ans + DPMARGIN)) {
   1199 			expected = *(uint64_t *)&expect_ans;
   1200 			observed = *(uint64_t *)&result;
   1201 			(void) snprintf(err_data, sizeof (err_data),
   1202 			    "\nExpected: %.16f\nObserved: %.16f",
   1203 			    expect_ans, result);
   1204 			setup_fps_test_struct(IS_EREPORT_INFO,
   1205 			    report, 6149, &observed, &expected, 1, 1,
   1206 			    err_data);
   1207 
   1208 			return (-3);
   1209 		}
   1210 	}
   1211 
   1212 	result = sin(pi / 2);
   1213 	expect_ans = 1.0000000000000000;
   1214 	if (result != expect_ans) {
   1215 		if (result < (expect_ans - DPMARGIN) ||
   1216 		    result > (expect_ans + DPMARGIN)) {
   1217 			expected = *(uint64_t *)&expect_ans;
   1218 			observed = *(uint64_t *)&result;
   1219 			(void) snprintf(err_data, sizeof (err_data),
   1220 			    "\nExpected: %.16f\nObserved: %.16f",
   1221 			    expect_ans, result);
   1222 			setup_fps_test_struct(IS_EREPORT_INFO,
   1223 			    report, 6150, &observed, &expected, 1, 1,
   1224 			    err_data);
   1225 
   1226 			return (-3);
   1227 		}
   1228 	}
   1229 
   1230 	result = sin(pi);
   1231 	expect_ans = -(0.000000000410206);
   1232 	if (result != expect_ans) {
   1233 		if (result < (expect_ans - DPMARGIN) ||
   1234 		    result > (expect_ans + DPMARGIN)) {
   1235 			expected = *(uint64_t *)&expect_ans;
   1236 			observed = *(uint64_t *)&result;
   1237 			(void) snprintf(err_data, sizeof (err_data),
   1238 			    "\nExpected: %.16f\nObserved: %.16f",
   1239 			    expect_ans, result);
   1240 			setup_fps_test_struct(IS_EREPORT_INFO,
   1241 			    report, 6151, &observed, &expected, 1, 1,
   1242 			    err_data);
   1243 
   1244 			return (-3);
   1245 		}
   1246 	}
   1247 
   1248 	result = sin((pi * 3) / 2);
   1249 	expect_ans = -(1.0000000000000000);
   1250 	if (result != expect_ans) {
   1251 		if (result < (expect_ans - DPMARGIN) ||
   1252 		    result > (expect_ans + DPMARGIN)) {
   1253 			expected = *(uint64_t *)&expect_ans;
   1254 			observed = *(uint64_t *)&result;
   1255 			(void) snprintf(err_data, sizeof (err_data),
   1256 			    "\nExpected: %.16f\nObserved: %.16f",
   1257 			    expect_ans, result);
   1258 			setup_fps_test_struct(IS_EREPORT_INFO,
   1259 			    report, 6152, &observed, &expected, 1, 1,
   1260 			    err_data);
   1261 
   1262 			return (-3);
   1263 		}
   1264 	}
   1265 
   1266 	result = sin(pi * 2);
   1267 	expect_ans = 0.000000000820143;
   1268 	expect_ans2 = 0.00000000820143;
   1269 	if (result != expect_ans) {
   1270 		if (result < (expect_ans - DPMARGIN) ||
   1271 		    result > (expect_ans2 + DPMARGIN)) {
   1272 			expected = *(uint64_t *)&expect_ans;
   1273 			observed = *(uint64_t *)&result;
   1274 			(void) snprintf(err_data, sizeof (err_data),
   1275 			    "\nExpected: %.16f\nObserved: %.16f",
   1276 			    expect_ans, result);
   1277 			setup_fps_test_struct(IS_EREPORT_INFO,
   1278 			    report, 6153, &observed, &expected, 1, 1,
   1279 			    err_data);
   1280 
   1281 			return (-3);
   1282 		}
   1283 	}
   1284 
   1285 	/* cos of values in the range of -2pi to +2pi   */
   1286 	result = cos(pi * (-2));
   1287 	expect_ans = 1.0000000000000000;
   1288 	if (result != expect_ans) {
   1289 		if (result < (expect_ans - DPMARGIN) ||
   1290 		    result > (expect_ans + DPMARGIN)) {
   1291 			expected = *(uint64_t *)&expect_ans;
   1292 			observed = *(uint64_t *)&result;
   1293 			(void) snprintf(err_data, sizeof (err_data),
   1294 			    "\nExpected: %.16f\nObserved: %.16f",
   1295 			    expect_ans, result);
   1296 			setup_fps_test_struct(IS_EREPORT_INFO,
   1297 			    report, 6154, &observed, &expected, 1, 1,
   1298 			    err_data);
   1299 
   1300 			return (-3);
   1301 		}
   1302 	}
   1303 
   1304 	result = cos((pi * (-3)) / 2);
   1305 	expect_ans = 0.000000000615310;
   1306 	if (result != expect_ans) {
   1307 		if (result < (expect_ans - DPMARGIN) ||
   1308 		    result > (expect_ans + DPMARGIN)) {
   1309 			expected = *(uint64_t *)&expect_ans;
   1310 			observed = *(uint64_t *)&result;
   1311 			(void) snprintf(err_data, sizeof (err_data),
   1312 			    "\nExpected: %.16f\nObserved: %.16f",
   1313 			    expect_ans, result);
   1314 			setup_fps_test_struct(IS_EREPORT_INFO,
   1315 			    report, 6155, &observed, &expected, 1, 1,
   1316 			    err_data);
   1317 
   1318 			return (-3);
   1319 		}
   1320 	}
   1321 
   1322 	result = cos(-pi);
   1323 	expect_ans = -(1.0000000000000000);
   1324 	if (result != expect_ans) {
   1325 		if (result < (expect_ans - DPMARGIN) ||
   1326 		    result > (expect_ans + DPMARGIN)) {
   1327 			expected = *(uint64_t *)&expect_ans;
   1328 			observed = *(uint64_t *)&result;
   1329 			(void) snprintf(err_data, sizeof (err_data),
   1330 			    "\nExpected: %.16f\nObserved: %.16f",
   1331 			    expect_ans, result);
   1332 			setup_fps_test_struct(IS_EREPORT_INFO,
   1333 			    report, 6156, &observed, &expected, 1, 1,
   1334 			    err_data);
   1335 
   1336 			return (-3);
   1337 		}
   1338 	}
   1339 
   1340 	result = cos(-(pi / 2));
   1341 	expect_ans = -(0.000000000205103);
   1342 	if (result != expect_ans) {
   1343 		if (result < (expect_ans - DPMARGIN) ||
   1344 		    result > (expect_ans + DPMARGIN)) {
   1345 			expected = *(uint64_t *)&expect_ans;
   1346 			observed = *(uint64_t *)&result;
   1347 			(void) snprintf(err_data, sizeof (err_data),
   1348 			    "\nExpected: %.16f\nObserved: %.16f",
   1349 			    expect_ans, result);
   1350 			setup_fps_test_struct(IS_EREPORT_INFO,
   1351 			    report, 6157, &observed, &expected, 1, 1,
   1352 			    err_data);
   1353 
   1354 			return (-3);
   1355 		}
   1356 	}
   1357 
   1358 	result = cos(0.0);
   1359 	expect_ans = 1.0000000000000000;
   1360 	if (result != expect_ans) {
   1361 		if (result < (expect_ans - DPMARGIN) ||
   1362 		    result > (expect_ans + DPMARGIN)) {
   1363 			expected = *(uint64_t *)&expect_ans;
   1364 			observed = *(uint64_t *)&result;
   1365 			(void) snprintf(err_data, sizeof (err_data),
   1366 			    "\nExpected: %.16f\nObserved: %.16f",
   1367 			    expect_ans, result);
   1368 			setup_fps_test_struct(IS_EREPORT_INFO,
   1369 			    report, 6158, &observed, &expected, 1, 1,
   1370 			    err_data);
   1371 
   1372 			return (-3);
   1373 		}
   1374 	}
   1375 
   1376 	result = cos(pi / 2);
   1377 	expect_ans = (-0.000000000205103);
   1378 	if (result != expect_ans) {
   1379 		if (result < (expect_ans - DPMARGIN) ||
   1380 		    result > (expect_ans + DPMARGIN)) {
   1381 			expected = *(uint64_t *)&expect_ans;
   1382 			observed = *(uint64_t *)&result;
   1383 			(void) snprintf(err_data, sizeof (err_data),
   1384 			    "\nExpected: %.16f\nObserved: %.16f",
   1385 			    expect_ans, result);
   1386 			setup_fps_test_struct(IS_EREPORT_INFO,
   1387 			    report, 6159, &observed, &expected, 1, 1,
   1388 			    err_data);
   1389 
   1390 			return (-3);
   1391 		}
   1392 	}
   1393 
   1394 	result = cos(pi);
   1395 	expect_ans = (-1.0000000000000000);
   1396 	if (result != expect_ans) {
   1397 		if (result < (expect_ans - DPMARGIN) ||
   1398 		    result > (expect_ans + DPMARGIN)) {
   1399 			expected = *(uint64_t *)&expect_ans;
   1400 			observed = *(uint64_t *)&result;
   1401 			(void) snprintf(err_data, sizeof (err_data),
   1402 			    "\nExpected: %.16f\nObserved: %.16f",
   1403 			    expect_ans, result);
   1404 			setup_fps_test_struct(IS_EREPORT_INFO,
   1405 			    report, 6160, &observed, &expected, 1, 1,
   1406 			    err_data);
   1407 
   1408 			return (-3);
   1409 		}
   1410 	}
   1411 
   1412 	result = cos((pi * 3) / 2);
   1413 	expect_ans = 0.000000000615310;
   1414 	if (result != expect_ans) {
   1415 		if (result < (expect_ans - DPMARGIN) ||
   1416 		    result > (expect_ans + DPMARGIN)) {
   1417 			expected = *(uint64_t *)&expect_ans;
   1418 			observed = *(uint64_t *)&result;
   1419 			(void) snprintf(err_data, sizeof (err_data),
   1420 			    "\nExpected: %.16f\nObserved: %.16f",
   1421 			    expect_ans, result);
   1422 			setup_fps_test_struct(IS_EREPORT_INFO,
   1423 			    report, 6161, &observed, &expected, 1, 1,
   1424 			    err_data);
   1425 
   1426 			return (-3);
   1427 		}
   1428 	}
   1429 
   1430 	result = cos(pi * 2);
   1431 	expect_ans = 1.0000000000000000;
   1432 	if (result != expect_ans) {
   1433 		if (result < (expect_ans - DPMARGIN) ||
   1434 		    result > (expect_ans + DPMARGIN)) {
   1435 			expected = *(uint64_t *)&expect_ans;
   1436 			observed = *(uint64_t *)&result;
   1437 			(void) snprintf(err_data, sizeof (err_data),
   1438 			    "\nExpected: %.16f\nObserved: %.16f",
   1439 			    expect_ans, result);
   1440 			setup_fps_test_struct(IS_EREPORT_INFO,
   1441 			    report, 6162, &observed, &expected, 1, 1,
   1442 			    err_data);
   1443 
   1444 			return (-3);
   1445 		}
   1446 	}
   1447 
   1448 	/* sin and cos of: pi/4, 3pi/4, 5pi/4 and 7pi/4  */
   1449 	result = sin(pi / 4);
   1450 	expect_ans = 0.707106781259062;
   1451 	if (result != expect_ans) {
   1452 		if (result < (expect_ans - DPMARGIN) ||
   1453 		    result > (expect_ans + DPMARGIN)) {
   1454 			expected = *(uint64_t *)&expect_ans;
   1455 			observed = *(uint64_t *)&result;
   1456 			(void) snprintf(err_data, sizeof (err_data),
   1457 			    "\nExpected: %.16f\nObserved: %.16f",
   1458 			    expect_ans, result);
   1459 			setup_fps_test_struct(IS_EREPORT_INFO,
   1460 			    report, 6163, &observed, &expected, 1, 1,
   1461 			    err_data);
   1462 
   1463 			return (-3);
   1464 		}
   1465 	}
   1466 
   1467 	result = sin((pi * 3) / 4);
   1468 	expect_ans = 0.707106780969002;
   1469 	if (result != expect_ans) {
   1470 		if (result < (expect_ans - DPMARGIN) ||
   1471 		    result > (expect_ans + DPMARGIN)) {
   1472 			expected = *(uint64_t *)&expect_ans;
   1473 			observed = *(uint64_t *)&result;
   1474 			(void) snprintf(err_data, sizeof (err_data),
   1475 			    "\nExpected: %.16f\nObserved: %.16f",
   1476 			    expect_ans, result);
   1477 			setup_fps_test_struct(IS_EREPORT_INFO,
   1478 			    report, 6164, &observed, &expected, 1, 1,
   1479 			    err_data);
   1480 
   1481 			return (-3);
   1482 		}
   1483 	}
   1484 
   1485 	result = sin((pi * 5) / 4);
   1486 	expect_ans = -(0.707106781549122);
   1487 	if (result != expect_ans) {
   1488 		if (result < (expect_ans - DPMARGIN) ||
   1489 		    result > (expect_ans + DPMARGIN)) {
   1490 			expected = *(uint64_t *)&expect_ans;
   1491 			observed = *(uint64_t *)&result;
   1492 			(void) snprintf(err_data, sizeof (err_data),
   1493 			    "\nExpected: %.16f\nObserved: %.16f",
   1494 			    expect_ans, result);
   1495 			setup_fps_test_struct(IS_EREPORT_INFO,
   1496 			    report, 6165, &observed, &expected, 1, 1,
   1497 			    err_data);
   1498 
   1499 			return (-3);
   1500 		}
   1501 	}
   1502 
   1503 	result = sin((pi * 7) / 4);
   1504 	expect_ans = -(0.707106780678942);
   1505 	if (result != expect_ans) {
   1506 		if (result < (expect_ans - DPMARGIN) ||
   1507 		    result > (expect_ans + DPMARGIN)) {
   1508 			expected = *(uint64_t *)&expect_ans;
   1509 			observed = *(uint64_t *)&result;
   1510 			(void) snprintf(err_data, sizeof (err_data),
   1511 			    "\nExpected: %.16f\nObserved: %.16f",
   1512 			    expect_ans, result);
   1513 			setup_fps_test_struct(IS_EREPORT_INFO,
   1514 			    report, 6166, &observed, &expected, 1, 1,
   1515 			    err_data);
   1516 
   1517 			return (-3);
   1518 		}
   1519 	}
   1520 
   1521 	result = cos(pi / 4);
   1522 	expect_ans = 0.707106781114032;
   1523 	if (result != expect_ans) {
   1524 		if (result < (expect_ans - DPMARGIN) ||
   1525 		    result > (expect_ans + DPMARGIN)) {
   1526 			expected = *(uint64_t *)&expect_ans;
   1527 			observed = *(uint64_t *)&result;
   1528 			(void) snprintf(err_data, sizeof (err_data),
   1529 			    "\nExpected: %.16f\nObserved: %.16f",
   1530 			    expect_ans, result);
   1531 			setup_fps_test_struct(IS_EREPORT_INFO,
   1532 			    report, 6167, &observed, &expected, 1, 1,
   1533 			    err_data);
   1534 
   1535 			return (-3);
   1536 		}
   1537 	}
   1538 
   1539 	result = cos((pi * 3) / 4);
   1540 	expect_ans = -(0.707106781404092);
   1541 	if (result != expect_ans) {
   1542 		if (result < (expect_ans - DPMARGIN) ||
   1543 		    result > (expect_ans + DPMARGIN)) {
   1544 			expected = *(uint64_t *)&expect_ans;
   1545 			observed = *(uint64_t *)&result;
   1546 			(void) snprintf(err_data, sizeof (err_data),
   1547 			    "\nExpected: %.16f\nObserved: %.16f",
   1548 			    expect_ans, result);
   1549 			setup_fps_test_struct(IS_EREPORT_INFO,
   1550 			    report, 6168, &observed, &expected, 1, 1,
   1551 			    err_data);
   1552 
   1553 			return (-3);
   1554 		}
   1555 	}
   1556 
   1557 	result = cos((pi * 5) / 4);
   1558 	expect_ans = -(0.707106780823972);
   1559 	if (result != expect_ans) {
   1560 		if (result < (expect_ans - DPMARGIN) ||
   1561 		    result > (expect_ans + DPMARGIN)) {
   1562 			expected = *(uint64_t *)&expect_ans;
   1563 			observed = *(uint64_t *)&result;
   1564 			(void) snprintf(err_data, sizeof (err_data),
   1565 			    "\nExpected: %.16f\nObserved: %.16f",
   1566 			    expect_ans, result);
   1567 			setup_fps_test_struct(IS_EREPORT_INFO,
   1568 			    report, 6169, &observed, &expected, 1, 1,
   1569 			    err_data);
   1570 
   1571 			return (-3);
   1572 		}
   1573 	}
   1574 
   1575 	result = cos((pi * 7) / 4);
   1576 	expect_ans = 0.707106781694152;
   1577 	if (result != expect_ans) {
   1578 		if (result < (expect_ans - DPMARGIN) ||
   1579 		    result > (expect_ans + DPMARGIN)) {
   1580 			expected = *(uint64_t *)&expect_ans;
   1581 			observed = *(uint64_t *)&result;
   1582 			(void) snprintf(err_data, sizeof (err_data),
   1583 			    "\nExpected: %.16f\nObserved: %.16f",
   1584 			    expect_ans, result);
   1585 			setup_fps_test_struct(IS_EREPORT_INFO,
   1586 			    report, 6170, &observed, &expected, 1, 1,
   1587 			    err_data);
   1588 
   1589 			return (-3);
   1590 		}
   1591 	}
   1592 
   1593 	/* exponential	 */
   1594 	x = exp(0.0);
   1595 	expect_ans = 1.0000000000000000;
   1596 	if (x != expect_ans) {
   1597 		if (x < (expect_ans - DPMARGIN) ||
   1598 		    x > (expect_ans + DPMARGIN)) {
   1599 			expected = *(uint64_t *)&expect_ans;
   1600 			observed = *(uint64_t *)&x;
   1601 			(void) snprintf(err_data, sizeof (err_data),
   1602 			    "\nExpected: %.16f\nObserved: %.16f",
   1603 			    expect_ans, x);
   1604 			setup_fps_test_struct(IS_EREPORT_INFO,
   1605 			    report, 6171, &observed, &expected, 1, 1,
   1606 			    err_data);
   1607 
   1608 			return (-3);
   1609 		}
   1610 	}
   1611 
   1612 	x = exp(1.0);
   1613 	expect_ans = 2.718281828459045;
   1614 	if (x != expect_ans) {
   1615 		if (x < (expect_ans - DPMARGIN) ||
   1616 		    x > (expect_ans + DPMARGIN)) {
   1617 			expected = *(uint64_t *)&expect_ans;
   1618 			observed = *(uint64_t *)&x;
   1619 			(void) snprintf(err_data, sizeof (err_data),
   1620 			    "\nExpected: %.16f\nObserved: %.16f",
   1621 			    expect_ans, x);
   1622 			setup_fps_test_struct(IS_EREPORT_INFO,
   1623 			    report, 6172, &observed, &expected, 1, 1,
   1624 			    err_data);
   1625 
   1626 			return (-3);
   1627 		}
   1628 	}
   1629 
   1630 	x = exp(2.0);
   1631 	expect_ans = 7.389056098930650;
   1632 	if (x != expect_ans) {
   1633 		if (x < (expect_ans - DPMARGIN) ||
   1634 		    x > (expect_ans + DPMARGIN)) {
   1635 			expected = *(uint64_t *)&expect_ans;
   1636 			observed = *(uint64_t *)&x;
   1637 			(void) snprintf(err_data, sizeof (err_data),
   1638 			    "\nExpected: %.16f\nObserved: %.16f",
   1639 			    expect_ans, x);
   1640 			setup_fps_test_struct(IS_EREPORT_INFO,
   1641 			    report, 6173, &observed, &expected, 1, 1,
   1642 			    err_data);
   1643 
   1644 			return (-3);
   1645 		}
   1646 	}
   1647 
   1648 	x = exp(5.0);
   1649 	expect_ans = 148.413159102576600;
   1650 	if (x != expect_ans) {
   1651 		if (x < (expect_ans - DPMARGIN) ||
   1652 		    x > (expect_ans + DPMARGIN)) {
   1653 			expected = *(uint64_t *)&expect_ans;
   1654 			observed = *(uint64_t *)&x;
   1655 			(void) snprintf(err_data, sizeof (err_data),
   1656 			    "\nExpected: %.16f\nObserved: %.16f",
   1657 			    expect_ans, x);
   1658 			setup_fps_test_struct(IS_EREPORT_INFO,
   1659 			    report, 6174, &observed, &expected, 1, 1,
   1660 			    err_data);
   1661 
   1662 			return (-3);
   1663 		}
   1664 	}
   1665 
   1666 	x = exp(10.0);
   1667 	expect_ans = 22026.465794806718000;
   1668 	if (x != expect_ans) {
   1669 		if (x < (expect_ans - DPMARGIN) ||
   1670 		    x > (expect_ans + DPMARGIN)) {
   1671 			expected = *(uint64_t *)&expect_ans;
   1672 			observed = *(uint64_t *)&x;
   1673 			(void) snprintf(err_data, sizeof (err_data),
   1674 			    "\nExpected: %.16f\nObserved: %.16f",
   1675 			    expect_ans, x);
   1676 			setup_fps_test_struct(IS_EREPORT_INFO,
   1677 			    report, 6175, &observed, &expected, 1, 1,
   1678 			    err_data);
   1679 
   1680 			return (-3);
   1681 		}
   1682 	}
   1683 
   1684 	x = exp(-1.0);
   1685 	expect_ans = 0.367879441171442;
   1686 	if (x != expect_ans) {
   1687 		if (x < (expect_ans - DPMARGIN) ||
   1688 		    x > (expect_ans + DPMARGIN)) {
   1689 			expected = *(uint64_t *)&expect_ans;
   1690 			observed = *(uint64_t *)&x;
   1691 			(void) snprintf(err_data, sizeof (err_data),
   1692 			    "\nExpected: %.16f\nObserved: %.16f",
   1693 			    expect_ans, x);
   1694 			setup_fps_test_struct(IS_EREPORT_INFO,
   1695 			    report, 6176, &observed, &expected, 1, 1,
   1696 			    err_data);
   1697 
   1698 			return (-3);
   1699 		}
   1700 	}
   1701 
   1702 	x = exp(-2.0);
   1703 	expect_ans = 0.135335283236612;
   1704 	if (x != expect_ans) {
   1705 		if (x < (expect_ans - DPMARGIN) ||
   1706 		    x > (expect_ans + DPMARGIN)) {
   1707 			expected = *(uint64_t *)&expect_ans;
   1708 			observed = *(uint64_t *)&x;
   1709 			(void) snprintf(err_data, sizeof (err_data),
   1710 			    "\nExpected: %.16f\nObserved: %.16f",
   1711 			    expect_ans, x);
   1712 			setup_fps_test_struct(IS_EREPORT_INFO,
   1713 			    report, 6177, &observed, &expected, 1, 1,
   1714 			    err_data);
   1715 
   1716 			return (-3);
   1717 		}
   1718 	}
   1719 
   1720 	x = exp(-5.0);
   1721 	expect_ans = 0.006737946999085;
   1722 	if (x != expect_ans) {
   1723 		if (x < (expect_ans - DPMARGIN) ||
   1724 		    x > (expect_ans + DPMARGIN)) {
   1725 			expected = *(uint64_t *)&expect_ans;
   1726 			observed = *(uint64_t *)&x;
   1727 			(void) snprintf(err_data, sizeof (err_data),
   1728 			    "\nExpected: %.16f\nObserved: %.16f",
   1729 			    expect_ans, x);
   1730 			setup_fps_test_struct(IS_EREPORT_INFO,
   1731 			    report, 6178, &observed, &expected, 1, 1,
   1732 			    err_data);
   1733 
   1734 			return (-3);
   1735 		}
   1736 	}
   1737 
   1738 	x = exp(-10.0);
   1739 	expect_ans = 0.000045399929762;
   1740 	if (x != expect_ans) {
   1741 		if (x < (expect_ans - DPMARGIN) ||
   1742 		    x > (expect_ans + DPMARGIN)) {
   1743 			expected = *(uint64_t *)&expect_ans;
   1744 			observed = *(uint64_t *)&x;
   1745 			(void) snprintf(err_data, sizeof (err_data),
   1746 			    "\nExpected: %.16f\nObserved: %.16f",
   1747 			    expect_ans, x);
   1748 			setup_fps_test_struct(IS_EREPORT_INFO,
   1749 			    report, 6179, &observed, &expected, 1, 1,
   1750 			    err_data);
   1751 
   1752 			return (-3);
   1753 		}
   1754 	}
   1755 
   1756 	x = exp(log(1.0));
   1757 	expect_ans = 1.0000000000000000;
   1758 	if (x != expect_ans) {
   1759 		if (x < (expect_ans - DPMARGIN) ||
   1760 		    x > (expect_ans + DPMARGIN)) {
   1761 			expected = *(uint64_t *)&expect_ans;
   1762 			observed = *(uint64_t *)&x;
   1763 			(void) snprintf(err_data, sizeof (err_data),
   1764 			    "\nExpected: %.16f\nObserved: %.16f",
   1765 			    expect_ans, x);
   1766 			setup_fps_test_struct(IS_EREPORT_INFO,
   1767 			    report, 6180, &observed, &expected, 1, 1,
   1768 			    err_data);
   1769 
   1770 			return (-3);
   1771 		}
   1772 	}
   1773 
   1774 	x = exp(log(10.0));
   1775 	expect_ans = 10.000000000000002;
   1776 	if (x != expect_ans) {
   1777 		if (x < (expect_ans - DPMARGIN) ||
   1778 		    x > (expect_ans + DPMARGIN)) {
   1779 			expected = *(uint64_t *)&expect_ans;
   1780 			observed = *(uint64_t *)&x;
   1781 			(void) snprintf(err_data, sizeof (err_data),
   1782 			    "\nExpected: %.16f\nObserved: %.16f",
   1783 			    expect_ans, x);
   1784 			setup_fps_test_struct(IS_EREPORT_INFO,
   1785 			    report, 6181, &observed, &expected, 1, 1,
   1786 			    err_data);
   1787 
   1788 			return (-3);
   1789 		}
   1790 	}
   1791 
   1792 	/* logarithms */
   1793 	x = log(1.0);
   1794 	expect_ans = 0.0000000000000000;
   1795 	if (x != expect_ans) {
   1796 		if (x < (expect_ans - DPMARGIN) ||
   1797 		    x > (expect_ans + DPMARGIN)) {
   1798 		expected = *(uint64_t *)&expect_ans;
   1799 			observed = *(uint64_t *)&x;
   1800 			(void) snprintf(err_data, sizeof (err_data),
   1801 			    "\nExpected: %.16f\nObserved: %.16f",
   1802 			    expect_ans, x);
   1803 			setup_fps_test_struct(IS_EREPORT_INFO,
   1804 			    report, 6182, &observed, &expected, 1, 1,
   1805 			    err_data);
   1806 
   1807 			return (-3);
   1808 		}
   1809 	}
   1810 
   1811 	x = log(2.0);
   1812 	expect_ans = 0.693147180559945;
   1813 	if (x != expect_ans) {
   1814 		if (x < (expect_ans - DPMARGIN) ||
   1815 		    x > (expect_ans + DPMARGIN)) {
   1816 			expected = *(uint64_t *)&expect_ans;
   1817 			observed = *(uint64_t *)&x;
   1818 			(void) snprintf(err_data, sizeof (err_data),
   1819 			    "\nExpected: %.16f\nObserved: %.16f",
   1820 			    expect_ans, x);
   1821 			setup_fps_test_struct(IS_EREPORT_INFO,
   1822 			    report, 6183, &observed, &expected, 1, 1,
   1823 			    err_data);
   1824 
   1825 			return (-3);
   1826 		}
   1827 	}
   1828 
   1829 	x = log(10.0);
   1830 	expect_ans = 2.302585092994045;
   1831 	if (x != expect_ans) {
   1832 		if (x < (expect_ans - DPMARGIN) ||
   1833 		    x > (expect_ans + DPMARGIN)) {
   1834 			expected = *(uint64_t *)&expect_ans;
   1835 			observed = *(uint64_t *)&x;
   1836 			(void) snprintf(err_data, sizeof (err_data),
   1837 			    "\nExpected: %.16f\nObserved: %.16f",
   1838 			    expect_ans, x);
   1839 			setup_fps_test_struct(IS_EREPORT_INFO,
   1840 			    report, 6184, &observed, &expected, 1, 1,
   1841 			    err_data);
   1842 
   1843 			return (-3);
   1844 		}
   1845 	}
   1846 
   1847 	x = log(100.0);
   1848 	expect_ans = 4.605170185988091;
   1849 	if (x != expect_ans) {
   1850 		if (x < (expect_ans - DPMARGIN) ||
   1851 		    x > (expect_ans + DPMARGIN)) {
   1852 			expected = *(uint64_t *)&expect_ans;
   1853 			observed = *(uint64_t *)&x;
   1854 			(void) snprintf(err_data, sizeof (err_data),
   1855 			    "\nExpected: %.16f\nObserved: %.16f",
   1856 			    expect_ans, x);
   1857 			setup_fps_test_struct(IS_EREPORT_INFO,
   1858 			    report, 6185, &observed, &expected, 1, 1,
   1859 			    err_data);
   1860 
   1861 			return (-3);
   1862 		}
   1863 	}
   1864 
   1865 	x = log(exp(0.0));
   1866 	expect_ans = 0.0000000000000000;
   1867 	if (x != expect_ans) {
   1868 		if (x < (expect_ans - DPMARGIN) ||
   1869 		    x > (expect_ans + DPMARGIN)) {
   1870 			expected = *(uint64_t *)&expect_ans;
   1871 			observed = *(uint64_t *)&x;
   1872 			(void) snprintf(err_data, sizeof (err_data),
   1873 			    "\nExpected: %.16f\nObserved: %.16f",
   1874 			    expect_ans, x);
   1875 			setup_fps_test_struct(IS_EREPORT_INFO,
   1876 			    report, 6186, &observed, &expected, 1, 1,
   1877 			    err_data);
   1878 
   1879 			return (-3);
   1880 		}
   1881 	}
   1882 
   1883 	x = log(exp(1.0));
   1884 	expect_ans = 1.0000000000000000;
   1885 	if (x != expect_ans) {
   1886 		if (x < (expect_ans - DPMARGIN) ||
   1887 		    x > (expect_ans + DPMARGIN)) {
   1888 			expected = *(uint64_t *)&expect_ans;
   1889 			observed = *(uint64_t *)&x;
   1890 			(void) snprintf(err_data, sizeof (err_data),
   1891 			    "\nExpected: %.16f\nObserved: %.16f",
   1892 			    expect_ans, x);
   1893 			setup_fps_test_struct(IS_EREPORT_INFO,
   1894 			    report, 6187, &observed, &expected, 1, 1,
   1895 			    err_data);
   1896 
   1897 			return (-3);
   1898 		}
   1899 	}
   1900 
   1901 	x = log(exp(10.0));
   1902 	expect_ans = 10.0000000000000000;
   1903 	if (x != expect_ans) {
   1904 		if (x < (expect_ans - DPMARGIN) ||
   1905 		    x > (expect_ans + DPMARGIN)) {
   1906 			expected = *(uint64_t *)&expect_ans;
   1907 			observed = *(uint64_t *)&x;
   1908 			(void) snprintf(err_data, sizeof (err_data),
   1909 			    "\nExpected: %.16f\nObserved: %.16f",
   1910 			    expect_ans, x);
   1911 			setup_fps_test_struct(IS_EREPORT_INFO,
   1912 			    report, 6188, &observed, &expected, 1, 1,
   1913 			    err_data);
   1914 
   1915 			return (-3);
   1916 		}
   1917 	}
   1918 
   1919 	/*
   1920 	 * These functions are supported by the 68881
   1921 	 * but not the FPA
   1922 	 */
   1923 
   1924 	x = tan(-(2 * pi));
   1925 	expect_ans = -(0.000000000820414);
   1926 	if (x != expect_ans) {
   1927 		if (x < (expect_ans - DPMARGIN) ||
   1928 		    x > (expect_ans + DPMARGIN)) {
   1929 			expected = *(uint64_t *)&expect_ans;
   1930 			observed = *(uint64_t *)&x;
   1931 			(void) snprintf(err_data, sizeof (err_data),
   1932 			    "\nExpected: %.16f\nObserved: %.16f",
   1933 			    expect_ans, x);
   1934 			setup_fps_test_struct(IS_EREPORT_INFO,
   1935 			    report, 6189, &observed, &expected, 1, 1,
   1936 			    err_data);
   1937 
   1938 			return (-3);
   1939 		}
   1940 	}
   1941 
   1942 	x = tan(-(7 * pi) / 4);
   1943 	expect_ans = 0.999999998564275;
   1944 	if (x != expect_ans) {
   1945 		if (x < (expect_ans - DPMARGIN) ||
   1946 		    x > (expect_ans + DPMARGIN)) {
   1947 			expected = *(uint64_t *)&expect_ans;
   1948 			observed = *(uint64_t *)&x;
   1949 			(void) snprintf(err_data, sizeof (err_data),
   1950 			    "\nExpected: %.16f\nObserved: %.16f",
   1951 			    expect_ans, x);
   1952 			setup_fps_test_struct(IS_EREPORT_INFO,
   1953 			    report, 6190, &observed, &expected, 1, 1,
   1954 			    err_data);
   1955 
   1956 			return (-3);
   1957 		}
   1958 	}
   1959 
   1960 	x = tan(-(5 * pi) / 4);
   1961 	expect_ans = -(1.000000001025517);
   1962 	if (x != expect_ans) {
   1963 		if (x < (expect_ans - DPMARGIN) ||
   1964 		    x > (expect_ans + DPMARGIN)) {
   1965 			expected = *(uint64_t *)&expect_ans;
   1966 			observed = *(uint64_t *)&x;
   1967 			(void) snprintf(err_data, sizeof (err_data),\
   1968 			    "\nExpected: %.16f\nObserved: %.16f",
   1969 			    expect_ans, x);
   1970 			setup_fps_test_struct(IS_EREPORT_INFO,
   1971 			    report, 6191, &observed, &expected, 1, 1,
   1972 			    err_data);
   1973 
   1974 			return (-3);
   1975 		}
   1976 	}
   1977 
   1978 	x = tan(-(pi));
   1979 	expect_ans = -(0.000000000410207);
   1980 	if (x != expect_ans) {
   1981 		if (x < (expect_ans - DPMARGIN) ||
   1982 		    x > (expect_ans + DPMARGIN)) {
   1983 			expected = *(uint64_t *)&expect_ans;
   1984 			observed = *(uint64_t *)&x;
   1985 			(void) snprintf(err_data, sizeof (err_data),
   1986 			    "\nExpected: %.16f\nObserved: %.16f",
   1987 			    expect_ans, x);
   1988 			setup_fps_test_struct(IS_EREPORT_INFO,
   1989 			    report, 6192, &observed, &expected, 1, 1,
   1990 			    err_data);
   1991 
   1992 			return (-3);
   1993 		}
   1994 	}
   1995 
   1996 	x = tan(-(3 * pi) / 4);
   1997 	expect_ans = 0.999999999384690;
   1998 	if (x != expect_ans) {
   1999 		if (x < (expect_ans - DPMARGIN) ||
   2000 		    x > (expect_ans + DPMARGIN)) {
   2001 			expected = *(uint64_t *)&expect_ans;
   2002 			observed = *(uint64_t *)&x;
   2003 			(void) snprintf(err_data, sizeof (err_data),
   2004 			    "\nExpected: %.16f\nObserved: %.16f",
   2005 			    expect_ans, x);
   2006 			setup_fps_test_struct(IS_EREPORT_INFO,
   2007 			    report, 6193, &observed, &expected, 1, 1,
   2008 			    err_data);
   2009 
   2010 			return (-3);
   2011 		}
   2012 	}
   2013 
   2014 	x = tan(-(pi) / 4);
   2015 	expect_ans = -(1.000000000205103);
   2016 	if (x != expect_ans) {
   2017 		if (x < (expect_ans - DPMARGIN) ||
   2018 		    x > (expect_ans + DPMARGIN)) {
   2019 			expected = *(uint64_t *)&expect_ans;
   2020 			observed = *(uint64_t *)&x;
   2021 			(void) snprintf(err_data, sizeof (err_data),
   2022 			    "\nExpected: %.16f\nObserved: %.16f",
   2023 			    expect_ans, x);
   2024 			setup_fps_test_struct(IS_EREPORT_INFO,
   2025 			    report, 6194, &observed, &expected, 1, 1,
   2026 			    err_data);
   2027 
   2028 			return (-3);
   2029 		}
   2030 	}
   2031 
   2032 	x = tan(0.0);
   2033 	expect_ans = 0.000000000000000;
   2034 	if (x != expect_ans) {
   2035 		if (x < (expect_ans - DPMARGIN) ||
   2036 		    x > (expect_ans + DPMARGIN)) {
   2037 			expected = *(uint64_t *)&expect_ans;
   2038 			observed = *(uint64_t *)&x;
   2039 			(void) snprintf(err_data, sizeof (err_data),
   2040 			    "\nExpected: %.16f\nObserved: %.16f",
   2041 			    expect_ans, x);
   2042 			setup_fps_test_struct(IS_EREPORT_INFO,
   2043 			    report, 6195, &observed, &expected, 1, 1,
   2044 			    err_data);
   2045 
   2046 			return (-3);
   2047 		}
   2048 	}
   2049 
   2050 	x = tan(pi / 4);
   2051 	expect_ans = 1.000000000205103;
   2052 	if (x != expect_ans) {
   2053 		if (x < (expect_ans - DPMARGIN) ||
   2054 		    x > (expect_ans + DPMARGIN)) {
   2055 			expected = *(uint64_t *)&expect_ans;
   2056 			observed = *(uint64_t *)&x;
   2057 			(void) snprintf(err_data, sizeof (err_data),
   2058 			    "\nExpected: %.16f\nObserved: %.16f",
   2059 			    expect_ans, x);
   2060 			setup_fps_test_struct(IS_EREPORT_INFO,
   2061 			    report, 6196, &observed, &expected, 1, 1,
   2062 			    err_data);
   2063 
   2064 			return (-3);
   2065 		}
   2066 	}
   2067 
   2068 	x = tan((3 * pi) / 4);
   2069 	expect_ans = -(0.999999999384690);
   2070 	if (x != expect_ans) {
   2071 		if (x < (expect_ans - DPMARGIN) ||
   2072 		    x > (expect_ans + DPMARGIN)) {
   2073 			expected = *(uint64_t *)&expect_ans;
   2074 			observed = *(uint64_t *)&x;
   2075 			(void) snprintf(err_data, sizeof (err_data),
   2076 			    "\nExpected: %.16f\nObserved: %.16f",
   2077 			    expect_ans, x);
   2078 			setup_fps_test_struct(IS_EREPORT_INFO,
   2079 			    report, 6197, &observed, &expected, 1, 1,
   2080 			    err_data);
   2081 
   2082 			return (-3);
   2083 		}
   2084 	}
   2085 
   2086 	x = tan(pi);
   2087 	expect_ans = 0.000000000410207;
   2088 	if (x != expect_ans) {
   2089 		if (x < (expect_ans - DPMARGIN) ||
   2090 		    x > (expect_ans + DPMARGIN)) {
   2091 			expected = *(uint64_t *)&expect_ans;
   2092 			observed = *(uint64_t *)&x;
   2093 			(void) snprintf(err_data, sizeof (err_data),
   2094 			    "\nExpected: %.16f\nObserved: %.16f",
   2095 			    expect_ans, x);
   2096 			setup_fps_test_struct(IS_EREPORT_INFO,
   2097 			    report, 6198, &observed, &expected, 1, 1,
   2098 			    err_data);
   2099 
   2100 			return (-3);
   2101 		}
   2102 	}
   2103 
   2104 	x = tan((5 * pi) / 4);
   2105 	expect_ans = 1.000000001025517;
   2106 	if (x != expect_ans) {
   2107 		if (x < (expect_ans - DPMARGIN) ||
   2108 		    x > (expect_ans + DPMARGIN)) {
   2109 			expected = *(uint64_t *)&expect_ans;
   2110 			observed = *(uint64_t *)&x;
   2111 			(void) snprintf(err_data, sizeof (err_data),
   2112 			    "\nExpected: %.16f\nObserved: %.16f",
   2113 			    expect_ans, x);
   2114 			setup_fps_test_struct(IS_EREPORT_INFO,
   2115 			    report, 6199, &observed, &expected, 1, 1,
   2116 			    err_data);
   2117 
   2118 			return (-3);
   2119 		}
   2120 	}
   2121 
   2122 	x = tan((7 * pi) / 4);
   2123 	expect_ans = -(0.999999998564275);
   2124 	if (x != expect_ans) {
   2125 		if (x < (expect_ans - DPMARGIN) ||
   2126 		    x > (expect_ans + DPMARGIN)) {
   2127 			expected = *(uint64_t *)&expect_ans;
   2128 			observed = *(uint64_t *)&x;
   2129 			(void) snprintf(err_data, sizeof (err_data),
   2130 			    "\nExpected: %.16f\nObserved: %.16f",
   2131 			    expect_ans, x);
   2132 			setup_fps_test_struct(IS_EREPORT_INFO,
   2133 			    report, 6200, &observed, &expected, 1, 1,
   2134 			    err_data);
   2135 
   2136 			return (-3);
   2137 		}
   2138 	}
   2139 
   2140 	x = tan((2 * pi));
   2141 	expect_ans = 0.000000000820414;
   2142 	if (x != expect_ans) {
   2143 		if (x < (expect_ans - DPMARGIN) ||
   2144 		    x > (expect_ans + DPMARGIN)) {
   2145 			expected = *(uint64_t *)&expect_ans;
   2146 			observed = *(uint64_t *)&x;
   2147 			(void) snprintf(err_data, sizeof (err_data),
   2148 			    "\nExpected: %.16f\nObserved: %.16f",
   2149 			    expect_ans, x);
   2150 			setup_fps_test_struct(IS_EREPORT_INFO,
   2151 			    report, 6201, &observed, &expected, 1, 1,
   2152 			    err_data);
   2153 
   2154 			return (-3);
   2155 		}
   2156 	}
   2157 
   2158 	x = sqrt(0.0);
   2159 	expect_ans = 0.000000000000000;
   2160 	if (x != expect_ans) {
   2161 		if (x < (expect_ans - DPMARGIN) ||
   2162 		    x > (expect_ans + DPMARGIN)) {
   2163 			expected = *(uint64_t *)&expect_ans;
   2164 			observed = *(uint64_t *)&x;
   2165 			(void) snprintf(err_data, sizeof (err_data),
   2166 			    "\nExpected: %.16f\nObserved: %.16f",
   2167 			    expect_ans, x);
   2168 			setup_fps_test_struct(IS_EREPORT_INFO,
   2169 			    report, 6202, &observed, &expected, 1, 1,
   2170 			    err_data);
   2171 
   2172 			return (-3);
   2173 		}
   2174 	}
   2175 
   2176 	x = sqrt(1.0);
   2177 	expect_ans = 1.000000000000000;
   2178 	if (x != expect_ans) {
   2179 		if (x < (expect_ans - DPMARGIN) ||
   2180 		    x > (expect_ans + DPMARGIN)) {
   2181 			expected = *(uint64_t *)&expect_ans;
   2182 			observed = *(uint64_t *)&x;
   2183 			(void) snprintf(err_data, sizeof (err_data),
   2184 			    "\nExpected: %.16f\nObserved: %.16f",
   2185 			    expect_ans, x);
   2186 			setup_fps_test_struct(IS_EREPORT_INFO,
   2187 			    report, 6203, &observed, &expected, 1, 1,
   2188 			    err_data);
   2189 
   2190 			return (-3);
   2191 		}
   2192 	}
   2193 
   2194 	x = sqrt(4.0);
   2195 	expect_ans = 2.000000000000000;
   2196 	if (x != expect_ans) {
   2197 		if (x < (expect_ans - DPMARGIN) ||
   2198 		    x > (expect_ans + DPMARGIN)) {
   2199 			expected = *(uint64_t *)&expect_ans;
   2200 			observed = *(uint64_t *)&x;
   2201 			(void) snprintf(err_data, sizeof (err_data),
   2202 			    "\nExpected: %.16f\nObserved: %.16f",
   2203 			    expect_ans, x);
   2204 			setup_fps_test_struct(IS_EREPORT_INFO,
   2205 			    report, 6204, &observed, &expected, 1, 1,
   2206 			    err_data);
   2207 
   2208 			return (-3);
   2209 		}
   2210 	}
   2211 
   2212 	x = sqrt(9.0);
   2213 	expect_ans = 3.000000000000000;
   2214 	if (x != expect_ans) {
   2215 		if (x < (expect_ans - DPMARGIN) ||
   2216 		    x > (expect_ans + DPMARGIN)) {
   2217 			expected = *(uint64_t *)&expect_ans;
   2218 			observed = *(uint64_t *)&x;
   2219 			(void) snprintf(err_data, sizeof (err_data),
   2220 			    "\nExpected: %.16f\nObserved: %.16f",
   2221 			    expect_ans, x);
   2222 			setup_fps_test_struct(IS_EREPORT_INFO,
   2223 			    report, 6205, &observed, &expected, 1, 1,
   2224 			    err_data);
   2225 
   2226 			return (-3);
   2227 		}
   2228 	}
   2229 
   2230 	x = sqrt(16.0);
   2231 	expect_ans = 4.000000000000000;
   2232 	if (x != expect_ans) {
   2233 		if (x < (expect_ans - DPMARGIN) ||
   2234 		    x > (expect_ans + DPMARGIN)) {
   2235 			expected = *(uint64_t *)&expect_ans;
   2236 			observed = *(uint64_t *)&x;
   2237 			(void) snprintf(err_data, sizeof (err_data),
   2238 			    "\nExpected: %.16f\nObserved: %.16f",
   2239 			    expect_ans, x);
   2240 			setup_fps_test_struct(IS_EREPORT_INFO,
   2241 			    report, 6206, &observed, &expected, 1, 1,
   2242 			    err_data);
   2243 
   2244 			return (-3);
   2245 		}
   2246 	}
   2247 
   2248 	x = sqrt(25.0);
   2249 	expect_ans = 5.000000000000000;
   2250 	if (x != expect_ans) {
   2251 		if (x < (expect_ans - DPMARGIN) ||
   2252 		    x > (expect_ans + DPMARGIN)) {
   2253 			expected = *(uint64_t *)&expect_ans;
   2254 			observed = *(uint64_t *)&x;
   2255 			(void) snprintf(err_data, sizeof (err_data),
   2256 			    "\nExpected: %.16f\nObserved: %.16f",
   2257 			    expect_ans, x);
   2258 			setup_fps_test_struct(IS_EREPORT_INFO,
   2259 			    report, 6207, &observed, &expected, 1, 1,
   2260 			    err_data);
   2261 
   2262 			return (-3);
   2263 		}
   2264 	}
   2265 
   2266 	x = sqrt(36.0);
   2267 	expect_ans = 6.000000000000000;
   2268 	if (x != expect_ans) {
   2269 		if (x < (expect_ans - DPMARGIN) ||
   2270 		    x > (expect_ans + DPMARGIN)) {
   2271 			expected = *(uint64_t *)&expect_ans;
   2272 			observed = *(uint64_t *)&x;
   2273 			(void) snprintf(err_data, sizeof (err_data),
   2274 			    "\nExpected: %.16f\nObserved: %.16f",
   2275 			    expect_ans, x);
   2276 			setup_fps_test_struct(IS_EREPORT_INFO,
   2277 			    report, 6208, &observed, &expected, 1, 1,
   2278 			    err_data);
   2279 
   2280 			return (-3);
   2281 		}
   2282 	}
   2283 
   2284 	x = sqrt(49.0);
   2285 	expect_ans = 7.000000000000000;
   2286 	if (x != expect_ans) {
   2287 		if (x < (expect_ans - DPMARGIN) ||
   2288 		    x > (expect_ans + DPMARGIN)) {
   2289 			expected = *(uint64_t *)&expect_ans;
   2290 			observed = *(uint64_t *)&x;
   2291 			(void) snprintf(err_data, sizeof (err_data),
   2292 			    "\nExpected: %.16f\nObserved: %.16f",
   2293 			    expect_ans, x);
   2294 			setup_fps_test_struct(IS_EREPORT_INFO,
   2295 			    report, 6209, &observed, &expected, 1, 1,
   2296 			    err_data);
   2297 
   2298 			return (-3);
   2299 		}
   2300 	}
   2301 
   2302 	x = sqrt(64.0);
   2303 	expect_ans = 8.000000000000000;
   2304 	if (x != expect_ans) {
   2305 		if (x < (expect_ans - DPMARGIN) ||
   2306 		    x > (expect_ans + DPMARGIN)) {
   2307 			expected = *(uint64_t *)&expect_ans;
   2308 			observed = *(uint64_t *)&x;
   2309 			(void) snprintf(err_data, sizeof (err_data),
   2310 			    "\nExpected: %.16f\nObserved: %.16f",
   2311 			    expect_ans, x);
   2312 			setup_fps_test_struct(IS_EREPORT_INFO,
   2313 			    report, 6210, &observed, &expected, 1, 1,
   2314 			    err_data);
   2315 
   2316 			return (-3);
   2317 		}
   2318 	}
   2319 
   2320 	x = sqrt(81.0);
   2321 	expect_ans = 9.000000000000000;
   2322 	if (x != expect_ans) {
   2323 		if (x < (expect_ans - DPMARGIN) ||
   2324 		    x > (expect_ans + DPMARGIN)) {
   2325 			expected = *(uint64_t *)&expect_ans;
   2326 			observed = *(uint64_t *)&x;
   2327 			(void) snprintf(err_data, sizeof (err_data),
   2328 			    "\nExpected: %.16f\nObserved: %.16f",
   2329 			    expect_ans, x);
   2330 			setup_fps_test_struct(IS_EREPORT_INFO,
   2331 			    report, 6211, &observed, &expected, 1, 1,
   2332 			    err_data);
   2333 
   2334 			return (-3);
   2335 		}
   2336 	}
   2337 
   2338 	x = sqrt(100.0);
   2339 	expect_ans = 10.000000000000000;
   2340 	if (x != expect_ans) {
   2341 		if (x < (expect_ans - DPMARGIN) ||
   2342 		    x > (expect_ans + DPMARGIN)) {
   2343 			expected = *(uint64_t *)&expect_ans;
   2344 			observed = *(uint64_t *)&x;
   2345 			(void) snprintf(err_data, sizeof (err_data),
   2346 			    "\nExpected: %.16f\nObserved: %.16f",
   2347 			    expect_ans, x);
   2348 			setup_fps_test_struct(IS_EREPORT_INFO,
   2349 			    report, 6212, &observed, &expected, 1, 1,
   2350 			    err_data);
   2351 
   2352 			return (-3);
   2353 		}
   2354 	}
   2355 
   2356 	return (0);
   2357 }
   2358 
   2359 /*
   2360  * process_fpu_args(int argc, char *argv[])
   2361  * processes the args passed into main()
   2362  * and sets the appropriate global vars.
   2363  */
   2364 static void
   2365 process_fpu_args(int argc, char *argv[])
   2366 {
   2367 	char l_buf[32];
   2368 	char *px;
   2369 	int opt;
   2370 
   2371 	while ((opt = getopt(argc, argv, "s:d:p:f:vnhe")) != EOF) {
   2372 	switch (opt) {
   2373 		case 'P': /* -p N or -p all or no -p */
   2374 		case 'p':
   2375 
   2376 			(void) memset(l_buf, 0, sizeof (l_buf));
   2377 			test_group = -1;
   2378 			if (NULL != optarg) {
   2379 			(void) strncpy(l_buf, optarg, 3);	/* -p all */
   2380 			if (!strncasecmp(l_buf, "all", 3)) {
   2381 				test_group = 12345;
   2382 				break;
   2383 				}
   2384 				test_group = atoi(optarg);
   2385 				if ((0 == test_group) && strcmp(optarg, "0"))
   2386 					test_group = -1;
   2387 			}
   2388 
   2389 			if (test_group < 0) {
   2390 				_exit(FPU_INVALID_ARG);
   2391 			}
   2392 			break;
   2393 		case 'f': /* 1000,1500,2000 freq */
   2394 		case 'F':
   2395 			(void) memset(l_buf, 0, sizeof (l_buf));
   2396 			if (NULL != optarg) {
   2397 				/* -f 1000 */
   2398 				(void) strncpy(l_buf, optarg, 5);
   2399 
   2400 				proc_fr = atoi(optarg);
   2401 
   2402 				switch (proc_fr) {
   2403 				case 1000 :
   2404 					lowstresslapagroup_len =
   2405 					    lowstresslapagroup1000_len;
   2406 					lowstresslapagroup =
   2407 					    LowStressLapaGroup_1000;
   2408 					break;
   2409 				case 1500 :
   2410 					lowstresslapagroup_len =
   2411 					    lowstresslapagroup1500_len;
   2412 					lowstresslapagroup =
   2413 					    LowStressLapaGroup_1500;
   2414 					break;
   2415 				case 2000 :
   2416 					lowstresslapagroup_len =
   2417 					    lowstresslapagroup2000_len;
   2418 					lowstresslapagroup =
   2419 					    LowStressLapaGroup_2000;
   2420 					break;
   2421 				default :
   2422 					if (proc_fr < 1500) {
   2423 						lowstresslapagroup_len =
   2424 						    lowstresslapagroup1000_len;
   2425 						lowstresslapagroup =
   2426 						    LowStressLapaGroup_1000;
   2427 						break;
   2428 					} else if (proc_fr < 2000) {
   2429 						lowstresslapagroup_len =
   2430 						    lowstresslapagroup1500_len;
   2431 						lowstresslapagroup =
   2432 						    LowStressLapaGroup_1500;
   2433 						break;
   2434 					} else {
   2435 						lowstresslapagroup_len =
   2436 						    lowstresslapagroup2000_len;
   2437 						lowstresslapagroup =
   2438 						    LowStressLapaGroup_2000;
   2439 						break;
   2440 					}
   2441 				}
   2442 			}
   2443 			break;
   2444 		case 'd':
   2445 			if (optarg == NULL)
   2446 				_exit(FPU_INVALID_ARG);
   2447 
   2448 			fpu_cpu = atoi(optarg);
   2449 
   2450 			if (fpu_cpu == 0 && strcmp(optarg, "0"))
   2451 				_exit(FPU_INVALID_ARG);
   2452 
   2453 			if (is_cpu_on(fpu_cpu))
   2454 				_exit(FPU_BIND_FAIL);
   2455 			break;
   2456 		case 'E':
   2457 		case 'e':
   2458 			fps_exec_time = 1;
   2459 			break;
   2460 		case 'V':
   2461 		case 'v':
   2462 			fps_verbose_msg = 1;
   2463 			break;
   2464 		case 'S':
   2465 		case 's':
   2466 			(void) memset(l_buf, 0, sizeof (l_buf));
   2467 			stress_level = 1;
   2468 
   2469 			if (NULL != optarg) {
   2470 				(void) strncpy(l_buf, optarg, 2);
   2471 
   2472 				if (('X' != l_buf[0]) && (0 != l_buf[1]))
   2473 					l_buf[0] = 'E';
   2474 
   2475 				switch (l_buf[0]) {
   2476 				case 'l':
   2477 				case 'L':
   2478 				case '1':
   2479 					stress_level = 1;
   2480 					limit_group = 1;
   2481 					break;
   2482 				case 'm':
   2483 				case 'M':
   2484 				case '2':
   2485 					stress_level = 1000;
   2486 					limit_group = 2;
   2487 					break;
   2488 				case 'h':
   2489 				case 'H':
   2490 				case '3':
   2491 					stress_level = 4000;
   2492 					limit_group = 3;
   2493 					break;
   2494 				case 'X':
   2495 					px = optarg + 1;
   2496 					stress_level = 10000;
   2497 					limit_group = 3;
   2498 
   2499 					if (NULL != px) {
   2500 						stress_level = atoi(px);
   2501 						if ((0 == stress_level) ||
   2502 						    (stress_level > 10000) ||
   2503 						    (stress_level < 1000) ||
   2504 						    (0 != stress_level % 1000))
   2505 							stress_level = 10000;
   2506 					}
   2507 					break;
   2508 				default:
   2509 					stress_level = 1;
   2510 					limit_group = 1;
   2511 					break;
   2512 				}
   2513 			}
   2514 			break;
   2515 		default:
   2516 			_exit(FPU_INVALID_ARG);
   2517 			break;
   2518 		}
   2519 	}
   2520 }
   2521 
   2522 /*
   2523  * is_cpu_on(int unit) checks to see if processor
   2524  * unit is online.
   2525  */
   2526 static int
   2527 is_cpu_on(int unit)
   2528 {
   2529 	int proc_stat;
   2530 
   2531 	proc_stat = p_online(unit, P_STATUS);
   2532 
   2533 	if (P_ONLINE == proc_stat)
   2534 		return (0);
   2535 
   2536 	return (1);
   2537 }
   2538 
   2539 /*
   2540  * check_proc(int cpu_id) checks to see that we're on an
   2541  * fpscrubber supported processor specified by cpu_id.
   2542  */
   2543 static int
   2544 check_proc(int cpu_id)
   2545 {
   2546 	char brand[40];
   2547 	kstat_ctl_t *kc;
   2548 	kstat_t *ksp;
   2549 	kstat_named_t *knp;
   2550 
   2551 
   2552 	/* grab kstat info */
   2553 	if ((kc = kstat_open()) == NULL)
   2554 		return (1);
   2555 
   2556 	if ((ksp = kstat_lookup(kc, "cpu_info", (int)cpu_id, NULL)) == NULL) {
   2557 		(void) kstat_close(kc);
   2558 
   2559 		return (1);
   2560 	}
   2561 
   2562 	if ((kstat_read(kc, ksp, NULL)) == -1) {
   2563 		(void) kstat_close(kc);
   2564 
   2565 		return (1);
   2566 	}
   2567 
   2568 	if ((knp = kstat_data_lookup(ksp, "brand")) == NULL) {
   2569 		(void) kstat_close(kc);
   2570 
   2571 		return (1);
   2572 	}
   2573 
   2574 	if (snprintf(brand, MAX_CPU_BRAND, "%s",
   2575 	    KSTAT_NAMED_STR_PTR(knp)) < 0) {
   2576 		(void) kstat_close(kc);
   2577 
   2578 		return (1);
   2579 	}
   2580 
   2581 	/* check against supported CPUs */
   2582 
   2583 	if (strcmp(brand, USIII_KSTAT) != 0 &&
   2584 	    strcmp(brand, USIIIi_KSTAT) != 0 &&
   2585 	    strcmp(brand, USIIIP_KSTAT) != 0 &&
   2586 	    strcmp(brand, USIV_KSTAT) != 0 &&
   2587 	    strcmp(brand, USIVP_KSTAT) != 0) {
   2588 			(void) kstat_close(kc);
   2589 
   2590 			return (2);
   2591 	}
   2592 
   2593 	(void) kstat_close(kc);
   2594 
   2595 	return (0);
   2596 }
   2597