summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hauser <jhauser@eecs.berkeley.edu>2016-07-22 18:04:32 -0700
committerJohn Hauser <jhauser@eecs.berkeley.edu>2016-07-22 18:04:32 -0700
commitddfb9e70c434ae238635784ce66cb7ed93d0a2e7 (patch)
tree3502b5d96dcdbc5ad0c16c00caf4cd21428314b3
parent11a6a656c7651695deacfdcda9c5d80fdbc05fee (diff)
downloadberkeley-testfloat-3-ddfb9e70c434ae238635784ce66cb7ed93d0a2e7.tar.gz
Release 3b. See "doc/TestFloat-history.html".
-rw-r--r--COPYING.txt8
-rw-r--r--README.html20
-rw-r--r--README.md26
-rw-r--r--README.txt4
-rw-r--r--build/Linux-386-GCC/Makefile47
-rw-r--r--build/Linux-386-GCC/platform.h10
-rw-r--r--build/Linux-386-SSE2-GCC/Makefile47
-rw-r--r--build/Linux-386-SSE2-GCC/platform.h10
-rw-r--r--build/Linux-x86_64-GCC/Makefile47
-rw-r--r--build/Linux-x86_64-GCC/platform.h10
-rw-r--r--build/Win32-MinGW/Makefile47
-rw-r--r--build/Win32-MinGW/platform.h10
-rw-r--r--build/Win32-SSE2-MinGW/Makefile47
-rw-r--r--build/Win32-SSE2-MinGW/platform.h10
-rw-r--r--build/Win64-MinGW-w64/Makefile47
-rw-r--r--build/Win64-MinGW-w64/platform.h10
-rw-r--r--build/template/Makefile47
-rw-r--r--build/template/platform.h10
-rw-r--r--doc/TestFloat-general.html374
-rw-r--r--doc/TestFloat-history.html42
-rw-r--r--doc/TestFloat-source.html73
-rw-r--r--doc/testfloat.html22
-rw-r--r--doc/testfloat_gen.html27
-rw-r--r--doc/testfloat_ver.html11
-rw-r--r--doc/testsoftfloat.html19
-rw-r--r--doc/timesoftfloat.html17
-rw-r--r--source/fail.c2
-rw-r--r--source/fail.h2
-rw-r--r--source/functionInfos.c77
-rw-r--r--source/functions.h76
-rw-r--r--source/functions_common.c2
-rw-r--r--source/genCases.h16
-rw-r--r--source/genCases_common.c2
-rw-r--r--source/genCases_extF80.c2
-rw-r--r--source/genCases_f128.c2
-rw-r--r--source/genCases_f16.c585
-rw-r--r--source/genCases_f32.c2
-rw-r--r--source/genCases_f64.c10
-rw-r--r--source/genCases_i32.c2
-rw-r--r--source/genCases_i64.c2
-rw-r--r--source/genCases_ui32.c2
-rw-r--r--source/genCases_ui64.c2
-rw-r--r--source/genCases_writeTestsTotal.c2
-rw-r--r--source/genLoops.c659
-rw-r--r--source/genLoops.h69
-rw-r--r--source/random.c2
-rw-r--r--source/random.h2
-rw-r--r--source/readHex.c2
-rw-r--r--source/readHex.h2
-rw-r--r--source/slowfloat.c688
-rw-r--r--source/slowfloat.h63
-rw-r--r--source/standardFunctionInfos.c101
-rw-r--r--source/subj-C/subjfloat.c2
-rw-r--r--source/subjfloat.h107
-rw-r--r--source/subjfloat_functions.c385
-rw-r--r--source/testLoops.h114
-rw-r--r--source/testLoops_common.c2
-rw-r--r--source/test_a_extF80_z_f128.c2
-rw-r--r--source/test_a_extF80_z_f16.c107
-rw-r--r--source/test_a_extF80_z_f32.c2
-rw-r--r--source/test_a_extF80_z_f64.c2
-rw-r--r--source/test_a_extF80_z_i32_rx.c2
-rw-r--r--source/test_a_extF80_z_i32_x.c2
-rw-r--r--source/test_a_extF80_z_i64_rx.c2
-rw-r--r--source/test_a_extF80_z_i64_x.c2
-rw-r--r--source/test_a_extF80_z_ui32_rx.c2
-rw-r--r--source/test_a_extF80_z_ui32_x.c2
-rw-r--r--source/test_a_extF80_z_ui64_rx.c2
-rw-r--r--source/test_a_extF80_z_ui64_x.c2
-rw-r--r--source/test_a_f128_z_extF80.c2
-rw-r--r--source/test_a_f128_z_f16.c107
-rw-r--r--source/test_a_f128_z_f32.c2
-rw-r--r--source/test_a_f128_z_f64.c2
-rw-r--r--source/test_a_f128_z_i32_rx.c2
-rw-r--r--source/test_a_f128_z_i32_x.c2
-rw-r--r--source/test_a_f128_z_i64_rx.c2
-rw-r--r--source/test_a_f128_z_i64_x.c2
-rw-r--r--source/test_a_f128_z_ui32_rx.c2
-rw-r--r--source/test_a_f128_z_ui32_x.c2
-rw-r--r--source/test_a_f128_z_ui64_rx.c2
-rw-r--r--source/test_a_f128_z_ui64_x.c2
-rw-r--r--source/test_a_f16_z_extF80.c106
-rw-r--r--source/test_a_f16_z_f128.c106
-rw-r--r--source/test_a_f16_z_f32.c104
-rw-r--r--source/test_a_f16_z_f64.c104
-rw-r--r--source/test_a_f16_z_i32_rx.c104
-rw-r--r--source/test_a_f16_z_i32_x.c103
-rw-r--r--source/test_a_f16_z_i64_rx.c105
-rw-r--r--source/test_a_f16_z_i64_x.c104
-rw-r--r--source/test_a_f16_z_ui32_rx.c104
-rw-r--r--source/test_a_f16_z_ui32_x.c103
-rw-r--r--source/test_a_f16_z_ui64_rx.c104
-rw-r--r--source/test_a_f16_z_ui64_x.c103
-rw-r--r--source/test_a_f32_z_extF80.c2
-rw-r--r--source/test_a_f32_z_f128.c2
-rw-r--r--source/test_a_f32_z_f16.c104
-rw-r--r--source/test_a_f32_z_f64.c2
-rw-r--r--source/test_a_f32_z_i32_rx.c2
-rw-r--r--source/test_a_f32_z_i32_x.c2
-rw-r--r--source/test_a_f32_z_i64_rx.c2
-rw-r--r--source/test_a_f32_z_i64_x.c2
-rw-r--r--source/test_a_f32_z_ui32_rx.c2
-rw-r--r--source/test_a_f32_z_ui32_x.c2
-rw-r--r--source/test_a_f32_z_ui64_rx.c2
-rw-r--r--source/test_a_f32_z_ui64_x.c2
-rw-r--r--source/test_a_f64_z_extF80.c2
-rw-r--r--source/test_a_f64_z_f128.c2
-rw-r--r--source/test_a_f64_z_f16.c104
-rw-r--r--source/test_a_f64_z_f32.c2
-rw-r--r--source/test_a_f64_z_i32_rx.c2
-rw-r--r--source/test_a_f64_z_i32_x.c2
-rw-r--r--source/test_a_f64_z_i64_rx.c2
-rw-r--r--source/test_a_f64_z_i64_x.c2
-rw-r--r--source/test_a_f64_z_ui32_rx.c2
-rw-r--r--source/test_a_f64_z_ui32_x.c2
-rw-r--r--source/test_a_f64_z_ui64_rx.c2
-rw-r--r--source/test_a_f64_z_ui64_x.c2
-rw-r--r--source/test_a_i32_z_extF80.c2
-rw-r--r--source/test_a_i32_z_f128.c2
-rw-r--r--source/test_a_i32_z_f16.c99
-rw-r--r--source/test_a_i32_z_f32.c2
-rw-r--r--source/test_a_i32_z_f64.c2
-rw-r--r--source/test_a_i64_z_extF80.c2
-rw-r--r--source/test_a_i64_z_f128.c2
-rw-r--r--source/test_a_i64_z_f16.c99
-rw-r--r--source/test_a_i64_z_f32.c2
-rw-r--r--source/test_a_i64_z_f64.c2
-rw-r--r--source/test_a_ui32_z_extF80.c2
-rw-r--r--source/test_a_ui32_z_f128.c2
-rw-r--r--source/test_a_ui32_z_f16.c99
-rw-r--r--source/test_a_ui32_z_f32.c2
-rw-r--r--source/test_a_ui32_z_f64.c2
-rw-r--r--source/test_a_ui64_z_extF80.c2
-rw-r--r--source/test_a_ui64_z_f128.c2
-rw-r--r--source/test_a_ui64_z_f16.c99
-rw-r--r--source/test_a_ui64_z_f32.c2
-rw-r--r--source/test_a_ui64_z_f64.c2
-rw-r--r--source/test_ab_extF80_z_bool.c2
-rw-r--r--source/test_ab_f128_z_bool.c2
-rw-r--r--source/test_ab_f16_z_bool.c103
-rw-r--r--source/test_ab_f32_z_bool.c2
-rw-r--r--source/test_ab_f64_z_bool.c2
-rw-r--r--source/test_abcz_f128.c2
-rw-r--r--source/test_abcz_f16.c111
-rw-r--r--source/test_abcz_f32.c2
-rw-r--r--source/test_abcz_f64.c2
-rw-r--r--source/test_abz_extF80.c2
-rw-r--r--source/test_abz_f128.c2
-rw-r--r--source/test_abz_f16.c108
-rw-r--r--source/test_abz_f32.c2
-rw-r--r--source/test_abz_f64.c2
-rw-r--r--source/test_az_extF80.c2
-rw-r--r--source/test_az_extF80_rx.c2
-rw-r--r--source/test_az_f128.c2
-rw-r--r--source/test_az_f128_rx.c2
-rw-r--r--source/test_az_f16.c104
-rw-r--r--source/test_az_f16_rx.c109
-rw-r--r--source/test_az_f32.c2
-rw-r--r--source/test_az_f32_rx.c2
-rw-r--r--source/test_az_f64.c2
-rw-r--r--source/test_az_f64_rx.c2
-rw-r--r--source/testfloat.c458
-rw-r--r--source/testfloat_gen.c170
-rw-r--r--source/testfloat_ver.c139
-rw-r--r--source/testsoftfloat.c196
-rw-r--r--source/timesoftfloat.c1804
-rw-r--r--source/uint128.c2
-rw-r--r--source/uint128.h16
-rw-r--r--source/uint128_inline.c56
-rw-r--r--source/verCases.h48
-rw-r--r--source/verCases_common.c2
-rw-r--r--source/verCases_inline.c134
-rw-r--r--source/verCases_writeFunctionName.c2
-rw-r--r--source/verLoops.c1270
-rw-r--r--source/verLoops.h64
-rw-r--r--source/writeCase.h14
-rw-r--r--source/writeCase_a_extF80M.c2
-rw-r--r--source/writeCase_a_f128M.c2
-rw-r--r--source/writeCase_a_f16.c55
-rw-r--r--source/writeCase_a_f32.c2
-rw-r--r--source/writeCase_a_f64.c2
-rw-r--r--source/writeCase_a_ui32.c2
-rw-r--r--source/writeCase_a_ui64.c2
-rw-r--r--source/writeCase_ab_extF80M.c2
-rw-r--r--source/writeCase_ab_f128M.c2
-rw-r--r--source/writeCase_ab_f16.c57
-rw-r--r--source/writeCase_ab_f32.c2
-rw-r--r--source/writeCase_ab_f64.c2
-rw-r--r--source/writeCase_abc_extF80M.c2
-rw-r--r--source/writeCase_abc_f128M.c2
-rw-r--r--source/writeCase_abc_f16.c57
-rw-r--r--source/writeCase_abc_f32.c2
-rw-r--r--source/writeCase_abc_f64.c2
-rw-r--r--source/writeCase_z_bool.c2
-rw-r--r--source/writeCase_z_extF80M.c2
-rw-r--r--source/writeCase_z_f128M.c2
-rw-r--r--source/writeCase_z_f16.c63
-rw-r--r--source/writeCase_z_f32.c2
-rw-r--r--source/writeCase_z_f64.c2
-rw-r--r--source/writeCase_z_ui32.c2
-rw-r--r--source/writeCase_z_ui64.c2
-rw-r--r--source/writeHex.c38
-rw-r--r--source/writeHex.h9
203 files changed, 10439 insertions, 1046 deletions
diff --git a/COPYING.txt b/COPYING.txt
index 58dd1da..99a2eb5 100644
--- a/COPYING.txt
+++ b/COPYING.txt
@@ -1,14 +1,14 @@
-License for Berkeley TestFloat Release 3a
+License for Berkeley TestFloat Release 3b
John R. Hauser
-2015 October 23
+2016 July 22
The following applies to the whole of TestFloat Release 3a as well as to
each source file individually.
-Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
-California. All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University
+of California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
diff --git a/README.html b/README.html
index 45ffeb1..cdc9027 100644
--- a/README.html
+++ b/README.html
@@ -7,11 +7,11 @@
<BODY>
-<H1>Package Overview for Berkeley TestFloat Release 3a</H1>
+<H1>Package Overview for Berkeley TestFloat Release 3b</H1>
<P>
John R. Hauser<BR>
-2015 October 23<BR>
+2016 July 22<BR>
</P>
<P>
@@ -27,48 +27,48 @@ The TestFloat package is documented in the following files in the
<BLOCKQUOTE>
<TABLE>
<TR>
-<TD><A HREF="doc/TestFloat-general.html"><CODE>TestFloat-general.html</CODE></A></TD>
+<TD><A HREF="doc/TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A></TD>
<TD>
General documentation for understanding and using the TestFloat programs.
</TD>
</TR>
-<TD><A HREF="doc/testfloat_gen.html"><CODE>testfloat_gen.html</CODE></A></TD>
+<TD><A HREF="doc/testfloat_gen.html"><NOBR><CODE>testfloat_gen.html</CODE></NOBR></A></TD>
<TD>
Specific documentation for the <CODE>testfloat_gen</CODE> program.
</TD>
</TR>
<TR>
-<TD><A HREF="doc/testfloat_ver.html"><CODE>testfloat_ver.html</CODE></A></TD>
+<TD><A HREF="doc/testfloat_ver.html"><NOBR><CODE>testfloat_ver.html</CODE></NOBR></A></TD>
<TD>
Specific documentation for the <CODE>testfloat_ver</CODE> program.
</TD>
</TR>
<TR>
-<TD><A HREF="doc/testfloat.html"><CODE>testfloat.html</CODE></A></TD>
+<TD><A HREF="doc/testfloat.html"><NOBR><CODE>testfloat.html</CODE></NOBR></A></TD>
<TD>
Specific documentation for the all-in-one <CODE>testfloat</CODE> program.
</TD>
</TR>
<TR>
-<TD><A HREF="doc/testsoftfloat.html"><CODE>testsoftfloat.html</CODE></A></TD>
+<TD><A HREF="doc/testsoftfloat.html"><NOBR><CODE>testsoftfloat.html</CODE></NOBR></A></TD>
<TD>
Specific documentation for the <CODE>testsoftfloat</CODE> program.
</TD>
</TR>
<TR>
-<TD><A HREF="doc/timesoftfloat.html"><CODE>timesoftfloat.html</CODE></A></TD>
+<TD><A HREF="doc/timesoftfloat.html"><NOBR><CODE>timesoftfloat.html</CODE></NOBR></A></TD>
<TD>
Specific documentation for the <CODE>timesoftfloat</CODE> program.
</TD>
</TR>
<TR>
-<TD><A HREF="doc/TestFloat-source.html"><CODE>TestFloat-source.html</CODE></A></TD>
+<TD><A HREF="doc/TestFloat-source.html"><NOBR><CODE>TestFloat-source.html</CODE></NOBR></A></TD>
<TD>
Documentation for building TestFloat.
</TD>
</TR>
<TR>
-<TD><A HREF="doc/TestFloat-history.html"><CODE>TestFloat-history.html</CODE></A><CODE>&nbsp;&nbsp;&nbsp;</CODE></TD>
+<TD><A HREF="doc/TestFloat-history.html"><NOBR><CODE>TestFloat-history.html</CODE></NOBR></A><CODE>&nbsp;&nbsp;&nbsp;</CODE></TD>
<TD>
History of the major changes to TestFloat.
</TD>
diff --git a/README.md b/README.md
index fd15676..c0e281d 100644
--- a/README.md
+++ b/README.md
@@ -1,28 +1,28 @@
-Package Overview for Berkeley TestFloat Release 3a
+Package Overview for Berkeley TestFloat Release 3b
==================================================
John R. Hauser<br>
-2015 October 23
+2016 July 22
Berkeley TestFloat is a small collection of programs for testing that an
implementation of binary floating-point conforms to the IEEE Standard for
-Floating-Point Arithmetic. TestFloat is distributed in the form of C source
+Floating-Point Arithmetic. TestFloat is distributed in the form of C source
code.
-The TestFloat package is documented in the following files in the
-`doc` subdirectory:
+The TestFloat package is documented in the following files in the `doc`
+subdirectory:
-* [TestFloat-general.html](http://www.jhauser.us/arithmetic/TestFloat-3a/doc/TestFloat-general.html) General documentation for understanding and using the TestFloat programs.
-* [testfloat_gen.html](http://www.jhauser.us/arithmetic/TestFloat-3a/doc/testfloat_gen.html) Specific documentation for the `testfloat_gen` program.
-* [testfloat_ver.html](http://www.jhauser.us/arithmetic/TestFloat-3a/doc/testfloat_ver.html) Specific documentation for the `testfloat_ver` program.
-* [testfloat.html](http://www.jhauser.us/arithmetic/TestFloat-3a/doc/testfloat.html) Specific documentation for the all-in-one `testfloat` program.
-* [testsoftfloat.html](http://www.jhauser.us/arithmetic/TestFloat-3a/doc/testsoftfloat.html) Specific documentation for the `testsoftfloat` program.
-* [timesoftfloat.html](http://www.jhauser.us/arithmetic/TestFloat-3a/doc/timesoftfloat.html) Specific documentation for the `timesoftfloat` program.
-* [TestFloat-source.html](http://www.jhauser.us/arithmetic/TestFloat-3a/doc/TestFloat-source.html) Documentation for building TestFloat.
-* [TestFloat-history.html](http://www.jhauser.us/arithmetic/TestFloat-3a/doc/TestFloat-history.html) History of the major changes to TestFloat.
+* [TestFloat-general.html](http://www.jhauser.us/arithmetic/TestFloat-3b/doc/TestFloat-general.html) General documentation for understanding and using the TestFloat programs.
+* [testfloat_gen.html](http://www.jhauser.us/arithmetic/TestFloat-3b/doc/testfloat_gen.html) Specific documentation for the `testfloat_gen` program.
+* [testfloat_ver.html](http://www.jhauser.us/arithmetic/TestFloat-3b/doc/testfloat_ver.html) Specific documentation for the `testfloat_ver` program.
+* [testfloat.html](http://www.jhauser.us/arithmetic/TestFloat-3b/doc/testfloat.html) Specific documentation for the all-in-one `testfloat` program.
+* [testsoftfloat.html](http://www.jhauser.us/arithmetic/TestFloat-3b/doc/testsoftfloat.html) Specific documentation for the `testsoftfloat` program.
+* [timesoftfloat.html](http://www.jhauser.us/arithmetic/TestFloat-3b/doc/timesoftfloat.html) Specific documentation for the `timesoftfloat` program.
+* [TestFloat-source.html](http://www.jhauser.us/arithmetic/TestFloat-3b/doc/TestFloat-source.html) Documentation for building TestFloat.
+* [TestFloat-history.html](http://www.jhauser.us/arithmetic/TestFloat-3b/doc/TestFloat-history.html) History of the major changes to TestFloat.
Other files in the package comprise the source code for TestFloat.
diff --git a/README.txt b/README.txt
index 67718ed..54488c1 100644
--- a/README.txt
+++ b/README.txt
@@ -1,8 +1,8 @@
-Package Overview for Berkeley TestFloat Release 3a
+Package Overview for Berkeley TestFloat Release 3b
John R. Hauser
-2015 October 23
+2016 July 22
Berkeley TestFloat is a small collection of programs for testing that an
implementation of binary floating-point conforms to the IEEE Standard for
diff --git a/build/Linux-386-GCC/Makefile b/build/Linux-386-GCC/Makefile
index c26c825..c851807 100644
--- a/build/Linux-386-GCC/Makefile
+++ b/build/Linux-386-GCC/Makefile
@@ -1,12 +1,12 @@
#=============================================================================
#
-# This Makefile is part of TestFloat, Release 3a, a package of programs for
+# This Makefile is part of TestFloat, Release 3b, a package of programs for
# testing the correctness of floating-point arithmetic complying with the IEEE
# Standard for Floating-Point, by John R. Hauser.
#
-# Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
-# California. All rights reserved.
+# Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University
+# of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -35,18 +35,19 @@
#
#=============================================================================
-SOURCE_DIR = ../../source
+SOURCE_DIR ?= ../../source
+SOFTFLOAT_DIR ?= ../../../berkeley-softfloat-3
+PLATFORM ?= Linux-386-GCC
+
SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C
-SOFTFLOAT_DIR = ../../../berkeley-softfloat-3
SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include
-PLATFORM = Linux-386-GCC
SOFTFLOAT_H = \
$(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \
$(SOFTFLOAT_INCLUDE_DIR)/softfloat.h
SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB)
-TESTFLOAT_OPTS = -DEXTFLOAT80 -DFLOAT128 -DLONG_DOUBLE_IS_EXTFLOAT80
+TESTFLOAT_OPTS ?= -DFLOAT16 -DEXTFLOAT80 -DFLOAT128 -DLONG_DOUBLE_IS_EXTFLOAT80
DELETE = rm -f
C_INCLUDES = \
@@ -78,6 +79,7 @@ OBJS_GENCASES = \
genCases_ui64$(OBJ) \
genCases_i32$(OBJ) \
genCases_i64$(OBJ) \
+ genCases_f16$(OBJ) \
genCases_f32$(OBJ) \
genCases_f64$(OBJ) \
genCases_extF80$(OBJ) \
@@ -86,6 +88,9 @@ OBJS_GENCASES = \
OBJS_WRITECASE = \
writeCase_a_ui32$(OBJ) \
writeCase_a_ui64$(OBJ) \
+ writeCase_a_f16$(OBJ) \
+ writeCase_ab_f16$(OBJ) \
+ writeCase_abc_f16$(OBJ) \
writeCase_a_f32$(OBJ) \
writeCase_ab_f32$(OBJ) \
writeCase_abc_f32$(OBJ) \
@@ -101,28 +106,50 @@ OBJS_WRITECASE = \
writeCase_z_bool$(OBJ) \
writeCase_z_ui32$(OBJ) \
writeCase_z_ui64$(OBJ) \
+ writeCase_z_f16$(OBJ) \
writeCase_z_f32$(OBJ) \
writeCase_z_f64$(OBJ) \
writeCase_z_extF80M$(OBJ) \
writeCase_z_f128M$(OBJ) \
OBJS_TEST = \
+ test_a_ui32_z_f16$(OBJ) \
test_a_ui32_z_f32$(OBJ) \
test_a_ui32_z_f64$(OBJ) \
test_a_ui32_z_extF80$(OBJ) \
test_a_ui32_z_f128$(OBJ) \
+ test_a_ui64_z_f16$(OBJ) \
test_a_ui64_z_f32$(OBJ) \
test_a_ui64_z_f64$(OBJ) \
test_a_ui64_z_extF80$(OBJ) \
test_a_ui64_z_f128$(OBJ) \
+ test_a_i32_z_f16$(OBJ) \
test_a_i32_z_f32$(OBJ) \
test_a_i32_z_f64$(OBJ) \
test_a_i32_z_extF80$(OBJ) \
test_a_i32_z_f128$(OBJ) \
+ test_a_i64_z_f16$(OBJ) \
test_a_i64_z_f32$(OBJ) \
test_a_i64_z_f64$(OBJ) \
test_a_i64_z_extF80$(OBJ) \
test_a_i64_z_f128$(OBJ) \
+ test_a_f16_z_ui32_rx$(OBJ) \
+ test_a_f16_z_ui64_rx$(OBJ) \
+ test_a_f16_z_i32_rx$(OBJ) \
+ test_a_f16_z_i64_rx$(OBJ) \
+ test_a_f16_z_ui32_x$(OBJ) \
+ test_a_f16_z_ui64_x$(OBJ) \
+ test_a_f16_z_i32_x$(OBJ) \
+ test_a_f16_z_i64_x$(OBJ) \
+ test_a_f16_z_f32$(OBJ) \
+ test_a_f16_z_f64$(OBJ) \
+ test_a_f16_z_extF80$(OBJ) \
+ test_a_f16_z_f128$(OBJ) \
+ test_az_f16$(OBJ) \
+ test_az_f16_rx$(OBJ) \
+ test_abz_f16$(OBJ) \
+ test_abcz_f16$(OBJ) \
+ test_ab_f16_z_bool$(OBJ) \
test_a_f32_z_ui32_rx$(OBJ) \
test_a_f32_z_ui64_rx$(OBJ) \
test_a_f32_z_i32_rx$(OBJ) \
@@ -131,6 +158,7 @@ OBJS_TEST = \
test_a_f32_z_ui64_x$(OBJ) \
test_a_f32_z_i32_x$(OBJ) \
test_a_f32_z_i64_x$(OBJ) \
+ test_a_f32_z_f16$(OBJ) \
test_a_f32_z_f64$(OBJ) \
test_a_f32_z_extF80$(OBJ) \
test_a_f32_z_f128$(OBJ) \
@@ -147,6 +175,7 @@ OBJS_TEST = \
test_a_f64_z_ui64_x$(OBJ) \
test_a_f64_z_i32_x$(OBJ) \
test_a_f64_z_i64_x$(OBJ) \
+ test_a_f64_z_f16$(OBJ) \
test_a_f64_z_f32$(OBJ) \
test_a_f64_z_extF80$(OBJ) \
test_a_f64_z_f128$(OBJ) \
@@ -163,6 +192,7 @@ OBJS_TEST = \
test_a_extF80_z_ui64_x$(OBJ) \
test_a_extF80_z_i32_x$(OBJ) \
test_a_extF80_z_i64_x$(OBJ) \
+ test_a_extF80_z_f16$(OBJ) \
test_a_extF80_z_f32$(OBJ) \
test_a_extF80_z_f64$(OBJ) \
test_a_extF80_z_f128$(OBJ) \
@@ -178,6 +208,7 @@ OBJS_TEST = \
test_a_f128_z_ui64_x$(OBJ) \
test_a_f128_z_i32_x$(OBJ) \
test_a_f128_z_i64_x$(OBJ) \
+ test_a_f128_z_f16$(OBJ) \
test_a_f128_z_f32$(OBJ) \
test_a_f128_z_f64$(OBJ) \
test_a_f128_z_extF80$(OBJ) \
@@ -188,6 +219,7 @@ OBJS_TEST = \
test_ab_f128_z_bool$(OBJ) \
OBJS_LIB = \
+ uint128_inline$(OBJ) \
uint128$(OBJ) \
fail$(OBJ) \
functions_common$(OBJ) \
@@ -197,6 +229,7 @@ OBJS_LIB = \
genCases_common$(OBJ) \
$(OBJS_GENCASES) \
genCases_writeTestsTotal$(OBJ) \
+ verCases_inline$(OBJ) \
verCases_common$(OBJ) \
verCases_writeFunctionName$(OBJ) \
readHex$(OBJ) \
diff --git a/build/Linux-386-GCC/platform.h b/build/Linux-386-GCC/platform.h
index 9d9edaf..5389f9a 100644
--- a/build/Linux-386-GCC/platform.h
+++ b/build/Linux-386-GCC/platform.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -41,5 +41,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+#ifdef __GNUC_STDC_INLINE__
+#define INLINE inline
+#else
#define INLINE extern inline
+#endif
diff --git a/build/Linux-386-SSE2-GCC/Makefile b/build/Linux-386-SSE2-GCC/Makefile
index d127372..74a735a 100644
--- a/build/Linux-386-SSE2-GCC/Makefile
+++ b/build/Linux-386-SSE2-GCC/Makefile
@@ -1,12 +1,12 @@
#=============================================================================
#
-# This Makefile is part of TestFloat, Release 3a, a package of programs for
+# This Makefile is part of TestFloat, Release 3b, a package of programs for
# testing the correctness of floating-point arithmetic complying with the IEEE
# Standard for Floating-Point, by John R. Hauser.
#
-# Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
-# California. All rights reserved.
+# Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University
+# of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -35,18 +35,19 @@
#
#=============================================================================
-SOURCE_DIR = ../../source
+SOURCE_DIR ?= ../../source
+SOFTFLOAT_DIR ?= ../../../berkeley-softfloat-3
+PLATFORM ?= Linux-386-SSE2-GCC
+
SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C
-SOFTFLOAT_DIR = ../../../berkeley-softfloat-3
SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include
-PLATFORM = Linux-386-SSE2-GCC
SOFTFLOAT_H = \
$(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \
$(SOFTFLOAT_INCLUDE_DIR)/softfloat.h
SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB)
-TESTFLOAT_OPTS = -DEXTFLOAT80 -DFLOAT128 -DLONG_DOUBLE_IS_EXTFLOAT80
+TESTFLOAT_OPTS ?= -DFLOAT16 -DEXTFLOAT80 -DFLOAT128 -DLONG_DOUBLE_IS_EXTFLOAT80
DELETE = rm -f
C_INCLUDES = \
@@ -78,6 +79,7 @@ OBJS_GENCASES = \
genCases_ui64$(OBJ) \
genCases_i32$(OBJ) \
genCases_i64$(OBJ) \
+ genCases_f16$(OBJ) \
genCases_f32$(OBJ) \
genCases_f64$(OBJ) \
genCases_extF80$(OBJ) \
@@ -86,6 +88,9 @@ OBJS_GENCASES = \
OBJS_WRITECASE = \
writeCase_a_ui32$(OBJ) \
writeCase_a_ui64$(OBJ) \
+ writeCase_a_f16$(OBJ) \
+ writeCase_ab_f16$(OBJ) \
+ writeCase_abc_f16$(OBJ) \
writeCase_a_f32$(OBJ) \
writeCase_ab_f32$(OBJ) \
writeCase_abc_f32$(OBJ) \
@@ -101,28 +106,50 @@ OBJS_WRITECASE = \
writeCase_z_bool$(OBJ) \
writeCase_z_ui32$(OBJ) \
writeCase_z_ui64$(OBJ) \
+ writeCase_z_f16$(OBJ) \
writeCase_z_f32$(OBJ) \
writeCase_z_f64$(OBJ) \
writeCase_z_extF80M$(OBJ) \
writeCase_z_f128M$(OBJ) \
OBJS_TEST = \
+ test_a_ui32_z_f16$(OBJ) \
test_a_ui32_z_f32$(OBJ) \
test_a_ui32_z_f64$(OBJ) \
test_a_ui32_z_extF80$(OBJ) \
test_a_ui32_z_f128$(OBJ) \
+ test_a_ui64_z_f16$(OBJ) \
test_a_ui64_z_f32$(OBJ) \
test_a_ui64_z_f64$(OBJ) \
test_a_ui64_z_extF80$(OBJ) \
test_a_ui64_z_f128$(OBJ) \
+ test_a_i32_z_f16$(OBJ) \
test_a_i32_z_f32$(OBJ) \
test_a_i32_z_f64$(OBJ) \
test_a_i32_z_extF80$(OBJ) \
test_a_i32_z_f128$(OBJ) \
+ test_a_i64_z_f16$(OBJ) \
test_a_i64_z_f32$(OBJ) \
test_a_i64_z_f64$(OBJ) \
test_a_i64_z_extF80$(OBJ) \
test_a_i64_z_f128$(OBJ) \
+ test_a_f16_z_ui32_rx$(OBJ) \
+ test_a_f16_z_ui64_rx$(OBJ) \
+ test_a_f16_z_i32_rx$(OBJ) \
+ test_a_f16_z_i64_rx$(OBJ) \
+ test_a_f16_z_ui32_x$(OBJ) \
+ test_a_f16_z_ui64_x$(OBJ) \
+ test_a_f16_z_i32_x$(OBJ) \
+ test_a_f16_z_i64_x$(OBJ) \
+ test_a_f16_z_f32$(OBJ) \
+ test_a_f16_z_f64$(OBJ) \
+ test_a_f16_z_extF80$(OBJ) \
+ test_a_f16_z_f128$(OBJ) \
+ test_az_f16$(OBJ) \
+ test_az_f16_rx$(OBJ) \
+ test_abz_f16$(OBJ) \
+ test_abcz_f16$(OBJ) \
+ test_ab_f16_z_bool$(OBJ) \
test_a_f32_z_ui32_rx$(OBJ) \
test_a_f32_z_ui64_rx$(OBJ) \
test_a_f32_z_i32_rx$(OBJ) \
@@ -131,6 +158,7 @@ OBJS_TEST = \
test_a_f32_z_ui64_x$(OBJ) \
test_a_f32_z_i32_x$(OBJ) \
test_a_f32_z_i64_x$(OBJ) \
+ test_a_f32_z_f16$(OBJ) \
test_a_f32_z_f64$(OBJ) \
test_a_f32_z_extF80$(OBJ) \
test_a_f32_z_f128$(OBJ) \
@@ -147,6 +175,7 @@ OBJS_TEST = \
test_a_f64_z_ui64_x$(OBJ) \
test_a_f64_z_i32_x$(OBJ) \
test_a_f64_z_i64_x$(OBJ) \
+ test_a_f64_z_f16$(OBJ) \
test_a_f64_z_f32$(OBJ) \
test_a_f64_z_extF80$(OBJ) \
test_a_f64_z_f128$(OBJ) \
@@ -163,6 +192,7 @@ OBJS_TEST = \
test_a_extF80_z_ui64_x$(OBJ) \
test_a_extF80_z_i32_x$(OBJ) \
test_a_extF80_z_i64_x$(OBJ) \
+ test_a_extF80_z_f16$(OBJ) \
test_a_extF80_z_f32$(OBJ) \
test_a_extF80_z_f64$(OBJ) \
test_a_extF80_z_f128$(OBJ) \
@@ -178,6 +208,7 @@ OBJS_TEST = \
test_a_f128_z_ui64_x$(OBJ) \
test_a_f128_z_i32_x$(OBJ) \
test_a_f128_z_i64_x$(OBJ) \
+ test_a_f128_z_f16$(OBJ) \
test_a_f128_z_f32$(OBJ) \
test_a_f128_z_f64$(OBJ) \
test_a_f128_z_extF80$(OBJ) \
@@ -188,6 +219,7 @@ OBJS_TEST = \
test_ab_f128_z_bool$(OBJ) \
OBJS_LIB = \
+ uint128_inline$(OBJ) \
uint128$(OBJ) \
fail$(OBJ) \
functions_common$(OBJ) \
@@ -197,6 +229,7 @@ OBJS_LIB = \
genCases_common$(OBJ) \
$(OBJS_GENCASES) \
genCases_writeTestsTotal$(OBJ) \
+ verCases_inline$(OBJ) \
verCases_common$(OBJ) \
verCases_writeFunctionName$(OBJ) \
readHex$(OBJ) \
diff --git a/build/Linux-386-SSE2-GCC/platform.h b/build/Linux-386-SSE2-GCC/platform.h
index 9d9edaf..5389f9a 100644
--- a/build/Linux-386-SSE2-GCC/platform.h
+++ b/build/Linux-386-SSE2-GCC/platform.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -41,5 +41,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+#ifdef __GNUC_STDC_INLINE__
+#define INLINE inline
+#else
#define INLINE extern inline
+#endif
diff --git a/build/Linux-x86_64-GCC/Makefile b/build/Linux-x86_64-GCC/Makefile
index 786c537..5cdcfda 100644
--- a/build/Linux-x86_64-GCC/Makefile
+++ b/build/Linux-x86_64-GCC/Makefile
@@ -1,12 +1,12 @@
#=============================================================================
#
-# This Makefile is part of TestFloat, Release 3a, a package of programs for
+# This Makefile is part of TestFloat, Release 3b, a package of programs for
# testing the correctness of floating-point arithmetic complying with the IEEE
# Standard for Floating-Point, by John R. Hauser.
#
-# Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
-# California. All rights reserved.
+# Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University
+# of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -35,18 +35,19 @@
#
#=============================================================================
-SOURCE_DIR = ../../source
+SOURCE_DIR ?= ../../source
+SOFTFLOAT_DIR ?= ../../../berkeley-softfloat-3
+PLATFORM ?= Linux-x86_64-GCC
+
SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C
-SOFTFLOAT_DIR = ../../../berkeley-softfloat-3
SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include
-PLATFORM = Linux-x86_64-GCC
SOFTFLOAT_H = \
$(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \
$(SOFTFLOAT_INCLUDE_DIR)/softfloat.h
SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB)
-TESTFLOAT_OPTS = -DEXTFLOAT80 -DFLOAT128 -DLONG_DOUBLE_IS_EXTFLOAT80
+TESTFLOAT_OPTS ?= -DFLOAT16 -DEXTFLOAT80 -DFLOAT128 -DLONG_DOUBLE_IS_EXTFLOAT80
DELETE = rm -f
C_INCLUDES = \
@@ -78,6 +79,7 @@ OBJS_GENCASES = \
genCases_ui64$(OBJ) \
genCases_i32$(OBJ) \
genCases_i64$(OBJ) \
+ genCases_f16$(OBJ) \
genCases_f32$(OBJ) \
genCases_f64$(OBJ) \
genCases_extF80$(OBJ) \
@@ -86,6 +88,9 @@ OBJS_GENCASES = \
OBJS_WRITECASE = \
writeCase_a_ui32$(OBJ) \
writeCase_a_ui64$(OBJ) \
+ writeCase_a_f16$(OBJ) \
+ writeCase_ab_f16$(OBJ) \
+ writeCase_abc_f16$(OBJ) \
writeCase_a_f32$(OBJ) \
writeCase_ab_f32$(OBJ) \
writeCase_abc_f32$(OBJ) \
@@ -101,28 +106,50 @@ OBJS_WRITECASE = \
writeCase_z_bool$(OBJ) \
writeCase_z_ui32$(OBJ) \
writeCase_z_ui64$(OBJ) \
+ writeCase_z_f16$(OBJ) \
writeCase_z_f32$(OBJ) \
writeCase_z_f64$(OBJ) \
writeCase_z_extF80M$(OBJ) \
writeCase_z_f128M$(OBJ) \
OBJS_TEST = \
+ test_a_ui32_z_f16$(OBJ) \
test_a_ui32_z_f32$(OBJ) \
test_a_ui32_z_f64$(OBJ) \
test_a_ui32_z_extF80$(OBJ) \
test_a_ui32_z_f128$(OBJ) \
+ test_a_ui64_z_f16$(OBJ) \
test_a_ui64_z_f32$(OBJ) \
test_a_ui64_z_f64$(OBJ) \
test_a_ui64_z_extF80$(OBJ) \
test_a_ui64_z_f128$(OBJ) \
+ test_a_i32_z_f16$(OBJ) \
test_a_i32_z_f32$(OBJ) \
test_a_i32_z_f64$(OBJ) \
test_a_i32_z_extF80$(OBJ) \
test_a_i32_z_f128$(OBJ) \
+ test_a_i64_z_f16$(OBJ) \
test_a_i64_z_f32$(OBJ) \
test_a_i64_z_f64$(OBJ) \
test_a_i64_z_extF80$(OBJ) \
test_a_i64_z_f128$(OBJ) \
+ test_a_f16_z_ui32_rx$(OBJ) \
+ test_a_f16_z_ui64_rx$(OBJ) \
+ test_a_f16_z_i32_rx$(OBJ) \
+ test_a_f16_z_i64_rx$(OBJ) \
+ test_a_f16_z_ui32_x$(OBJ) \
+ test_a_f16_z_ui64_x$(OBJ) \
+ test_a_f16_z_i32_x$(OBJ) \
+ test_a_f16_z_i64_x$(OBJ) \
+ test_a_f16_z_f32$(OBJ) \
+ test_a_f16_z_f64$(OBJ) \
+ test_a_f16_z_extF80$(OBJ) \
+ test_a_f16_z_f128$(OBJ) \
+ test_az_f16$(OBJ) \
+ test_az_f16_rx$(OBJ) \
+ test_abz_f16$(OBJ) \
+ test_abcz_f16$(OBJ) \
+ test_ab_f16_z_bool$(OBJ) \
test_a_f32_z_ui32_rx$(OBJ) \
test_a_f32_z_ui64_rx$(OBJ) \
test_a_f32_z_i32_rx$(OBJ) \
@@ -131,6 +158,7 @@ OBJS_TEST = \
test_a_f32_z_ui64_x$(OBJ) \
test_a_f32_z_i32_x$(OBJ) \
test_a_f32_z_i64_x$(OBJ) \
+ test_a_f32_z_f16$(OBJ) \
test_a_f32_z_f64$(OBJ) \
test_a_f32_z_extF80$(OBJ) \
test_a_f32_z_f128$(OBJ) \
@@ -147,6 +175,7 @@ OBJS_TEST = \
test_a_f64_z_ui64_x$(OBJ) \
test_a_f64_z_i32_x$(OBJ) \
test_a_f64_z_i64_x$(OBJ) \
+ test_a_f64_z_f16$(OBJ) \
test_a_f64_z_f32$(OBJ) \
test_a_f64_z_extF80$(OBJ) \
test_a_f64_z_f128$(OBJ) \
@@ -163,6 +192,7 @@ OBJS_TEST = \
test_a_extF80_z_ui64_x$(OBJ) \
test_a_extF80_z_i32_x$(OBJ) \
test_a_extF80_z_i64_x$(OBJ) \
+ test_a_extF80_z_f16$(OBJ) \
test_a_extF80_z_f32$(OBJ) \
test_a_extF80_z_f64$(OBJ) \
test_a_extF80_z_f128$(OBJ) \
@@ -178,6 +208,7 @@ OBJS_TEST = \
test_a_f128_z_ui64_x$(OBJ) \
test_a_f128_z_i32_x$(OBJ) \
test_a_f128_z_i64_x$(OBJ) \
+ test_a_f128_z_f16$(OBJ) \
test_a_f128_z_f32$(OBJ) \
test_a_f128_z_f64$(OBJ) \
test_a_f128_z_extF80$(OBJ) \
@@ -188,6 +219,7 @@ OBJS_TEST = \
test_ab_f128_z_bool$(OBJ) \
OBJS_LIB = \
+ uint128_inline$(OBJ) \
uint128$(OBJ) \
fail$(OBJ) \
functions_common$(OBJ) \
@@ -197,6 +229,7 @@ OBJS_LIB = \
genCases_common$(OBJ) \
$(OBJS_GENCASES) \
genCases_writeTestsTotal$(OBJ) \
+ verCases_inline$(OBJ) \
verCases_common$(OBJ) \
verCases_writeFunctionName$(OBJ) \
readHex$(OBJ) \
diff --git a/build/Linux-x86_64-GCC/platform.h b/build/Linux-x86_64-GCC/platform.h
index 9d9edaf..5389f9a 100644
--- a/build/Linux-x86_64-GCC/platform.h
+++ b/build/Linux-x86_64-GCC/platform.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -41,5 +41,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+#ifdef __GNUC_STDC_INLINE__
+#define INLINE inline
+#else
#define INLINE extern inline
+#endif
diff --git a/build/Win32-MinGW/Makefile b/build/Win32-MinGW/Makefile
index 2949d33..22de648 100644
--- a/build/Win32-MinGW/Makefile
+++ b/build/Win32-MinGW/Makefile
@@ -1,12 +1,12 @@
#=============================================================================
#
-# This Makefile is part of TestFloat, Release 3a, a package of programs for
+# This Makefile is part of TestFloat, Release 3b, a package of programs for
# testing the correctness of floating-point arithmetic complying with the IEEE
# Standard for Floating-Point, by John R. Hauser.
#
-# Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
-# California. All rights reserved.
+# Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University
+# of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -35,18 +35,19 @@
#
#=============================================================================
-SOURCE_DIR = ../../source
+SOURCE_DIR ?= ../../source
+SOFTFLOAT_DIR ?= ../../../berkeley-softfloat-3
+PLATFORM ?= Win32-MinGW
+
SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C
-SOFTFLOAT_DIR = ../../../berkeley-softfloat-3
SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include
-PLATFORM = Win32-MinGW
SOFTFLOAT_H = \
$(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \
$(SOFTFLOAT_INCLUDE_DIR)/softfloat.h
SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB)
-TESTFLOAT_OPTS = -DEXTFLOAT80 -DFLOAT128 -DLONG_DOUBLE_IS_EXTFLOAT80
+TESTFLOAT_OPTS ?= -DFLOAT16 -DEXTFLOAT80 -DFLOAT128 -DLONG_DOUBLE_IS_EXTFLOAT80
DELETE = rm -f
C_INCLUDES = \
@@ -78,6 +79,7 @@ OBJS_GENCASES = \
genCases_ui64$(OBJ) \
genCases_i32$(OBJ) \
genCases_i64$(OBJ) \
+ genCases_f16$(OBJ) \
genCases_f32$(OBJ) \
genCases_f64$(OBJ) \
genCases_extF80$(OBJ) \
@@ -86,6 +88,9 @@ OBJS_GENCASES = \
OBJS_WRITECASE = \
writeCase_a_ui32$(OBJ) \
writeCase_a_ui64$(OBJ) \
+ writeCase_a_f16$(OBJ) \
+ writeCase_ab_f16$(OBJ) \
+ writeCase_abc_f16$(OBJ) \
writeCase_a_f32$(OBJ) \
writeCase_ab_f32$(OBJ) \
writeCase_abc_f32$(OBJ) \
@@ -101,28 +106,50 @@ OBJS_WRITECASE = \
writeCase_z_bool$(OBJ) \
writeCase_z_ui32$(OBJ) \
writeCase_z_ui64$(OBJ) \
+ writeCase_z_f16$(OBJ) \
writeCase_z_f32$(OBJ) \
writeCase_z_f64$(OBJ) \
writeCase_z_extF80M$(OBJ) \
writeCase_z_f128M$(OBJ) \
OBJS_TEST = \
+ test_a_ui32_z_f16$(OBJ) \
test_a_ui32_z_f32$(OBJ) \
test_a_ui32_z_f64$(OBJ) \
test_a_ui32_z_extF80$(OBJ) \
test_a_ui32_z_f128$(OBJ) \
+ test_a_ui64_z_f16$(OBJ) \
test_a_ui64_z_f32$(OBJ) \
test_a_ui64_z_f64$(OBJ) \
test_a_ui64_z_extF80$(OBJ) \
test_a_ui64_z_f128$(OBJ) \
+ test_a_i32_z_f16$(OBJ) \
test_a_i32_z_f32$(OBJ) \
test_a_i32_z_f64$(OBJ) \
test_a_i32_z_extF80$(OBJ) \
test_a_i32_z_f128$(OBJ) \
+ test_a_i64_z_f16$(OBJ) \
test_a_i64_z_f32$(OBJ) \
test_a_i64_z_f64$(OBJ) \
test_a_i64_z_extF80$(OBJ) \
test_a_i64_z_f128$(OBJ) \
+ test_a_f16_z_ui32_rx$(OBJ) \
+ test_a_f16_z_ui64_rx$(OBJ) \
+ test_a_f16_z_i32_rx$(OBJ) \
+ test_a_f16_z_i64_rx$(OBJ) \
+ test_a_f16_z_ui32_x$(OBJ) \
+ test_a_f16_z_ui64_x$(OBJ) \
+ test_a_f16_z_i32_x$(OBJ) \
+ test_a_f16_z_i64_x$(OBJ) \
+ test_a_f16_z_f32$(OBJ) \
+ test_a_f16_z_f64$(OBJ) \
+ test_a_f16_z_extF80$(OBJ) \
+ test_a_f16_z_f128$(OBJ) \
+ test_az_f16$(OBJ) \
+ test_az_f16_rx$(OBJ) \
+ test_abz_f16$(OBJ) \
+ test_abcz_f16$(OBJ) \
+ test_ab_f16_z_bool$(OBJ) \
test_a_f32_z_ui32_rx$(OBJ) \
test_a_f32_z_ui64_rx$(OBJ) \
test_a_f32_z_i32_rx$(OBJ) \
@@ -131,6 +158,7 @@ OBJS_TEST = \
test_a_f32_z_ui64_x$(OBJ) \
test_a_f32_z_i32_x$(OBJ) \
test_a_f32_z_i64_x$(OBJ) \
+ test_a_f32_z_f16$(OBJ) \
test_a_f32_z_f64$(OBJ) \
test_a_f32_z_extF80$(OBJ) \
test_a_f32_z_f128$(OBJ) \
@@ -147,6 +175,7 @@ OBJS_TEST = \
test_a_f64_z_ui64_x$(OBJ) \
test_a_f64_z_i32_x$(OBJ) \
test_a_f64_z_i64_x$(OBJ) \
+ test_a_f64_z_f16$(OBJ) \
test_a_f64_z_f32$(OBJ) \
test_a_f64_z_extF80$(OBJ) \
test_a_f64_z_f128$(OBJ) \
@@ -163,6 +192,7 @@ OBJS_TEST = \
test_a_extF80_z_ui64_x$(OBJ) \
test_a_extF80_z_i32_x$(OBJ) \
test_a_extF80_z_i64_x$(OBJ) \
+ test_a_extF80_z_f16$(OBJ) \
test_a_extF80_z_f32$(OBJ) \
test_a_extF80_z_f64$(OBJ) \
test_a_extF80_z_f128$(OBJ) \
@@ -178,6 +208,7 @@ OBJS_TEST = \
test_a_f128_z_ui64_x$(OBJ) \
test_a_f128_z_i32_x$(OBJ) \
test_a_f128_z_i64_x$(OBJ) \
+ test_a_f128_z_f16$(OBJ) \
test_a_f128_z_f32$(OBJ) \
test_a_f128_z_f64$(OBJ) \
test_a_f128_z_extF80$(OBJ) \
@@ -188,6 +219,7 @@ OBJS_TEST = \
test_ab_f128_z_bool$(OBJ) \
OBJS_LIB = \
+ uint128_inline$(OBJ) \
uint128$(OBJ) \
fail$(OBJ) \
functions_common$(OBJ) \
@@ -197,6 +229,7 @@ OBJS_LIB = \
genCases_common$(OBJ) \
$(OBJS_GENCASES) \
genCases_writeTestsTotal$(OBJ) \
+ verCases_inline$(OBJ) \
verCases_common$(OBJ) \
verCases_writeFunctionName$(OBJ) \
readHex$(OBJ) \
diff --git a/build/Win32-MinGW/platform.h b/build/Win32-MinGW/platform.h
index 9d9edaf..5389f9a 100644
--- a/build/Win32-MinGW/platform.h
+++ b/build/Win32-MinGW/platform.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -41,5 +41,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+#ifdef __GNUC_STDC_INLINE__
+#define INLINE inline
+#else
#define INLINE extern inline
+#endif
diff --git a/build/Win32-SSE2-MinGW/Makefile b/build/Win32-SSE2-MinGW/Makefile
index b08c3e1..ff966a2 100644
--- a/build/Win32-SSE2-MinGW/Makefile
+++ b/build/Win32-SSE2-MinGW/Makefile
@@ -1,12 +1,12 @@
#=============================================================================
#
-# This Makefile is part of TestFloat, Release 3a, a package of programs for
+# This Makefile is part of TestFloat, Release 3b, a package of programs for
# testing the correctness of floating-point arithmetic complying with the IEEE
# Standard for Floating-Point, by John R. Hauser.
#
-# Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
-# California. All rights reserved.
+# Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University
+# of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -35,18 +35,19 @@
#
#=============================================================================
-SOURCE_DIR = ../../source
+SOURCE_DIR ?= ../../source
+SOFTFLOAT_DIR ?= ../../../berkeley-softfloat-3
+PLATFORM ?= Win32-SSE2-MinGW
+
SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C
-SOFTFLOAT_DIR = ../../../berkeley-softfloat-3
SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include
-PLATFORM = Win32-SSE2-MinGW
SOFTFLOAT_H = \
$(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \
$(SOFTFLOAT_INCLUDE_DIR)/softfloat.h
SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB)
-TESTFLOAT_OPTS = -DEXTFLOAT80 -DFLOAT128 -DLONG_DOUBLE_IS_EXTFLOAT80
+TESTFLOAT_OPTS ?= -DFLOAT16 -DEXTFLOAT80 -DFLOAT128 -DLONG_DOUBLE_IS_EXTFLOAT80
DELETE = rm -f
C_INCLUDES = \
@@ -78,6 +79,7 @@ OBJS_GENCASES = \
genCases_ui64$(OBJ) \
genCases_i32$(OBJ) \
genCases_i64$(OBJ) \
+ genCases_f16$(OBJ) \
genCases_f32$(OBJ) \
genCases_f64$(OBJ) \
genCases_extF80$(OBJ) \
@@ -86,6 +88,9 @@ OBJS_GENCASES = \
OBJS_WRITECASE = \
writeCase_a_ui32$(OBJ) \
writeCase_a_ui64$(OBJ) \
+ writeCase_a_f16$(OBJ) \
+ writeCase_ab_f16$(OBJ) \
+ writeCase_abc_f16$(OBJ) \
writeCase_a_f32$(OBJ) \
writeCase_ab_f32$(OBJ) \
writeCase_abc_f32$(OBJ) \
@@ -101,28 +106,50 @@ OBJS_WRITECASE = \
writeCase_z_bool$(OBJ) \
writeCase_z_ui32$(OBJ) \
writeCase_z_ui64$(OBJ) \
+ writeCase_z_f16$(OBJ) \
writeCase_z_f32$(OBJ) \
writeCase_z_f64$(OBJ) \
writeCase_z_extF80M$(OBJ) \
writeCase_z_f128M$(OBJ) \
OBJS_TEST = \
+ test_a_ui32_z_f16$(OBJ) \
test_a_ui32_z_f32$(OBJ) \
test_a_ui32_z_f64$(OBJ) \
test_a_ui32_z_extF80$(OBJ) \
test_a_ui32_z_f128$(OBJ) \
+ test_a_ui64_z_f16$(OBJ) \
test_a_ui64_z_f32$(OBJ) \
test_a_ui64_z_f64$(OBJ) \
test_a_ui64_z_extF80$(OBJ) \
test_a_ui64_z_f128$(OBJ) \
+ test_a_i32_z_f16$(OBJ) \
test_a_i32_z_f32$(OBJ) \
test_a_i32_z_f64$(OBJ) \
test_a_i32_z_extF80$(OBJ) \
test_a_i32_z_f128$(OBJ) \
+ test_a_i64_z_f16$(OBJ) \
test_a_i64_z_f32$(OBJ) \
test_a_i64_z_f64$(OBJ) \
test_a_i64_z_extF80$(OBJ) \
test_a_i64_z_f128$(OBJ) \
+ test_a_f16_z_ui32_rx$(OBJ) \
+ test_a_f16_z_ui64_rx$(OBJ) \
+ test_a_f16_z_i32_rx$(OBJ) \
+ test_a_f16_z_i64_rx$(OBJ) \
+ test_a_f16_z_ui32_x$(OBJ) \
+ test_a_f16_z_ui64_x$(OBJ) \
+ test_a_f16_z_i32_x$(OBJ) \
+ test_a_f16_z_i64_x$(OBJ) \
+ test_a_f16_z_f32$(OBJ) \
+ test_a_f16_z_f64$(OBJ) \
+ test_a_f16_z_extF80$(OBJ) \
+ test_a_f16_z_f128$(OBJ) \
+ test_az_f16$(OBJ) \
+ test_az_f16_rx$(OBJ) \
+ test_abz_f16$(OBJ) \
+ test_abcz_f16$(OBJ) \
+ test_ab_f16_z_bool$(OBJ) \
test_a_f32_z_ui32_rx$(OBJ) \
test_a_f32_z_ui64_rx$(OBJ) \
test_a_f32_z_i32_rx$(OBJ) \
@@ -131,6 +158,7 @@ OBJS_TEST = \
test_a_f32_z_ui64_x$(OBJ) \
test_a_f32_z_i32_x$(OBJ) \
test_a_f32_z_i64_x$(OBJ) \
+ test_a_f32_z_f16$(OBJ) \
test_a_f32_z_f64$(OBJ) \
test_a_f32_z_extF80$(OBJ) \
test_a_f32_z_f128$(OBJ) \
@@ -147,6 +175,7 @@ OBJS_TEST = \
test_a_f64_z_ui64_x$(OBJ) \
test_a_f64_z_i32_x$(OBJ) \
test_a_f64_z_i64_x$(OBJ) \
+ test_a_f64_z_f16$(OBJ) \
test_a_f64_z_f32$(OBJ) \
test_a_f64_z_extF80$(OBJ) \
test_a_f64_z_f128$(OBJ) \
@@ -163,6 +192,7 @@ OBJS_TEST = \
test_a_extF80_z_ui64_x$(OBJ) \
test_a_extF80_z_i32_x$(OBJ) \
test_a_extF80_z_i64_x$(OBJ) \
+ test_a_extF80_z_f16$(OBJ) \
test_a_extF80_z_f32$(OBJ) \
test_a_extF80_z_f64$(OBJ) \
test_a_extF80_z_f128$(OBJ) \
@@ -178,6 +208,7 @@ OBJS_TEST = \
test_a_f128_z_ui64_x$(OBJ) \
test_a_f128_z_i32_x$(OBJ) \
test_a_f128_z_i64_x$(OBJ) \
+ test_a_f128_z_f16$(OBJ) \
test_a_f128_z_f32$(OBJ) \
test_a_f128_z_f64$(OBJ) \
test_a_f128_z_extF80$(OBJ) \
@@ -188,6 +219,7 @@ OBJS_TEST = \
test_ab_f128_z_bool$(OBJ) \
OBJS_LIB = \
+ uint128_inline$(OBJ) \
uint128$(OBJ) \
fail$(OBJ) \
functions_common$(OBJ) \
@@ -197,6 +229,7 @@ OBJS_LIB = \
genCases_common$(OBJ) \
$(OBJS_GENCASES) \
genCases_writeTestsTotal$(OBJ) \
+ verCases_inline$(OBJ) \
verCases_common$(OBJ) \
verCases_writeFunctionName$(OBJ) \
readHex$(OBJ) \
diff --git a/build/Win32-SSE2-MinGW/platform.h b/build/Win32-SSE2-MinGW/platform.h
index 9d9edaf..5389f9a 100644
--- a/build/Win32-SSE2-MinGW/platform.h
+++ b/build/Win32-SSE2-MinGW/platform.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -41,5 +41,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+#ifdef __GNUC_STDC_INLINE__
+#define INLINE inline
+#else
#define INLINE extern inline
+#endif
diff --git a/build/Win64-MinGW-w64/Makefile b/build/Win64-MinGW-w64/Makefile
index 0deb9f7..a44856a 100644
--- a/build/Win64-MinGW-w64/Makefile
+++ b/build/Win64-MinGW-w64/Makefile
@@ -1,12 +1,12 @@
#=============================================================================
#
-# This Makefile is part of TestFloat, Release 3a, a package of programs for
+# This Makefile is part of TestFloat, Release 3b, a package of programs for
# testing the correctness of floating-point arithmetic complying with the IEEE
# Standard for Floating-Point, by John R. Hauser.
#
-# Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
-# California. All rights reserved.
+# Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University
+# of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -35,18 +35,19 @@
#
#=============================================================================
-SOURCE_DIR = ../../source
+SOURCE_DIR ?= ../../source
+SOFTFLOAT_DIR ?= ../../../berkeley-softfloat-3
+PLATFORM ?= Win64-MinGW-w64
+
SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C
-SOFTFLOAT_DIR = ../../../berkeley-softfloat-3
SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include
-PLATFORM = Win64-MinGW-w64
SOFTFLOAT_H = \
$(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \
$(SOFTFLOAT_INCLUDE_DIR)/softfloat.h
SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB)
-TESTFLOAT_OPTS = -DEXTFLOAT80 -DFLOAT128 -DLONG_DOUBLE_IS_EXTFLOAT80
+TESTFLOAT_OPTS ?= -DFLOAT16 -DEXTFLOAT80 -DFLOAT128 -DLONG_DOUBLE_IS_EXTFLOAT80
DELETE = rm -f
C_INCLUDES = \
@@ -78,6 +79,7 @@ OBJS_GENCASES = \
genCases_ui64$(OBJ) \
genCases_i32$(OBJ) \
genCases_i64$(OBJ) \
+ genCases_f16$(OBJ) \
genCases_f32$(OBJ) \
genCases_f64$(OBJ) \
genCases_extF80$(OBJ) \
@@ -86,6 +88,9 @@ OBJS_GENCASES = \
OBJS_WRITECASE = \
writeCase_a_ui32$(OBJ) \
writeCase_a_ui64$(OBJ) \
+ writeCase_a_f16$(OBJ) \
+ writeCase_ab_f16$(OBJ) \
+ writeCase_abc_f16$(OBJ) \
writeCase_a_f32$(OBJ) \
writeCase_ab_f32$(OBJ) \
writeCase_abc_f32$(OBJ) \
@@ -101,28 +106,50 @@ OBJS_WRITECASE = \
writeCase_z_bool$(OBJ) \
writeCase_z_ui32$(OBJ) \
writeCase_z_ui64$(OBJ) \
+ writeCase_z_f16$(OBJ) \
writeCase_z_f32$(OBJ) \
writeCase_z_f64$(OBJ) \
writeCase_z_extF80M$(OBJ) \
writeCase_z_f128M$(OBJ) \
OBJS_TEST = \
+ test_a_ui32_z_f16$(OBJ) \
test_a_ui32_z_f32$(OBJ) \
test_a_ui32_z_f64$(OBJ) \
test_a_ui32_z_extF80$(OBJ) \
test_a_ui32_z_f128$(OBJ) \
+ test_a_ui64_z_f16$(OBJ) \
test_a_ui64_z_f32$(OBJ) \
test_a_ui64_z_f64$(OBJ) \
test_a_ui64_z_extF80$(OBJ) \
test_a_ui64_z_f128$(OBJ) \
+ test_a_i32_z_f16$(OBJ) \
test_a_i32_z_f32$(OBJ) \
test_a_i32_z_f64$(OBJ) \
test_a_i32_z_extF80$(OBJ) \
test_a_i32_z_f128$(OBJ) \
+ test_a_i64_z_f16$(OBJ) \
test_a_i64_z_f32$(OBJ) \
test_a_i64_z_f64$(OBJ) \
test_a_i64_z_extF80$(OBJ) \
test_a_i64_z_f128$(OBJ) \
+ test_a_f16_z_ui32_rx$(OBJ) \
+ test_a_f16_z_ui64_rx$(OBJ) \
+ test_a_f16_z_i32_rx$(OBJ) \
+ test_a_f16_z_i64_rx$(OBJ) \
+ test_a_f16_z_ui32_x$(OBJ) \
+ test_a_f16_z_ui64_x$(OBJ) \
+ test_a_f16_z_i32_x$(OBJ) \
+ test_a_f16_z_i64_x$(OBJ) \
+ test_a_f16_z_f32$(OBJ) \
+ test_a_f16_z_f64$(OBJ) \
+ test_a_f16_z_extF80$(OBJ) \
+ test_a_f16_z_f128$(OBJ) \
+ test_az_f16$(OBJ) \
+ test_az_f16_rx$(OBJ) \
+ test_abz_f16$(OBJ) \
+ test_abcz_f16$(OBJ) \
+ test_ab_f16_z_bool$(OBJ) \
test_a_f32_z_ui32_rx$(OBJ) \
test_a_f32_z_ui64_rx$(OBJ) \
test_a_f32_z_i32_rx$(OBJ) \
@@ -131,6 +158,7 @@ OBJS_TEST = \
test_a_f32_z_ui64_x$(OBJ) \
test_a_f32_z_i32_x$(OBJ) \
test_a_f32_z_i64_x$(OBJ) \
+ test_a_f32_z_f16$(OBJ) \
test_a_f32_z_f64$(OBJ) \
test_a_f32_z_extF80$(OBJ) \
test_a_f32_z_f128$(OBJ) \
@@ -147,6 +175,7 @@ OBJS_TEST = \
test_a_f64_z_ui64_x$(OBJ) \
test_a_f64_z_i32_x$(OBJ) \
test_a_f64_z_i64_x$(OBJ) \
+ test_a_f64_z_f16$(OBJ) \
test_a_f64_z_f32$(OBJ) \
test_a_f64_z_extF80$(OBJ) \
test_a_f64_z_f128$(OBJ) \
@@ -163,6 +192,7 @@ OBJS_TEST = \
test_a_extF80_z_ui64_x$(OBJ) \
test_a_extF80_z_i32_x$(OBJ) \
test_a_extF80_z_i64_x$(OBJ) \
+ test_a_extF80_z_f16$(OBJ) \
test_a_extF80_z_f32$(OBJ) \
test_a_extF80_z_f64$(OBJ) \
test_a_extF80_z_f128$(OBJ) \
@@ -178,6 +208,7 @@ OBJS_TEST = \
test_a_f128_z_ui64_x$(OBJ) \
test_a_f128_z_i32_x$(OBJ) \
test_a_f128_z_i64_x$(OBJ) \
+ test_a_f128_z_f16$(OBJ) \
test_a_f128_z_f32$(OBJ) \
test_a_f128_z_f64$(OBJ) \
test_a_f128_z_extF80$(OBJ) \
@@ -188,6 +219,7 @@ OBJS_TEST = \
test_ab_f128_z_bool$(OBJ) \
OBJS_LIB = \
+ uint128_inline$(OBJ) \
uint128$(OBJ) \
fail$(OBJ) \
functions_common$(OBJ) \
@@ -197,6 +229,7 @@ OBJS_LIB = \
genCases_common$(OBJ) \
$(OBJS_GENCASES) \
genCases_writeTestsTotal$(OBJ) \
+ verCases_inline$(OBJ) \
verCases_common$(OBJ) \
verCases_writeFunctionName$(OBJ) \
readHex$(OBJ) \
diff --git a/build/Win64-MinGW-w64/platform.h b/build/Win64-MinGW-w64/platform.h
index 9d9edaf..5389f9a 100644
--- a/build/Win64-MinGW-w64/platform.h
+++ b/build/Win64-MinGW-w64/platform.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -41,5 +41,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+#ifdef __GNUC_STDC_INLINE__
+#define INLINE inline
+#else
#define INLINE extern inline
+#endif
diff --git a/build/template/Makefile b/build/template/Makefile
index 2c45bdd..839ae46 100644
--- a/build/template/Makefile
+++ b/build/template/Makefile
@@ -1,12 +1,12 @@
#=============================================================================
#
-# This Makefile template is part of TestFloat, Release 3a, a package of
+# This Makefile template is part of TestFloat, Release 3b, a package of
# programs for testing the correctness of floating-point arithmetic complying
# with the IEEE Standard for Floating-Point, by John R. Hauser.
#
-# Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
-# California. All rights reserved.
+# Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University
+# of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -37,18 +37,19 @@
# Edit lines marked with `==>'. See "TestFloat-source.html".
-==> SOURCE_DIR = ../../source
+==> SOURCE_DIR ?= ../../source
+==> SOFTFLOAT_DIR ?= ../../../berkeley-softfloat-3
+==> PLATFORM ?= Win32-MinGW
+
==> SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C
-==> SOFTFLOAT_DIR = ../../../berkeley-softfloat-3
==> SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include
-==> PLATFORM = Win32-MinGW
==> SOFTFLOAT_H = \
==> $(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \
==> $(SOFTFLOAT_INCLUDE_DIR)/softfloat.h
==> SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB)
-==> TESTFLOAT_OPTS = -DEXTFLOAT80 -DFLOAT128 -DLONG_DOUBLE_IS_EXTFLOAT80
+==> TESTFLOAT_OPTS ?= -DFLOAT16 -DEXTFLOAT80 -DFLOAT128 -DLONG_DOUBLE_IS_EXTFLOAT80
==> DELETE = rm -f
==> C_INCLUDES = \
@@ -76,6 +77,7 @@ OBJS_GENCASES = \
genCases_ui64$(OBJ) \
genCases_i32$(OBJ) \
genCases_i64$(OBJ) \
+ genCases_f16$(OBJ) \
genCases_f32$(OBJ) \
genCases_f64$(OBJ) \
genCases_extF80$(OBJ) \
@@ -84,6 +86,9 @@ OBJS_GENCASES = \
OBJS_WRITECASE = \
writeCase_a_ui32$(OBJ) \
writeCase_a_ui64$(OBJ) \
+ writeCase_a_f16$(OBJ) \
+ writeCase_ab_f16$(OBJ) \
+ writeCase_abc_f16$(OBJ) \
writeCase_a_f32$(OBJ) \
writeCase_ab_f32$(OBJ) \
writeCase_abc_f32$(OBJ) \
@@ -99,28 +104,50 @@ OBJS_WRITECASE = \
writeCase_z_bool$(OBJ) \
writeCase_z_ui32$(OBJ) \
writeCase_z_ui64$(OBJ) \
+ writeCase_z_f16$(OBJ) \
writeCase_z_f32$(OBJ) \
writeCase_z_f64$(OBJ) \
writeCase_z_extF80M$(OBJ) \
writeCase_z_f128M$(OBJ) \
OBJS_TEST = \
+ test_a_ui32_z_f16$(OBJ) \
test_a_ui32_z_f32$(OBJ) \
test_a_ui32_z_f64$(OBJ) \
test_a_ui32_z_extF80$(OBJ) \
test_a_ui32_z_f128$(OBJ) \
+ test_a_ui64_z_f16$(OBJ) \
test_a_ui64_z_f32$(OBJ) \
test_a_ui64_z_f64$(OBJ) \
test_a_ui64_z_extF80$(OBJ) \
test_a_ui64_z_f128$(OBJ) \
+ test_a_i32_z_f16$(OBJ) \
test_a_i32_z_f32$(OBJ) \
test_a_i32_z_f64$(OBJ) \
test_a_i32_z_extF80$(OBJ) \
test_a_i32_z_f128$(OBJ) \
+ test_a_i64_z_f16$(OBJ) \
test_a_i64_z_f32$(OBJ) \
test_a_i64_z_f64$(OBJ) \
test_a_i64_z_extF80$(OBJ) \
test_a_i64_z_f128$(OBJ) \
+ test_a_f16_z_ui32_rx$(OBJ) \
+ test_a_f16_z_ui64_rx$(OBJ) \
+ test_a_f16_z_i32_rx$(OBJ) \
+ test_a_f16_z_i64_rx$(OBJ) \
+ test_a_f16_z_ui32_x$(OBJ) \
+ test_a_f16_z_ui64_x$(OBJ) \
+ test_a_f16_z_i32_x$(OBJ) \
+ test_a_f16_z_i64_x$(OBJ) \
+ test_a_f16_z_f32$(OBJ) \
+ test_a_f16_z_f64$(OBJ) \
+ test_a_f16_z_extF80$(OBJ) \
+ test_a_f16_z_f128$(OBJ) \
+ test_az_f16$(OBJ) \
+ test_az_f16_rx$(OBJ) \
+ test_abz_f16$(OBJ) \
+ test_abcz_f16$(OBJ) \
+ test_ab_f16_z_bool$(OBJ) \
test_a_f32_z_ui32_rx$(OBJ) \
test_a_f32_z_ui64_rx$(OBJ) \
test_a_f32_z_i32_rx$(OBJ) \
@@ -129,6 +156,7 @@ OBJS_TEST = \
test_a_f32_z_ui64_x$(OBJ) \
test_a_f32_z_i32_x$(OBJ) \
test_a_f32_z_i64_x$(OBJ) \
+ test_a_f32_z_f16$(OBJ) \
test_a_f32_z_f64$(OBJ) \
test_a_f32_z_extF80$(OBJ) \
test_a_f32_z_f128$(OBJ) \
@@ -145,6 +173,7 @@ OBJS_TEST = \
test_a_f64_z_ui64_x$(OBJ) \
test_a_f64_z_i32_x$(OBJ) \
test_a_f64_z_i64_x$(OBJ) \
+ test_a_f64_z_f16$(OBJ) \
test_a_f64_z_f32$(OBJ) \
test_a_f64_z_extF80$(OBJ) \
test_a_f64_z_f128$(OBJ) \
@@ -161,6 +190,7 @@ OBJS_TEST = \
test_a_extF80_z_ui64_x$(OBJ) \
test_a_extF80_z_i32_x$(OBJ) \
test_a_extF80_z_i64_x$(OBJ) \
+ test_a_extF80_z_f16$(OBJ) \
test_a_extF80_z_f32$(OBJ) \
test_a_extF80_z_f64$(OBJ) \
test_a_extF80_z_f128$(OBJ) \
@@ -176,6 +206,7 @@ OBJS_TEST = \
test_a_f128_z_ui64_x$(OBJ) \
test_a_f128_z_i32_x$(OBJ) \
test_a_f128_z_i64_x$(OBJ) \
+ test_a_f128_z_f16$(OBJ) \
test_a_f128_z_f32$(OBJ) \
test_a_f128_z_f64$(OBJ) \
test_a_f128_z_extF80$(OBJ) \
@@ -186,6 +217,7 @@ OBJS_TEST = \
test_ab_f128_z_bool$(OBJ) \
OBJS_LIB = \
+ uint128_inline$(OBJ) \
uint128$(OBJ) \
fail$(OBJ) \
functions_common$(OBJ) \
@@ -195,6 +227,7 @@ OBJS_LIB = \
genCases_common$(OBJ) \
$(OBJS_GENCASES) \
genCases_writeTestsTotal$(OBJ) \
+ verCases_inline$(OBJ) \
verCases_common$(OBJ) \
verCases_writeFunctionName$(OBJ) \
readHex$(OBJ) \
diff --git a/build/template/platform.h b/build/template/platform.h
index 19855d6..70d2b3e 100644
--- a/build/template/platform.h
+++ b/build/template/platform.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header template is part of TestFloat, Release 3a, a package of programs
+This C header template is part of TestFloat, Release 3b, a package of programs
for testing the correctness of floating-point arithmetic complying with the
IEEE Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -45,3 +45,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*----------------------------------------------------------------------------*/
==> #define INLINE inline
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+==> #define THREAD_LOCAL _Thread_local
+
diff --git a/doc/TestFloat-general.html b/doc/TestFloat-general.html
index 889f7dc..11d906c 100644
--- a/doc/TestFloat-general.html
+++ b/doc/TestFloat-general.html
@@ -7,11 +7,11 @@
<BODY>
-<H1>Berkeley TestFloat Release 3a: General Documentation</H1>
+<H1>Berkeley TestFloat Release 3b: General Documentation</H1>
<P>
John R. Hauser<BR>
-2015 October 23<BR>
+2016 July 22<BR>
</P>
@@ -53,8 +53,9 @@ implementation of binary floating-point conforms to the IEEE Standard for
Floating-Point Arithmetic.
All operations required by the original 1985 version of the IEEE Floating-Point
Standard can be tested, except for conversions to and from decimal.
-The following binary formats can be tested: <NOBR>32-bit</NOBR>
-single-precision, <NOBR>64-bit</NOBR> double-precision, <NOBR>80-bit</NOBR>
+With the current release, the following binary formats can be tested:
+<NOBR>16-bit</NOBR> half-precision, <NOBR>32-bit</NOBR> single-precision,
+<NOBR>64-bit</NOBR> double-precision, <NOBR>80-bit</NOBR>
double-extended-precision, and/or <NOBR>128-bit</NOBR> quadruple-precision.
TestFloat cannot test decimal floating-point.
</P>
@@ -64,7 +65,7 @@ Included in the TestFloat package are the <CODE>testsoftfloat</CODE> and
<CODE>timesoftfloat</CODE> programs for testing the Berkeley SoftFloat software
implementation of floating-point and for measuring its speed.
Information about SoftFloat can be found at the SoftFloat Web page,
-<A HREF="http://www.jhauser.us/arithmetic/SoftFloat.html"><CODE>http://www.jhauser.us/arithmetic/SoftFloat.html</CODE></A>.
+<A HREF="http://www.jhauser.us/arithmetic/SoftFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/SoftFloat.html</CODE></NOBR></A>.
The <CODE>testsoftfloat</CODE> and <CODE>timesoftfloat</CODE> programs are
expected to be of interest only to people compiling the SoftFloat sources.
</P>
@@ -77,13 +78,14 @@ Details about the standard are available elsewhere.
</P>
<P>
-The current version of TestFloat is <NOBR>Release 3a</NOBR>.
-Besides a replacement of the license text supplied by the University of
-California, the differences between Releases 3 and 3a are minor, mostly
-affecting the build process.
+The current version of TestFloat is <NOBR>Release 3b</NOBR>.
+This release differs from the previous <NOBR>Release 3a</NOBR> mainly in the
+ability to test the <NOBR>16-bit</NOBR> half-precision format.
Compared to Release 2c and earlier, the set of TestFloat programs as well as
the programs&rsquo; arguments and behavior changed some with
<NOBR>Release 3</NOBR>.
+For more about the evolution of TestFloat releases, see
+<A HREF="TestFloat-history.html"><NOBR><CODE>TestFloat-history.html</CODE></NOBR></A>.
</P>
@@ -101,8 +103,8 @@ soundness of the floating-point under test.
TestFloat may also at times manage to find rarer and more subtle bugs, but it
will probably only find such bugs by chance.
Software that purposefully seeks out various kinds of subtle floating-point
-bugs can be found through links posted on the TestFloat Web page
-(<A HREF="http://www.jhauser.us/arithmetic/TestFloat.html"><CODE>http://www.jhauser.us/arithmetic/TestFloat.html</CODE></A>).
+bugs can be found through links posted on the TestFloat Web page,
+<A HREF="http://www.jhauser.us/arithmetic/TestFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/TestFloat.html</CODE></NOBR></A>.
</P>
@@ -112,10 +114,10 @@ bugs can be found through links posted on the TestFloat Web page
The TestFloat package was written by me, <NOBR>John R.</NOBR> Hauser.
<NOBR>Release 3</NOBR> of TestFloat was a completely new implementation
supplanting earlier releases.
-The project to create <NOBR>Release 3</NOBR> (and <NOBR>now 3a</NOBR>) was done
-in the employ of the University of California, Berkeley, within the Department
-of Electrical Engineering and Computer Sciences, first for the Parallel
-Computing Laboratory (Par Lab) and then for the ASPIRE Lab.
+The project to create <NOBR>Release 3</NOBR> (now <NOBR>through 3b</NOBR>) was
+done in the employ of the University of California, Berkeley, within the
+Department of Electrical Engineering and Computer Sciences, first for the
+Parallel Computing Laboratory (Par Lab) and then for the ASPIRE Lab.
The work was officially overseen by Prof. Krste Asanovic, with funding provided
by these sources:
<BLOCKQUOTE>
@@ -146,12 +148,12 @@ Oracle, and Samsung.
</P>
<P>
-The following applies to the whole of TestFloat <NOBR>Release 3a</NOBR> as well
+The following applies to the whole of TestFloat <NOBR>Release 3b</NOBR> as well
as to each source file individually.
</P>
<P>
-Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
California.
All rights reserved.
</P>
@@ -225,7 +227,7 @@ It also makes no attempt to find bugs specific to SRT division and the like
(such as the infamous Pentium division bug).
Software that tests for such failures can be found through links on the
TestFloat Web page,
-<A HREF="http://www.jhauser.us/arithmetic/TestFloat.html"><CODE>http://www.jhauser.us/arithmetic/TestFloat.html</CODE></A>.
+<A HREF="http://www.jhauser.us/arithmetic/TestFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/TestFloat.html</CODE></NOBR></A>.
</P>
<P>
@@ -278,7 +280,7 @@ me.
The SoftFloat functions are linked into each TestFloat program&rsquo;s
executable.
Information about SoftFloat can be found at the Web page
-<A HREF="http://www.jhauser.us/arithmetic/SoftFloat.html"><CODE>http://www.jhauser.us/arithmetic/SoftFloat.html</CODE></A>.
+<A HREF="http://www.jhauser.us/arithmetic/SoftFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/SoftFloat.html</CODE></NOBR></A>.
</P>
<P>
@@ -312,14 +314,18 @@ Generates test cases for a specific floating-point operation.
</TD>
</TR>
<TR>
-<TD><A HREF="testfloat_ver.html"><CODE>testfloat_ver</CODE></A></TD>
+<TD>
+<A HREF="testfloat_ver.html"><CODE>testfloat_ver</CODE></A>
+</TD>
<TD>
Verifies whether the results from executing a floating-point operation are as
expected.
</TD>
</TR>
<TR>
-<TD><A HREF="testfloat.html"><CODE>testfloat</CODE></A></TD>
+<TD>
+<A HREF="testfloat.html"><CODE>testfloat</CODE></A>
+</TD>
<TD>
An all-in-one program that generates test cases, executes floating-point
operations, and verifies whether the results match expectations.
@@ -462,11 +468,11 @@ IEEE Standard.
<P>
More information about all these operations is given below.
-In the operation names used by TestFloat, <NOBR>32-bit</NOBR> single-precision
-is called <CODE>f32</CODE>, <NOBR>64-bit</NOBR> double-precision is
-<CODE>f64</CODE>, <NOBR>80-bit</NOBR> double-extended-precision is
-<CODE>extF80</CODE>, and <NOBR>128-bit</NOBR> quadruple-precision is
-<CODE>f128</CODE>.
+In the operation names used by TestFloat, <NOBR>16-bit</NOBR> half-precision is
+called <CODE>f16</CODE>, <NOBR>32-bit</NOBR> single-precision is
+<CODE>f32</CODE>, <NOBR>64-bit</NOBR> double-precision is <CODE>f64</CODE>,
+<NOBR>80-bit</NOBR> double-extended-precision is <CODE>extF80</CODE>, and
+<NOBR>128-bit</NOBR> quadruple-precision is <CODE>f128</CODE>.
TestFloat generally uses the same names for operations as Berkeley SoftFloat,
except that TestFloat&rsquo;s names never include the <CODE>M</CODE> that
SoftFloat uses to indicate that values are passed through pointers.
@@ -481,19 +487,21 @@ can be tested.
The conversion operations are:
<BLOCKQUOTE>
<PRE>
+ui32_to_f16 ui64_to_f16 i32_to_f16 i64_to_f16
ui32_to_f32 ui64_to_f32 i32_to_f32 i64_to_f32
ui32_to_f64 ui64_to_f64 i32_to_f64 i64_to_f64
ui32_to_extF80 ui64_to_extF80 i32_to_extF80 i64_to_extF80
ui32_to_f128 ui64_to_f128 i32_to_f128 i64_to_f128
-f32_to_ui32 f64_to_ui32 extF80_to_ui32 f128_to_ui32
-f32_to_ui64 f64_to_ui64 extF80_to_ui64 f128_to_ui64
-f32_to_i32 f64_to_i32 extF80_to_i32 f128_to_i32
-f32_to_i64 f64_to_i64 extF80_to_i64 f128_to_i64
+f16_to_ui32 f32_to_ui32 f64_to_ui32 extF80_to_ui32 f128_to_ui32
+f16_to_ui64 f32_to_ui64 f64_to_ui64 extF80_to_ui64 f128_to_ui64
+f16_to_i32 f32_to_i32 f64_to_i32 extF80_to_i32 f128_to_i32
+f16_to_i64 f32_to_i64 f64_to_i64 extF80_to_i64 f128_to_i64
-f32_to_f64 f64_to_f32 extF80_to_f32 f128_to_f32
-f32_to_extF80 f64_to_extF80 extF80_to_f64 f128_to_f64
-f32_to_f128 f64_to_f128 extF80_to_f128 f128_to_extF80
+f16_to_f32 f32_to_f16 f64_to_f16 extF80_to_f16 f128_to_f16
+f16_to_f64 f32_to_f64 f64_to_f32 extF80_to_f32 f128_to_f32
+f16_to_extF80 f32_to_extF80 f64_to_extF80 extF80_to_f64 f128_to_f64
+f16_to_f128 f32_to_f128 f64_to_f128 extF80_to_f128 f128_to_extF80
</PRE>
</BLOCKQUOTE>
Abbreviations <CODE>ui32</CODE> and <CODE>ui64</CODE> indicate
@@ -540,10 +548,12 @@ raise the <I>inexact</I> exception whenever the result is not exact.
<P>
TestFloat assumes that conversions from floating-point to an integer type
should raise the <I>invalid</I> exception if the input cannot be rounded to an
-integer representable by the result format.
+integer representable in the result format.
In such a circumstance, if the result type is an unsigned integer, TestFloat
expects the result of the operation to be the type&rsquo;s largest integer
-value.
+value;
+although, when conversion overflows for a negative input, TestFloat may also
+accept a result of zero.
If the result type is a signed integer and conversion overflows, TestFloat
expects the result to be the largest-magnitude integer with the same sign as
the input.
@@ -560,6 +570,7 @@ exception.
The following standard arithmetic operations can be tested:
<BLOCKQUOTE>
<PRE>
+f16_add f16_sub f16_mul f16_div f16_sqrt
f32_add f32_sub f32_mul f32_div f32_sqrt
f64_add f64_sub f64_mul f64_div f64_sqrt
extF80_add extF80_sub extF80_mul extF80_div extF80_sqrt
@@ -579,6 +590,7 @@ defined by the 2008 IEEE Floating-Point Standard.
The fused multiply-add operations are:
<BLOCKQUOTE>
<PRE>
+f16_mulAdd
f32_mulAdd
f64_mulAdd
f128_mulAdd
@@ -600,6 +612,7 @@ operation.
These operations are:
<BLOCKQUOTE>
<PRE>
+f16_rem
f32_rem
f64_rem
extF80_rem
@@ -617,6 +630,7 @@ operation.
For most TestFloat programs, these operations are:
<BLOCKQUOTE>
<PRE>
+f16_roundToInt
f32_roundToInt
f64_roundToInt
extF80_roundToInt
@@ -645,8 +659,8 @@ The usual indication of rounding mode is ignored.
In contrast, the &lsquo;<CODE>_x</CODE>&rsquo; versions accept the usual
indication of rounding mode and raise the <I>inexact</I> exception whenever the
result is not exact.
-This irregular system follows the IEEE Standard&rsquo;s precise specification
-for the round-to-integer operations.
+This irregular system follows the IEEE Standard&rsquo;s particular
+specification for the round-to-integer operations.
</P>
<H3>6.6. Comparison Operations</H3>
@@ -655,6 +669,7 @@ for the round-to-integer operations.
The following floating-point comparison operations can be tested:
<BLOCKQUOTE>
<PRE>
+f16_eq f16_le f16_lt
f32_eq f32_le f32_lt
f64_eq f64_le f64_lt
extF80_eq extF80_le extF80_lt
@@ -676,6 +691,7 @@ For completeness, the following additional operations can be tested if
supported:
<BLOCKQUOTE>
<PRE>
+f16_eq_signaling f16_le_quiet f16_lt_quiet
f32_eq_signaling f32_le_quiet f32_lt_quiet
f64_eq_signaling f64_le_quiet f64_lt_quiet
extF80_eq_signaling extF80_le_quiet extF80_lt_quiet
@@ -711,7 +727,7 @@ Two implementations can sometimes give different results without either being
incorrect.
<LI>
The trusted floating-point emulation could be faulty.
-This could be because there is a bug in the way the enulation is coded, or
+This could be because there is a bug in the way the emulation is coded, or
because a mistake was made when the code was compiled for the current system.
<LI>
The TestFloat program may not work properly, reporting differences that do not
@@ -754,140 +770,185 @@ first, followed by the exception flags.
For example, two typical error lines could be
<BLOCKQUOTE>
<PRE>
-800.7FFF00 87F.000100 => 001.000000 ...ux expected: 001.000000 ....x
-081.000004 000.1FFFFF => 001.000000 ...ux expected: 001.000000 ....x
+-00.7FFF00 -7F.000100 => +01.000000 ...ux expected: +01.000000 ....x
++81.000004 +00.1FFFFF => +01.000000 ...ux expected: +01.000000 ....x
</PRE>
</BLOCKQUOTE>
-In the first line, the inputs are <CODE>800.7FFF00</CODE> and
-<CODE>87F.000100</CODE>, and the observed result is <CODE>001.000000</CODE>
+In the first line, the inputs are <CODE>-00.7FFF00</CODE> and
+<CODE>-7F.000100</CODE>, and the observed result is <CODE>+01.000000</CODE>
with flags <CODE>...ux</CODE>.
The trusted emulation result is the same but with different flags,
<CODE>....x</CODE>.
-Items such as <CODE>800.7FFF00</CODE> composed of hexadecimal digits and a
-single period represent floating-point values (here <NOBR>32-bit</NOBR>
+Items such as <CODE>-00.7FFF00</CODE> composed of a sign character
+<NOBR>(<CODE>+</CODE>/<CODE>-</CODE>)</NOBR>, hexadecimal digits, and a single
+period represent floating-point values (here <NOBR>32-bit</NOBR>
single-precision).
The two instances above were reported as errors because the exception flag
results differ.
</P>
<P>
-Aside from the exception flags, there are nine data types that may be
+Aside from the exception flags, there are ten data types that may be
represented.
-Four are floating-point types: <NOBR>32-bit</NOBR> single-precision,
-<NOBR>64-bit</NOBR> double-precision, <NOBR>80-bit</NOBR>
-double-extended-precision, and <NOBR>128-bit</NOBR> quadruple-precision.
+Five are floating-point types: <NOBR>16-bit</NOBR> half-precision,
+<NOBR>32-bit</NOBR> single-precision, <NOBR>64-bit</NOBR> double-precision,
+<NOBR>80-bit</NOBR> double-extended-precision, and <NOBR>128-bit</NOBR>
+quadruple-precision.
The remaining five types are <NOBR>32-bit</NOBR> and <NOBR>64-bit</NOBR>
unsigned integers, <NOBR>32-bit</NOBR> and <NOBR>64-bit</NOBR>
two&rsquo;s-complement signed integers, and Boolean values (the results of
comparison operations).
Boolean values are represented as a single character, either a <CODE>0</CODE>
-or a <CODE>1</CODE>.
-<NOBR>32-bit</NOBR> integers are represented as 8 hexadecimal digits.
-Thus, for a signed <NOBR>32-bit</NOBR> integer, <CODE>FFFFFFFF</CODE> is -1,
-and <CODE>7FFFFFFF</CODE> is the largest positive value.
+(false) or a <CODE>1</CODE> (true).
+A <NOBR>32-bit</NOBR> integer is represented as 8 hexadecimal digits.
+Thus, for a signed <NOBR>32-bit</NOBR> integer, <CODE>FFFFFFFF</CODE> is
+&minus;1, and <CODE>7FFFFFFF</CODE> is the largest positive value.
<NOBR>64-bit</NOBR> integers are the same except with 16 hexadecimal digits.
</P>
<P>
-Floating-point values are written in a correspondingly primitive form.
-Values of the <NOBR>64-bit</NOBR> double-precision format are represented by 16
-hexadecimal digits that give the raw bits of the floating-point encoding.
-A period separates the 3rd and 4th hexadecimal digits to mark the division
-between the exponent bits and fraction bits.
-Some notable <NOBR>64-bit</NOBR> double-precision values include:
+Floating-point values are written decomposed into their sign, encoded exponent,
+and encoded significand.
+First is the sign character <NOBR>(<CODE>+</CODE> or <CODE>-</CODE>),</NOBR>
+followed by the encoded exponent in hexadecimal, then a period
+(<CODE>.</CODE>), and lastly the encoded significand in hexadecimal.
+</P>
+
+<P>
+For <NOBR>16-bit</NOBR> half-precision, notable values include:
<BLOCKQUOTE>
<TABLE CELLSPACING=0 CELLPADDING=0>
-<TR>
- <TD><CODE>000.0000000000000&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD>
- <TD>+0</TD>
-</TR>
-<TR><TD><CODE>3FF.0000000000000</CODE></TD><TD>&nbsp;1</TD></TR>
-<TR><TD><CODE>400.0000000000000</CODE></TD><TD>&nbsp;2</TD></TR>
-<TR><TD><CODE>7FF.0000000000000</CODE></TD><TD>+infinity</TD></TR>
-<TR><TD>&nbsp;</TD></TR>
-<TR><TD><CODE>800.0000000000000</CODE></TD><TD>&minus;0</TD></TR>
-<TR><TD><CODE>BFF.0000000000000</CODE></TD><TD>&minus;1</TD></TR>
-<TR><TD><CODE>C00.0000000000000</CODE></TD><TD>&minus;2</TD></TR>
-<TR><TD><CODE>FFF.0000000000000</CODE></TD><TD>&minus;infinity</TD></TR>
+<TR><TD><CODE>+00.000&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD><TD>+0</TD></TR>
+<TR><TD><CODE>+0F.000</CODE></TD><TD>&nbsp;1</TD></TR>
+<TR><TD><CODE>+10.000</CODE></TD><TD>&nbsp;2</TD></TR>
+<TR><TD><CODE>+1E.3FF</CODE></TD><TD>maximum finite value</TD></TR>
+<TR><TD><CODE>+1F.000</CODE></TD><TD>+infinity</TD></TR>
<TR><TD>&nbsp;</TD></TR>
+<TR><TD><CODE>-00.000</CODE></TD><TD>&minus;0</TD></TR>
+<TR><TD><CODE>-0F.000</CODE></TD><TD>&minus;1</TD></TR>
+<TR><TD><CODE>-10.000</CODE></TD><TD>&minus;2</TD></TR>
<TR>
- <TD><CODE>3FE.FFFFFFFFFFFFF</CODE></TD>
- <TD>largest representable number less than +1</TD>
+ <TD><CODE>-1E.3FF</CODE></TD>
+ <TD>minimum finite value (largest magnitude, but negative)</TD>
</TR>
+<TR><TD><CODE>-1F.000</CODE></TD><TD>&minus;infinity</TD></TR>
</TABLE>
</BLOCKQUOTE>
-The following categories are easily distinguished (assuming the
-<CODE>x</CODE>s are not all 0):
+Certain categories are easily distinguished (assuming the <CODE>x</CODE>s are
+not all 0):
<BLOCKQUOTE>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR>
- <TD><CODE>000.xxxxxxxxxxxxx&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD>
- <TD>positive subnormal (denormalized) numbers</TD>
+ <TD><CODE>+00.xxx&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD>
+ <TD>positive subnormal numbers</TD>
</TR>
-<TR><TD><CODE>7FF.xxxxxxxxxxxxx</CODE></TD><TD>positive NaNs</TD></TR>
-<TR>
- <TD><CODE>800.xxxxxxxxxxxxx</CODE></TD>
- <TD>negative subnormal numbers</TD>
-</TR>
-<TR><TD><CODE>FFF.xxxxxxxxxxxxx</CODE></TD><TD>negative NaNs</TD></TR>
+<TR><TD><CODE>+1F.xxx</CODE></TD><TD>positive NaNs</TD></TR>
+<TR><TD><CODE>-00.xxx</CODE></TD><TD>negative subnormal numbers</TD></TR>
+<TR><TD><CODE>-1F.xxx</CODE></TD><TD>negative NaNs</TD></TR>
</TABLE>
</BLOCKQUOTE>
</P>
<P>
-<NOBR>128-bit</NOBR> quadruple-precision values are written the same except
-with 4 hexadecimal digits for the sign and exponent and 28 for the fraction.
-Notable values include:
+Likewise for other formats:
<BLOCKQUOTE>
<TABLE CELLSPACING=0 CELLPADDING=0>
+<TR><TD>32-bit single</TD><TD>64-bit double</TD><TD>128-bit quadruple</TD></TR>
+<TR><TD>&nbsp;</TD></TR>
<TR>
- <TD>
- <CODE>0000.0000000000000000000000000000&nbsp;&nbsp;&nbsp;&nbsp;</CODE>
- </TD>
- <TD>+0</TD>
+<TD><CODE>+00.000000&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD>
+<TD><CODE>+000.0000000000000&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD>
+<TD><CODE>+0000.0000000000000000000000000000&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD>
+<TD>+0</TD>
+</TR>
+<TR>
+<TD><CODE>+7F.000000</CODE></TD>
+<TD><CODE>+3FF.0000000000000</CODE></TD>
+<TD><CODE>+3FFF.0000000000000000000000000000</CODE></TD>
+<TD>&nbsp;1</TD>
</TR>
<TR>
- <TD><CODE>3FFF.0000000000000000000000000000</CODE></TD>
- <TD>&nbsp;1</TD>
+<TD><CODE>+80.000000</CODE></TD>
+<TD><CODE>+400.0000000000000</CODE></TD>
+<TD><CODE>+4000.0000000000000000000000000000</CODE></TD>
+<TD>&nbsp;2</TD>
</TR>
<TR>
- <TD><CODE>4000.0000000000000000000000000000</CODE></TD>
- <TD>&nbsp;2</TD>
+<TD><CODE>+FE.7FFFFF</CODE></TD>
+<TD><CODE>+7FE.FFFFFFFFFFFFF</CODE></TD>
+<TD><CODE>+7FFE.FFFFFFFFFFFFFFFFFFFFFFFFFFFF</CODE></TD>
+<TD>maximum finite value</TD>
</TR>
<TR>
- <TD><CODE>7FFF.0000000000000000000000000000</CODE></TD>
- <TD>+infinity</TD>
+<TD><CODE>+FF.000000</CODE></TD>
+<TD><CODE>+7FF.0000000000000</CODE></TD>
+<TD><CODE>+7FFF.0000000000000000000000000000</CODE></TD>
+<TD>+infinity</TD>
</TR>
<TR><TD>&nbsp;</TD></TR>
<TR>
- <TD><CODE>8000.0000000000000000000000000000</CODE></TD>
- <TD>&minus;0</TD>
+<TD><CODE>-00.000000&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD>
+<TD><CODE>-000.0000000000000&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD>
+<TD><CODE>-0000.0000000000000000000000000000&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD>
+<TD>&minus;0</TD>
</TR>
<TR>
- <TD><CODE>BFFF.0000000000000000000000000000</CODE></TD>
- <TD>&minus;1</TD>
+<TD><CODE>-7F.000000</CODE></TD>
+<TD><CODE>-3FF.0000000000000</CODE></TD>
+<TD><CODE>-3FFF.0000000000000000000000000000</CODE></TD>
+<TD>&minus;1</TD>
</TR>
<TR>
- <TD><CODE>C000.0000000000000000000000000000</CODE></TD>
- <TD>&minus;2</TD>
+<TD><CODE>-80.000000</CODE></TD>
+<TD><CODE>-400.0000000000000</CODE></TD>
+<TD><CODE>-4000.0000000000000000000000000000</CODE></TD>
+<TD>&minus;2</TD>
</TR>
<TR>
- <TD><CODE>FFFF.0000000000000000000000000000</CODE></TD>
- <TD>&minus;infinity</TD>
+<TD><CODE>-FE.7FFFFF</CODE></TD>
+<TD><CODE>-7FE.FFFFFFFFFFFFF</CODE></TD>
+<TD><CODE>-7FFE.FFFFFFFFFFFFFFFFFFFFFFFFFFFF</CODE></TD>
+<TD>minimum finite value</TD>
+</TR>
+<TR>
+<TD><CODE>-FF.000000</CODE></TD>
+<TD><CODE>-7FF.0000000000000</CODE></TD>
+<TD><CODE>-7FFF.0000000000000000000000000000</CODE></TD>
+<TD>&minus;infinity</TD>
</TR>
<TR><TD>&nbsp;</TD></TR>
<TR>
- <TD><CODE>3FFE.FFFFFFFFFFFFFFFFFFFFFFFFFFFF</CODE></TD>
- <TD>largest representable number less than +1</TD>
+<TD><CODE>+00.xxxxxx</CODE></TD>
+<TD><CODE>+000.xxxxxxxxxxxxx</CODE></TD>
+<TD><CODE>+0000.xxxxxxxxxxxxxxxxxxxxxxxxxxxx</CODE></TD>
+<TD>positive subnormals</TD>
+</TR>
+<TR>
+<TD><CODE>+FF.xxxxxx</CODE></TD>
+<TD><CODE>+7FF.xxxxxxxxxxxxx</CODE></TD>
+<TD><CODE>+7FFF.xxxxxxxxxxxxxxxxxxxxxxxxxxxx</CODE></TD>
+<TD>positive NaNs</TD>
+</TR>
+<TR>
+<TD><CODE>-00.xxxxxx</CODE></TD>
+<TD><CODE>-000.xxxxxxxxxxxxx</CODE></TD>
+<TD><CODE>-0000.xxxxxxxxxxxxxxxxxxxxxxxxxxxx</CODE></TD>
+<TD>negative subnormals</TD>
+</TR>
+<TR>
+<TD><CODE>-FF.xxxxxx</CODE></TD>
+<TD><CODE>-7FF.xxxxxxxxxxxxx</CODE></TD>
+<TD><CODE>-7FFF.xxxxxxxxxxxxxxxxxxxxxxxxxxxx</CODE></TD>
+<TD>negative NaNs</TD>
</TR>
</TABLE>
</BLOCKQUOTE>
</P>
<P>
-<NOBR>80-bit</NOBR> double-extended-precision values are a little unusual in
-that the leading bit of precision is not hidden as with other formats.
-When correctly encoded, the leading significand bit of an <NOBR>80-bit</NOBR>
+The <NOBR>80-bit</NOBR> double-extended-precision values are a little unusual
+in that the leading bit of precision is not hidden as with other formats.
+When canonically encoded, the leading significand bit of an <NOBR>80-bit</NOBR>
double-extended-precision value will be 0 if the value is zero or subnormal,
and will be 1 otherwise.
Hence, the same values listed above appear in <NOBR>80-bit</NOBR>
@@ -896,82 +957,25 @@ the significands):
<BLOCKQUOTE>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR>
- <TD><CODE>0000.0000000000000000&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD>
+ <TD><CODE>+0000.0000000000000000&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD>
<TD>+0</TD>
</TR>
-<TR><TD><CODE>3FFF.8000000000000000</CODE></TD><TD>&nbsp;1</TD></TR>
-<TR><TD><CODE>4000.8000000000000000</CODE></TD><TD>&nbsp;2</TD></TR>
-<TR><TD><CODE>7FFF.8000000000000000</CODE></TD><TD>+infinity</TD></TR>
-<TR><TD>&nbsp;</TD></TR>
-<TR><TD><CODE>8000.0000000000000000</CODE></TD><TD>&minus;0</TD></TR>
-<TR><TD><CODE>BFFF.8000000000000000</CODE></TD><TD>&minus;1</TD></TR>
-<TR><TD><CODE>C000.8000000000000000</CODE></TD><TD>&minus;2</TD></TR>
-<TR><TD><CODE>FFFF.8000000000000000</CODE></TD><TD>&minus;infinity</TD></TR>
-<TR><TD>&nbsp;</TD></TR>
+<TR><TD><CODE>+3FFF.8000000000000000</CODE></TD><TD>&nbsp;1</TD></TR>
+<TR><TD><CODE>+4000.8000000000000000</CODE></TD><TD>&nbsp;2</TD></TR>
<TR>
- <TD><CODE>3FFE.FFFFFFFFFFFFFFFF</CODE></TD>
- <TD>largest representable number less than +1</TD>
+ <TD><CODE>+7FFE.FFFFFFFFFFFFFFFF</CODE></TD>
+ <TD>maximum finite value</TD>
</TR>
-</TABLE>
-</BLOCKQUOTE>
-</P>
-
-<P>
-The representation of <NOBR>32-bit</NOBR> single-precision values is unusual
-for a different reason.
-Because the subfields of standard <NOBR>32-bit</NOBR> single-precision do not
-fall on neat <NOBR>4-bit</NOBR> boundaries, single-precision outputs are
-slightly perturbed.
-These are written as 9 hexadecimal digits, with a period separating the 3rd and
-4th hexadecimal digits.
-Broken out into bits, the 9 hexademical digits cover the <NOBR>32-bit</NOBR>
-single-precision subfields as follows:
-<BLOCKQUOTE>
-<PRE>
-x000 .... .... . .... .... .... .... .... .... sign (1 bit)
-.... xxxx xxxx . .... .... .... .... .... .... exponent (8 bits)
-.... .... .... . 0xxx xxxx xxxx xxxx xxxx xxxx fraction (23 bits)
-</PRE>
-</BLOCKQUOTE>
-As shown in this schematic, the first hexadecimal digit contains only the sign,
-and will be either <CODE>0</CODE> <NOBR>or <CODE>8</CODE></NOBR>.
-The next two digits give the biased exponent as an <NOBR>8-bit</NOBR> integer.
-This is followed by a period and 6 hexadecimal digits of fraction.
-The most significant hexadecimal digit of the fraction can be at most
-<NOBR>a <CODE>7</CODE></NOBR>.
-</P>
-
-<P>
-Notable single-precision values include:
-<BLOCKQUOTE>
-<TABLE CELLSPACING=0 CELLPADDING=0>
-<TR><TD><CODE>000.000000&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD><TD>+0</TD></TR>
-<TR><TD><CODE>07F.000000</CODE></TD><TD>&nbsp;1</TD></TR>
-<TR><TD><CODE>080.000000</CODE></TD><TD>&nbsp;2</TD></TR>
-<TR><TD><CODE>0FF.000000</CODE></TD><TD>+infinity</TD></TR>
-<TR><TD>&nbsp;</TD></TR>
-<TR><TD><CODE>800.000000</CODE></TD><TD>&minus;0</TD></TR>
-<TR><TD><CODE>87F.000000</CODE></TD><TD>&minus;1</TD></TR>
-<TR><TD><CODE>880.000000</CODE></TD><TD>&minus;2</TD></TR>
-<TR><TD><CODE>8FF.000000</CODE></TD><TD>&minus;infinity</TD></TR>
+<TR><TD><CODE>+7FFF.8000000000000000</CODE></TD><TD>+infinity</TD></TR>
<TR><TD>&nbsp;</TD></TR>
+<TR><TD><CODE>-0000.0000000000000000</CODE></TD><TD>&minus;0</TD></TR>
+<TR><TD><CODE>-3FFF.8000000000000000</CODE></TD><TD>&minus;1</TD></TR>
+<TR><TD><CODE>-4000.8000000000000000</CODE></TD><TD>&minus;2</TD></TR>
<TR>
- <TD><CODE>07E.7FFFFF</CODE></TD>
- <TD>largest representable number less than +1</TD>
-</TR>
-</TABLE>
-</BLOCKQUOTE>
-Again, certain categories are easily distinguished (assuming the
-<CODE>x</CODE>s are not all 0):
-<BLOCKQUOTE>
-<TABLE CELLSPACING=0 CELLPADDING=0>
-<TR>
- <TD><CODE>000.xxxxxx&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD>
- <TD>positive subnormal (denormalized) numbers</TD>
+ <TD><CODE>-7FFE.FFFFFFFFFFFFFFFF</CODE></TD>
+ <TD>minimum finite value</TD>
</TR>
-<TR><TD><CODE>0FF.xxxxxx</CODE></TD><TD>positive NaNs</TD></TR>
-<TR><TD><CODE>800.xxxxxx</CODE></TD><TD>negative subnormal numbers</TD></TR>
-<TR><TD><CODE>8FF.xxxxxx</CODE></TD><TD>negative NaNs</TD></TR>
+<TR><TD><CODE>-7FFF.8000000000000000</CODE></TD><TD>&minus;infinity</TD></TR>
</TABLE>
</BLOCKQUOTE>
</P>
@@ -987,15 +991,15 @@ The letter used to indicate a set flag depends on the flag:
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR>
<TD><CODE>v&nbsp;&nbsp;&nbsp;&nbsp;</CODE></TD>
- <TD>invalid exception</TD>
+ <TD><I>invalid</I> exception</TD>
</TR>
<TR>
<TD><CODE>i</CODE></TD>
- <TD>infinite exception (&ldquo;divide by zero&rdquo;)</TD>
+ <TD><I>infinite</I> exception (&ldquo;divide by zero&rdquo;)</TD>
</TR>
-<TR><TD><CODE>o</CODE></TD><TD>overflow exception</TD></TR>
-<TR><TD><CODE>u</CODE></TD><TD>underflow exception</TD></TR>
-<TR><TD><CODE>x</CODE></TD><TD>inexact exception</TD></TR>
+<TR><TD><CODE>o</CODE></TD><TD><I>overflow</I> exception</TD></TR>
+<TR><TD><CODE>u</CODE></TD><TD><I>underflow</I> exception</TD></TR>
+<TR><TD><CODE>x</CODE></TD><TD><I>inexact</I> exception</TD></TR>
</TABLE>
</BLOCKQUOTE>
For example, the notation <CODE>...ux</CODE> indicates that the
@@ -1090,8 +1094,8 @@ or an unspecified alternative mechanism may be used to signal such cases.
TestFloat assumes that conversions to integer will raise the <I>invalid</I>
exception if the source value cannot be rounded to a representable integer.
In such cases, TestFloat expects the result value to be the largest-magnitude
-positive or negative integer as detailed earlier in <NOBR>section 6.1</NOBR>,
-<I>Conversion Operations</I>.
+positive or negative integer or zero as detailed earlier in
+<NOBR>section 6.1</NOBR>, <I>Conversion Operations</I>.
The current version of TestFloat provides no means to alter these expectations.
</P>
@@ -1101,7 +1105,7 @@ The current version of TestFloat provides no means to alter these expectations.
<P>
At the time of this writing, the most up-to-date information about TestFloat
and the latest release can be found at the Web page
-<A HREF="http://www.jhauser.us/arithmetic/TestFloat.html"><CODE>http://www.jhauser.us/arithmetic/TestFloat.html</CODE></A>.
+<A HREF="http://www.jhauser.us/arithmetic/TestFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/TestFloat.html</CODE></NOBR></A>.
</P>
diff --git a/doc/TestFloat-history.html b/doc/TestFloat-history.html
index fc2ec30..34aeeda 100644
--- a/doc/TestFloat-history.html
+++ b/doc/TestFloat-history.html
@@ -7,11 +7,11 @@
<BODY>
-<H1>History of Berkeley TestFloat, to Release 3a</H1>
+<H1>History of Berkeley TestFloat, to Release 3b</H1>
<P>
John R. Hauser<BR>
-2015 October 23<BR>
+2016 July 22<BR>
</P>
@@ -23,6 +23,44 @@ corresponding release of SoftFloat.
</P>
+<H3>Release 3b (2016 July)</H3>
+
+<UL>
+
+<LI>
+Added the ability to test the common <NOBR>16-bit</NOBR>
+&ldquo;half-precision&rdquo; floating-point format.
+
+<LI>
+Added a <CODE>-seed</CODE> option to programs <CODE>testfloat_gen</CODE>,
+<CODE>testfloat</CODE>, and <CODE>testsoftfloat</CODE> for setting the seed for
+the pseudo-random number generator used to generate test cases.
+
+<LI>
+Where a specific choice is needed for how tininess is detected on underflow,
+changed the default to be the detection of tininess after rounding
+(<CODE>-tininessafter</CODE>) instead of before rounding
+(<CODE>-tininessbefore</CODE>).
+
+<LI>
+Modified the format of reported discrepancies to show the signs of
+floating-point values using <CODE>+</CODE> and <CODE>-</CODE> characters.
+
+<LI>
+Documented the use of the <CODE>INLINE</CODE> macro, and fixed the sources for
+the case that function inlining is not supported by the C compiler.
+
+<LI>
+Documented the possible need to define macro <CODE>THREAD_LOCAL</CODE> to match
+how the SoftFloat library was built.
+
+<LI>
+Modified the provided Makefiles to allow some options to be overridden from the
+<CODE>make</CODE> command.
+
+</UL>
+
+
<H3>Release 3a (2015 October)</H3>
<UL>
diff --git a/doc/TestFloat-source.html b/doc/TestFloat-source.html
index 7d68a5f..42dc050 100644
--- a/doc/TestFloat-source.html
+++ b/doc/TestFloat-source.html
@@ -7,11 +7,11 @@
<BODY>
-<H1>Berkeley TestFloat Release 3a: Source Documentation</H1>
+<H1>Berkeley TestFloat Release 3b: Source Documentation</H1>
<P>
John R. Hauser<BR>
-2015 October 23<BR>
+2016 July 22<BR>
</P>
@@ -49,7 +49,7 @@ TestFloat, a small collection of programs for testing that an implementation of
binary floating-point conforms to the IEEE Standard for Floating-Point
Arithmetic.
For basic documentation about TestFloat refer to
-<A HREF="TestFloat-general.html"><CODE>TestFloat-general.html</CODE></A>.
+<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>.
</P>
<P>
@@ -66,7 +66,7 @@ TestFloat has been successfully compiled with the GNU C Compiler
<P>
<NOBR>Release 3</NOBR> of TestFloat was a complete rewrite relative to
<NOBR>Release 2</NOBR> or earlier.
-The current version of TestFloat is <NOBR>Release 3a</NOBR>.
+The current version of TestFloat is <NOBR>Release 3b</NOBR>.
</P>
<P>
@@ -75,7 +75,7 @@ binary floating-point that conforms to the IEEE Standard for Floating-Point
Arithmetic.
SoftFloat is not included with the TestFloat sources.
It can be obtained from the Web page
-<A HREF="http://www.jhauser.us/arithmetic/SoftFloat.html"><CODE>http://www.jhauser.us/arithmetic/SoftFloat.html</CODE></A>.
+<A HREF="http://www.jhauser.us/arithmetic/SoftFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/SoftFloat.html</CODE></NOBR></A>.
</P>
@@ -120,10 +120,10 @@ and <CODE>&lt;stdint.h&gt;</CODE></I>.
The TestFloat package was written by me, <NOBR>John R.</NOBR> Hauser.
<NOBR>Release 3</NOBR> of TestFloat was a completely new implementation
supplanting earlier releases.
-The project to create <NOBR>Release 3</NOBR> (and <NOBR>now 3a</NOBR>) was done
-in the employ of the University of California, Berkeley, within the Department
-of Electrical Engineering and Computer Sciences, first for the Parallel
-Computing Laboratory (Par Lab) and then for the ASPIRE Lab.
+The project to create <NOBR>Release 3</NOBR> (now <NOBR>through 3b</NOBR>) was
+done in the employ of the University of California, Berkeley, within the
+Department of Electrical Engineering and Computer Sciences, first for the
+Parallel Computing Laboratory (Par Lab) and then for the ASPIRE Lab.
The work was officially overseen by Prof. Krste Asanovic, with funding provided
by these sources:
<BLOCKQUOTE>
@@ -154,12 +154,12 @@ Oracle, and Samsung.
</P>
<P>
-The following applies to the whole of TestFloat <NOBR>Release 3a</NOBR> as well
+The following applies to the whole of TestFloat <NOBR>Release 3b</NOBR> as well
as to each source file individually.
</P>
<P>
-Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
California.
All rights reserved.
</P>
@@ -315,7 +315,7 @@ In addition to the distributed sources, TestFloat depends on the existence of a
compatible Berkeley SoftFloat library and the corresponding header file
<CODE>softfloat.h</CODE>.
As mentioned earlier, SoftFloat is a separate package available at Web page
-<A HREF="http://www.jhauser.us/arithmetic/SoftFloat.html"><CODE>http://www.jhauser.us/arithmetic/SoftFloat.html</CODE></A>.
+<A HREF="http://www.jhauser.us/arithmetic/SoftFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/SoftFloat.html</CODE></NOBR></A>.
The SoftFloat library must be compiled before the TestFloat programs can be
built.
In the example Makefiles, the locations of the SoftFloat header files and
@@ -425,6 +425,35 @@ The TestFloat source files are affected by a few C preprocessor macros:
<DD>
Must be defined for little-endian machines;
must not be defined for big-endian machines.
+<DT><CODE>INLINE</CODE>
+<DD>
+Can be defined to a sequence of tokens used to indicate that a C function
+should be inlined.
+If the compiler does not support the inlining of functions, this macro must not
+be defined.
+For compilers that conform to the C Standard&rsquo;s rules for inline
+functions, this macro can be defined as the single keyword <CODE>inline</CODE>.
+For other compilers that follow a convention pre-dating the standardization of
+<CODE>inline</CODE>, this macro may need to be defined to <CODE>extern</CODE>
+<CODE>inline</CODE>.
+<DT><CODE>THREAD_LOCAL</CODE>
+<DD>
+Can be defined to a sequence of tokens that, when appearing at the start of a
+variable declaration, indicates to the C compiler that the variable is
+<I>per-thread</I>, meaning that each execution thread gets its own separate
+instance of the variable.
+This macro is used in the supplied version of SoftFloat&rsquo;s header
+<CODE>softfloat.h</CODE>, in the declarations of variables
+<CODE>softfloat_roundingMode</CODE>, <CODE>softfloat_detectTininess</CODE>,
+<CODE>extF80_roundingPrecision</CODE>, and
+<CODE>softfloat_exceptionFlags</CODE>.
+To use the supplied, unmodified header <CODE>softfloat.h</CODE>, this macro
+must be defined (or not defined) the same as when the SoftFloat library was
+built.
+<DT><CODE>FLOAT16</CODE>
+<DD>
+Must be defined if the TestFloat programs are to support the
+<NOBR>16-bit</NOBR> half-precision floating-point format.
<DT><CODE>EXTFLOAT80</CODE>
<DD>
Must be defined if the TestFloat programs are to support the
@@ -435,18 +464,20 @@ Must be defined if the TestFloat programs are to support the
<NOBR>128-bit</NOBR> quadruple-precision floating-point format.
</DL>
</BLOCKQUOTE>
-Following the usual custom <NOBR>for C</NOBR>, the content of a macro&rsquo;s
-definition is irrelevant;
+Following the usual custom <NOBR>for C</NOBR>, for all the macros except
+<CODE>INLINE</CODE> and <CODE>THREAD_LOCAL</CODE>, the content of a
+macro&rsquo;s definition is irrelevant;
what matters is a macro&rsquo;s effect on <CODE>#ifdef</CODE> directives.
</P>
<P>
-It is recommended that any definition of macro <CODE>LITTLEENDIAN</CODE> be
-made in a build target&rsquo;s <CODE>platform.h</CODE> header file, because
-endianness is expected to be determined inflexibly by the target machine.
-On the other hand, the <CODE>EXTFLOAT80</CODE> and <CODE>FLOAT128</CODE> macros
-are not dictated by the target and hence might be better located in the
-target&rsquo;s Makefile (or its equivalent).
+It is recommended that any definition of macros <CODE>LITTLEENDIAN</CODE>,
+<CODE>INLINE</CODE>, and <CODE>THREAD_LOCAL</CODE> be made in a build
+target&rsquo;s <CODE>platform.h</CODE> header file, because these macros are
+expected to be determined inflexibly by the target machine and compiler.
+On the other hand, the <CODE>FLOAT16</CODE>, <CODE>EXTFLOAT80</CODE>, and
+<CODE>FLOAT128</CODE> macros are not dictated by the target and hence might be
+better located in the target&rsquo;s Makefile (or its equivalent).
</P>
@@ -572,7 +603,7 @@ target&rsquo;s Makefile be modified to refer to that alternate file in place of
<P>
At the time of this writing, the most up-to-date information about TestFloat
and the latest release can be found at the Web page
-<A HREF="http://www.jhauser.us/arithmetic/TestFloat.html"><CODE>http://www.jhauser.us/arithmetic/TestFloat.html</CODE></A>.
+<A HREF="http://www.jhauser.us/arithmetic/TestFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/TestFloat.html</CODE></NOBR></A>.
</P>
diff --git a/doc/testfloat.html b/doc/testfloat.html
index bb97669..8d8177f 100644
--- a/doc/testfloat.html
+++ b/doc/testfloat.html
@@ -7,11 +7,11 @@
<BODY>
-<H1>Berkeley TestFloat Release 3a: <CODE>testfloat</CODE></H1>
+<H1>Berkeley TestFloat Release 3b: <CODE>testfloat</CODE></H1>
<P>
John R. Hauser<BR>
-2015 October 23<BR>
+2016 July 22<BR>
</P>
@@ -121,6 +121,19 @@ The set of testable operations is just the set of operations that this build of
<CODE>testfloat</CODE> has some way to invoke for testing.
</P>
+<H3><CODE>-seed &lt;num&gt;</CODE></H3>
+
+<P>
+The <CODE>-seed</CODE> option sets the seed for the pseudo-random number
+generator used for generating test cases.
+The argument to <CODE>-seed</CODE> is a nonnegative integer.
+Executing the same compiled <CODE>testfloat</CODE> program with the same
+arguments (including the same pseudo-random number seed) should always perform
+the same sequence of tests, whereas changing the pseudo-random number seed
+should result in a different sequence of tests.
+The default seed number <NOBR>is 1</NOBR>.
+</P>
+
<H3><CODE>-level &lt;num&gt;</CODE></H3>
<P>
@@ -175,7 +188,8 @@ The <CODE>-checkNaNs</CODE> option causes <CODE>testfloat</CODE> to verify the
bitwise correctness of NaN results.
In order for this option to be sensible, <CODE>testfloat</CODE> must have been
compiled so that its internal reference implementation of floating-point
-(SoftFloat) generates the proper NaN results for the system being tested.
+(Berkeley SoftFloat) generates the proper NaN results for the system being
+tested.
</P>
<H3><CODE>-precision32, -precision64, -precision80</CODE></H3>
@@ -235,7 +249,7 @@ Just as <CODE>testfloat</CODE> can test an operation for all five rounding
modes in sequence, multiple operations can be tested with a single execution of
<CODE>testfloat</CODE>.
Two sets are recognized: <CODE>-all1</CODE> and <CODE>-all2</CODE>.
-The set <CODE>-all1</CODE> comprises all one-operand operations, while
+The set <CODE>-all1</CODE> is all one-operand operations, while
<CODE>-all2</CODE> is all two-operand operations.
A function set is used in place of an operation name in the
<CODE>testfloat</CODE> command line, such as
diff --git a/doc/testfloat_gen.html b/doc/testfloat_gen.html
index 9e24c54..306e3c5 100644
--- a/doc/testfloat_gen.html
+++ b/doc/testfloat_gen.html
@@ -7,11 +7,11 @@
<BODY>
-<H1>Berkeley TestFloat Release 3a: <CODE>testfloat_gen</CODE></H1>
+<H1>Berkeley TestFloat Release 3b: <CODE>testfloat_gen</CODE></H1>
<P>
John R. Hauser<BR>
-2015 October 23<BR>
+2016 July 22<BR>
</P>
@@ -89,6 +89,10 @@ A <CODE>&lt;type&gt;</CODE> can be one of the following:
<TD>signed <NOBR>64-bit</NOBR> integers</TD>
</TR>
<TR>
+<TD><CODE>f16 [&lt;num&gt;]</CODE></TD>
+<TD>one or more <NOBR>16-bit</NOBR> half-precision floating-point values</TD>
+</TR>
+<TR>
<TD><CODE>f32 [&lt;num&gt;]</CODE></TD>
<TD>one or more <NOBR>32-bit</NOBR> single-precision floating-point values</TD>
</TR>
@@ -130,7 +134,7 @@ output from <CODE>testfloat_gen</CODE> contains not only the operands for that
operation (as would be generated by an appropriate <CODE>&lt;type&gt;</CODE>
argument) but also the expected results as determined by
<CODE>testfloat_gen</CODE>&rsquo;s internal floating-point emulation
-(SoftFloat).
+(Berkeley SoftFloat).
The available operation names are listed in
<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>.
In all cases, floating-point operations have two results:
@@ -170,6 +174,19 @@ This can be used, for example, to indicate to a downstream program what kind of
test to perform for the test cases that follow.
</P>
+<H3><CODE>-seed &lt;num&gt;</CODE></H3>
+
+<P>
+The <CODE>-seed</CODE> option sets the seed for the pseudo-random number
+generator used for generating test cases.
+The argument to <CODE>-seed</CODE> is a nonnegative integer.
+Executing the same <CODE>testfloat_gen</CODE> program with the same arguments
+(including the same pseudo-random number seed) should always generate the same
+sequence of test cases, whereas changing the pseudo-random number seed should
+result in a different sequence of test cases.
+The default seed number <NOBR>is 1</NOBR>.
+</P>
+
<H3><CODE>-level &lt;num&gt;</CODE></H3>
<P>
@@ -245,8 +262,8 @@ be detected before rounding, while <CODE>-tininessafter</CODE> indicates that
tininess on underflow will be detected after rounding.
These options are ignored for operations that are exact and thus do not round.
When the method of tininess detection matters but is not specified, the default
-is to detect tininess on underflow before rounding, same as
-<CODE>-tininessbefore</CODE>.
+is to detect tininess on underflow after rounding, same as
+<CODE>-tininessafter</CODE>.
</P>
<H3><CODE>-notexact, -exact</CODE></H3>
diff --git a/doc/testfloat_ver.html b/doc/testfloat_ver.html
index f1d01b3..e55ea33 100644
--- a/doc/testfloat_ver.html
+++ b/doc/testfloat_ver.html
@@ -7,11 +7,11 @@
<BODY>
-<H1>Berkeley TestFloat Release 3a: <CODE>testfloat_ver</CODE></H1>
+<H1>Berkeley TestFloat Release 3b: <CODE>testfloat_ver</CODE></H1>
<P>
John R. Hauser<BR>
-2015 October 23<BR>
+2016 July 22<BR>
</P>
@@ -112,7 +112,8 @@ The <CODE>-checkNaNs</CODE> option causes <CODE>testfloat_ver</CODE> to verify
the bitwise correctness of NaN results.
In order for this option to be sensible, <CODE>testfloat_ver</CODE> must have
been compiled so that its internal reference implementation of floating-point
-(SoftFloat) generates the proper NaN results for the system being tested.
+(Berkeley SoftFloat) generates the proper NaN results for the system being
+tested.
</P>
<H3><CODE>-precision32, -precision64, -precision80</CODE></H3>
@@ -157,8 +158,8 @@ be detected before rounding, while <CODE>-tininessafter</CODE> indicates that
tininess on underflow should be detected after rounding.
These options are ignored for operations that are exact and thus do not round.
When the method of tininess detection matters but is not specified, the default
-assumption is that tininess should be detected before rounding, same as
-<CODE>-tininessbefore</CODE>.
+assumption is that tininess should be detected after rounding, same as
+<CODE>-tininessafter</CODE>.
</P>
<H3><CODE>-notexact, -exact</CODE></H3>
diff --git a/doc/testsoftfloat.html b/doc/testsoftfloat.html
index ee5f0d5..6a10812 100644
--- a/doc/testsoftfloat.html
+++ b/doc/testsoftfloat.html
@@ -7,11 +7,11 @@
<BODY>
-<H1>Berkeley TestFloat Release 3a: <CODE>testsoftfloat</CODE></H1>
+<H1>Berkeley TestFloat Release 3b: <CODE>testsoftfloat</CODE></H1>
<P>
John R. Hauser<BR>
-2015 October 23<BR>
+2016 July 22<BR>
</P>
@@ -87,6 +87,19 @@ The <CODE>-help</CODE> option causes a summary of program usage to be written,
after which the program exits.
</P>
+<H3><CODE>-seed &lt;num&gt;</CODE></H3>
+
+<P>
+The <CODE>-seed</CODE> option sets the seed for the pseudo-random number
+generator used for generating test cases.
+The argument to <CODE>-seed</CODE> is a nonnegative integer.
+Executing the same <CODE>testsoftfloat</CODE> program with the same arguments
+(including the same pseudo-random number seed) should always perform the same
+sequence of tests, whereas changing the pseudo-random number seed should result
+in a different sequence of tests.
+The default seed number <NOBR>is 1</NOBR>.
+</P>
+
<H3><CODE>-level &lt;num&gt;</CODE></H3>
<P>
@@ -194,7 +207,7 @@ Just as <CODE>testsoftfloat</CODE> can test a function for all five rounding
modes in sequence, multiple functions can be tested with a single execution of
<CODE>testsoftfloat</CODE>.
Two sets are recognized: <CODE>-all1</CODE> and <CODE>-all2</CODE>.
-The set <CODE>-all1</CODE> comprises all one-operand operations, while
+The set <CODE>-all1</CODE> is all one-operand operations, while
<CODE>-all2</CODE> is all two-operand operations.
A function set is used in place of a function name in the
<CODE>testsoftfloat</CODE> command line, such as
diff --git a/doc/timesoftfloat.html b/doc/timesoftfloat.html
index 225d521..f2b2e07 100644
--- a/doc/timesoftfloat.html
+++ b/doc/timesoftfloat.html
@@ -7,11 +7,11 @@
<BODY>
-<H1>Berkeley TestFloat Release 3a: <CODE>timesoftfloat</CODE></H1>
+<H1>Berkeley TestFloat Release 3b: <CODE>timesoftfloat</CODE></H1>
<P>
John R. Hauser<BR>
-2015 October 23<BR>
+2016 July 22<BR>
</P>
@@ -25,7 +25,7 @@ package, a small collection of programs for testing that an implementation of
floating-point conforms to the IEEE Standard for Binary Floating-Point
Arithmetic.
Although <CODE>timesoftfloat</CODE> does not test floating-point correctness
-like other TestFloat programs, nevertheless <CODE>timesoftfloat</CODE> is a
+like the other TestFloat programs, nevertheless <CODE>timesoftfloat</CODE> is a
partner to TestFloat&rsquo;s <CODE>testsoftfloat</CODE> program.
For more about TestFloat generally and <CODE>testsoftfloat</CODE> specifically,
see file
@@ -63,9 +63,9 @@ Your actual experience with SoftFloat may differ from the speeds reported by
</P>
<P>
-Note that the remainder operations (<CODE>f32_rem</CODE>, <CODE>f64_rem</CODE>,
-<CODE>extF80_rem</CODE>, and <CODE>f128_rem</CODE>) will be markedly slower
-than other operations, particularly for double-extended-precision
+Note that the remainder operations for larger formats (<CODE>f64_rem</CODE>,
+<CODE>extF80_rem</CODE>, and <CODE>f128_rem</CODE>) can be markedly slower than
+other operations, particularly for double-extended-precision
(<CODE>extF80_rem</CODE>) and quadruple precision (<CODE>f128_rem</CODE>).
This is inherent to the remainder operation itself and is not a failing of the
SoftFloat implementation.
@@ -166,9 +166,8 @@ modes in sequence, multiple functions can be timed with a single execution of
<CODE>timesoftfloat</CODE>.
Three sets are recognized:
<CODE>-all1</CODE>, <CODE>-all2</CODE>, and <CODE>-all</CODE>.
-The set <CODE>-all1</CODE> comprises all one-operand operations,
-<CODE>-all2</CODE> is all two-operand operations, and <CODE>-all</CODE> is
-obviously all operations.
+The set <CODE>-all1</CODE> is all one-operand operations, <CODE>-all2</CODE> is
+all two-operand operations, and <CODE>-all</CODE> is obviously all operations.
A function set is used in place of a function name in the
<CODE>timesoftfloat</CODE> command line, such as
<BLOCKQUOTE>
diff --git a/source/fail.c b/source/fail.c
index 3c1f01d..732218a 100644
--- a/source/fail.c
+++ b/source/fail.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/fail.h b/source/fail.h
index cf48227..6a4519a 100644
--- a/source/fail.h
+++ b/source/fail.h
@@ -1,7 +1,7 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/functionInfos.c b/source/functionInfos.c
index dacd1ef..1828c6a 100644
--- a/source/functionInfos.c
+++ b/source/functionInfos.c
@@ -1,12 +1,12 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -49,13 +49,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define EFF_T_REDP FUNC_EFF_TININESSMODE_REDUCEDPREC
/*----------------------------------------------------------------------------
-| Warning: This array must match the functions names defined in
-| "functions.h".
+| Warning: This array must match the list of macros defined in "functions.h".
*----------------------------------------------------------------------------*/
const struct functionInfo functionInfos[NUM_FUNCTIONS] = {
{ 0, 0 },
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
+#ifdef FLOAT16
+ { "ui32_to_f16", ARG_1 | EFF_R },
+#endif
{ "ui32_to_f32", ARG_1 | EFF_R },
{ "ui32_to_f64", ARG_1 },
#ifdef EXTFLOAT80
@@ -64,6 +66,9 @@ const struct functionInfo functionInfos[NUM_FUNCTIONS] = {
#ifdef FLOAT128
{ "ui32_to_f128", ARG_1 },
#endif
+#ifdef FLOAT16
+ { "ui64_to_f16", ARG_1 | EFF_R },
+#endif
{ "ui64_to_f32", ARG_1 | EFF_R },
{ "ui64_to_f64", ARG_1 | EFF_R },
#ifdef EXTFLOAT80
@@ -72,6 +77,9 @@ const struct functionInfo functionInfos[NUM_FUNCTIONS] = {
#ifdef FLOAT128
{ "ui64_to_f128", ARG_1 },
#endif
+#ifdef FLOAT16
+ { "i32_to_f16", ARG_1 | EFF_R },
+#endif
{ "i32_to_f32", ARG_1 | EFF_R },
{ "i32_to_f64", ARG_1 },
#ifdef EXTFLOAT80
@@ -80,6 +88,9 @@ const struct functionInfo functionInfos[NUM_FUNCTIONS] = {
#ifdef FLOAT128
{ "i32_to_f128", ARG_1 },
#endif
+#ifdef FLOAT16
+ { "i64_to_f16", ARG_1 | EFF_R },
+#endif
{ "i64_to_f32", ARG_1 | EFF_R },
{ "i64_to_f64", ARG_1 | EFF_R },
#ifdef EXTFLOAT80
@@ -90,6 +101,40 @@ const struct functionInfo functionInfos[NUM_FUNCTIONS] = {
#endif
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
+#ifdef FLOAT16
+ { "f16_to_ui32", ARG_1 | ARG_R | ARG_E },
+ { "f16_to_ui64", ARG_1 | ARG_R | ARG_E },
+ { "f16_to_i32", ARG_1 | ARG_R | ARG_E },
+ { "f16_to_i64", ARG_1 | ARG_R | ARG_E },
+ { "f16_to_ui32_r_minMag", ARG_1 | ARG_E },
+ { "f16_to_ui64_r_minMag", ARG_1 | ARG_E },
+ { "f16_to_i32_r_minMag", ARG_1 | ARG_E },
+ { "f16_to_i64_r_minMag", ARG_1 | ARG_E },
+ { "f16_to_f32", ARG_1 },
+ { "f16_to_f64", ARG_1 },
+#ifdef EXTFLOAT80
+ { "f16_to_extF80", ARG_1 },
+#endif
+#ifdef FLOAT128
+ { "f16_to_f128", ARG_1 },
+#endif
+ { "f16_roundToInt", ARG_1 | ARG_R | ARG_E },
+ { "f16_add", ARG_2 | EFF_R },
+ { "f16_sub", ARG_2 | EFF_R },
+ { "f16_mul", ARG_2 | EFF_R | EFF_T },
+ { "f16_mulAdd", EFF_R | EFF_T },
+ { "f16_div", ARG_2 | EFF_R },
+ { "f16_rem", ARG_2 },
+ { "f16_sqrt", ARG_1 | EFF_R },
+ { "f16_eq", ARG_2 },
+ { "f16_le", ARG_2 },
+ { "f16_lt", ARG_2 },
+ { "f16_eq_signaling", ARG_2 },
+ { "f16_le_quiet", ARG_2 },
+ { "f16_lt_quiet", ARG_2 },
+#endif
+ /*------------------------------------------------------------------------
+ *------------------------------------------------------------------------*/
{ "f32_to_ui32", ARG_1 | ARG_R | ARG_E },
{ "f32_to_ui64", ARG_1 | ARG_R | ARG_E },
{ "f32_to_i32", ARG_1 | ARG_R | ARG_E },
@@ -98,6 +143,9 @@ const struct functionInfo functionInfos[NUM_FUNCTIONS] = {
{ "f32_to_ui64_r_minMag", ARG_1 | ARG_E },
{ "f32_to_i32_r_minMag", ARG_1 | ARG_E },
{ "f32_to_i64_r_minMag", ARG_1 | ARG_E },
+#ifdef FLOAT16
+ { "f32_to_f16", ARG_1 | EFF_R | EFF_T },
+#endif
{ "f32_to_f64", ARG_1 },
#ifdef EXTFLOAT80
{ "f32_to_extF80", ARG_1 },
@@ -129,7 +177,10 @@ const struct functionInfo functionInfos[NUM_FUNCTIONS] = {
{ "f64_to_ui64_r_minMag", ARG_1 | ARG_E },
{ "f64_to_i32_r_minMag", ARG_1 | ARG_E },
{ "f64_to_i64_r_minMag", ARG_1 | ARG_E },
- { "f64_to_f32", ARG_1 | EFF_R | EFF_T },
+#ifdef FLOAT16
+ { "f64_to_f16", ARG_1 | EFF_R | EFF_T },
+#endif
+ { "f64_to_f32", ARG_1 | EFF_R | EFF_T },
#ifdef EXTFLOAT80
{ "f64_to_extF80", ARG_1 },
#endif
@@ -161,8 +212,11 @@ const struct functionInfo functionInfos[NUM_FUNCTIONS] = {
{ "extF80_to_ui64_r_minMag", ARG_1 | ARG_E },
{ "extF80_to_i32_r_minMag", ARG_1 | ARG_E },
{ "extF80_to_i64_r_minMag", ARG_1 | ARG_E },
- { "extF80_to_f32", ARG_1 | EFF_R | EFF_T },
- { "extF80_to_f64", ARG_1 | EFF_R | EFF_T },
+#ifdef FLOAT16
+ { "extF80_to_f16", ARG_1 | EFF_R | EFF_T },
+#endif
+ { "extF80_to_f32", ARG_1 | EFF_R | EFF_T },
+ { "extF80_to_f64", ARG_1 | EFF_R | EFF_T },
#ifdef FLOAT128
{ "extF80_to_f128", ARG_1 },
#endif
@@ -191,8 +245,11 @@ const struct functionInfo functionInfos[NUM_FUNCTIONS] = {
{ "f128_to_ui64_r_minMag", ARG_1 | ARG_E },
{ "f128_to_i32_r_minMag", ARG_1 | ARG_E },
{ "f128_to_i64_r_minMag", ARG_1 | ARG_E },
- { "f128_to_f32", ARG_1 | EFF_R | EFF_T },
- { "f128_to_f64", ARG_1 | EFF_R | EFF_T },
+#ifdef FLOAT16
+ { "f128_to_f16", ARG_1 | EFF_R | EFF_T },
+#endif
+ { "f128_to_f32", ARG_1 | EFF_R | EFF_T },
+ { "f128_to_f64", ARG_1 | EFF_R | EFF_T },
#ifdef EXTFLOAT80
{ "f128_to_extF80", ARG_1 | EFF_R | EFF_T },
#endif
diff --git a/source/functions.h b/source/functions.h
index fd76faa..3c128cf 100644
--- a/source/functions.h
+++ b/source/functions.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -41,7 +41,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| Warning: This list must match the contents of "functionInfos.c".
*----------------------------------------------------------------------------*/
enum {
+ /*------------------------------------------------------------------------
+ *------------------------------------------------------------------------*/
+#ifdef FLOAT16
+ UI32_TO_F16 = 1,
+ UI32_TO_F32,
+#else
UI32_TO_F32 = 1,
+#endif
UI32_TO_F64,
#ifdef EXTFLOAT80
UI32_TO_EXTF80,
@@ -49,6 +56,9 @@ enum {
#ifdef FLOAT128
UI32_TO_F128,
#endif
+#ifdef FLOAT16
+ UI64_TO_F16,
+#endif
UI64_TO_F32,
UI64_TO_F64,
#ifdef EXTFLOAT80
@@ -57,6 +67,9 @@ enum {
#ifdef FLOAT128
UI64_TO_F128,
#endif
+#ifdef FLOAT16
+ I32_TO_F16,
+#endif
I32_TO_F32,
I32_TO_F64,
#ifdef EXTFLOAT80
@@ -65,6 +78,9 @@ enum {
#ifdef FLOAT128
I32_TO_F128,
#endif
+#ifdef FLOAT16
+ I64_TO_F16,
+#endif
I64_TO_F32,
I64_TO_F64,
#ifdef EXTFLOAT80
@@ -73,6 +89,42 @@ enum {
#ifdef FLOAT128
I64_TO_F128,
#endif
+ /*------------------------------------------------------------------------
+ *------------------------------------------------------------------------*/
+#ifdef FLOAT16
+ F16_TO_UI32,
+ F16_TO_UI64,
+ F16_TO_I32,
+ F16_TO_I64,
+ F16_TO_UI32_R_MINMAG,
+ F16_TO_UI64_R_MINMAG,
+ F16_TO_I32_R_MINMAG,
+ F16_TO_I64_R_MINMAG,
+ F16_TO_F32,
+ F16_TO_F64,
+#ifdef EXTFLOAT80
+ F16_TO_EXTF80,
+#endif
+#ifdef FLOAT128
+ F16_TO_F128,
+#endif
+ F16_ROUNDTOINT,
+ F16_ADD,
+ F16_SUB,
+ F16_MUL,
+ F16_MULADD,
+ F16_DIV,
+ F16_REM,
+ F16_SQRT,
+ F16_EQ,
+ F16_LE,
+ F16_LT,
+ F16_EQ_SIGNALING,
+ F16_LE_QUIET,
+ F16_LT_QUIET,
+#endif
+ /*------------------------------------------------------------------------
+ *------------------------------------------------------------------------*/
F32_TO_UI32,
F32_TO_UI64,
F32_TO_I32,
@@ -81,6 +133,9 @@ enum {
F32_TO_UI64_R_MINMAG,
F32_TO_I32_R_MINMAG,
F32_TO_I64_R_MINMAG,
+#ifdef FLOAT16
+ F32_TO_F16,
+#endif
F32_TO_F64,
#ifdef EXTFLOAT80
F32_TO_EXTF80,
@@ -102,6 +157,8 @@ enum {
F32_EQ_SIGNALING,
F32_LE_QUIET,
F32_LT_QUIET,
+ /*------------------------------------------------------------------------
+ *------------------------------------------------------------------------*/
F64_TO_UI32,
F64_TO_UI64,
F64_TO_I32,
@@ -110,6 +167,9 @@ enum {
F64_TO_UI64_R_MINMAG,
F64_TO_I32_R_MINMAG,
F64_TO_I64_R_MINMAG,
+#ifdef FLOAT16
+ F64_TO_F16,
+#endif
F64_TO_F32,
#ifdef EXTFLOAT80
F64_TO_EXTF80,
@@ -131,6 +191,8 @@ enum {
F64_EQ_SIGNALING,
F64_LE_QUIET,
F64_LT_QUIET,
+ /*------------------------------------------------------------------------
+ *------------------------------------------------------------------------*/
#ifdef EXTFLOAT80
EXTF80_TO_UI32,
EXTF80_TO_UI64,
@@ -140,6 +202,9 @@ enum {
EXTF80_TO_UI64_R_MINMAG,
EXTF80_TO_I32_R_MINMAG,
EXTF80_TO_I64_R_MINMAG,
+#ifdef FLOAT16
+ EXTF80_TO_F16,
+#endif
EXTF80_TO_F32,
EXTF80_TO_F64,
#ifdef FLOAT128
@@ -159,6 +224,8 @@ enum {
EXTF80_LE_QUIET,
EXTF80_LT_QUIET,
#endif
+ /*------------------------------------------------------------------------
+ *------------------------------------------------------------------------*/
#ifdef FLOAT128
F128_TO_UI32,
F128_TO_UI64,
@@ -168,6 +235,9 @@ enum {
F128_TO_UI64_R_MINMAG,
F128_TO_I32_R_MINMAG,
F128_TO_I64_R_MINMAG,
+#ifdef FLOAT16
+ F128_TO_F16,
+#endif
F128_TO_F32,
F128_TO_F64,
#ifdef EXTFLOAT80
diff --git a/source/functions_common.c b/source/functions_common.c
index 0e905b3..0e979ea 100644
--- a/source/functions_common.c
+++ b/source/functions_common.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/genCases.h b/source/genCases.h
index 3443e36..63c6a3e 100644
--- a/source/genCases.h
+++ b/source/genCases.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -62,6 +62,16 @@ void genCases_i64_a_init( void );
void genCases_i64_a_next( void );
extern int64_t genCases_i64_a;
+#ifdef FLOAT16
+void genCases_f16_a_init( void );
+void genCases_f16_a_next( void );
+void genCases_f16_ab_init( void );
+void genCases_f16_ab_next( void );
+void genCases_f16_abc_init( void );
+void genCases_f16_abc_next( void );
+extern float16_t genCases_f16_a, genCases_f16_b, genCases_f16_c;
+#endif
+
void genCases_f32_a_init( void );
void genCases_f32_a_next( void );
void genCases_f32_ab_init( void );
diff --git a/source/genCases_common.c b/source/genCases_common.c
index 83a1fba..28da76b 100644
--- a/source/genCases_common.c
+++ b/source/genCases_common.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/genCases_extF80.c b/source/genCases_extF80.c
index 33a37a4..e5a552c 100644
--- a/source/genCases_extF80.c
+++ b/source/genCases_extF80.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/genCases_f128.c b/source/genCases_f128.c
index 68ccf4f..d02b991 100644
--- a/source/genCases_f128.c
+++ b/source/genCases_f128.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/genCases_f16.c b/source/genCases_f16.c
new file mode 100644
index 0000000..c5aa1b7
--- /dev/null
+++ b/source/genCases_f16.c
@@ -0,0 +1,585 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "platform.h"
+#include "random.h"
+#include "softfloat.h"
+#include "genCases.h"
+
+#ifdef FLOAT16
+
+struct sequence {
+ int expNum, term1Num, term2Num;
+ bool done;
+};
+
+union ui16_f16 { uint16_t ui; float16_t f; };
+
+enum {
+ f16NumQIn = 22,
+ f16NumQOut = 34,
+ f16NumP1 = 4,
+ f16NumP2 = 36
+};
+static const uint16_t f16QIn[f16NumQIn] = {
+ 0x0000, /* positive, subnormal */
+ 0x0400, /* positive, -14 */
+ 0x1000, /* positive, -11 */
+ 0x3400, /* positive, -2 */
+ 0x3800, /* positive, -1 */
+ 0x3C00, /* positive, 0 */
+ 0x4000, /* positive, 1 */
+ 0x4400, /* positive, 2 */
+ 0x6800, /* positive, 11 */
+ 0x7800, /* positive, 15 */
+ 0x7C00, /* positive, infinity or NaN */
+ 0x8000, /* negative, subnormal */
+ 0x8400, /* negative, -14 */
+ 0x9000, /* negative, -11 */
+ 0xB400, /* negative, -2 */
+ 0xB800, /* negative, -1 */
+ 0xBC00, /* negative, 0 */
+ 0xC000, /* negative, 1 */
+ 0xC400, /* negative, 2 */
+ 0xE800, /* negative, 11 */
+ 0xF800, /* negative, 15 */
+ 0xFC00 /* negative, infinity or NaN */
+};
+static const uint16_t f16QOut[f16NumQOut] = {
+ 0x0000, /* positive, subnormal */
+ 0x0400, /* positive, -14 */
+ 0x0800, /* positive, -13 */
+ 0x1000, /* positive, -11 */
+ 0x2C00, /* positive, -4 */
+ 0x3000, /* positive, -3 */
+ 0x3400, /* positive, -2 */
+ 0x3800, /* positive, -1 */
+ 0x3C00, /* positive, 0 */
+ 0x4000, /* positive, 1 */
+ 0x4400, /* positive, 2 */
+ 0x4800, /* positive, 3 */
+ 0x4C00, /* positive, 4 */
+ 0x6800, /* positive, 11 */
+ 0x7400, /* positive, 14 */
+ 0x7800, /* positive, 15 */
+ 0x7C00, /* positive, infinity or NaN */
+ 0x8000, /* negative, subnormal */
+ 0x8400, /* negative, -14 */
+ 0x8800, /* negative, -13 */
+ 0x9000, /* negative, -11 */
+ 0xAC00, /* negative, -4 */
+ 0xB000, /* negative, -3 */
+ 0xB400, /* negative, -2 */
+ 0xB800, /* negative, -1 */
+ 0xBC00, /* negative, 0 */
+ 0xC000, /* negative, 1 */
+ 0xC400, /* negative, 2 */
+ 0xC800, /* negative, 3 */
+ 0xCC00, /* negative, 4 */
+ 0xE800, /* negative, 11 */
+ 0xF400, /* negative, 14 */
+ 0xF800, /* negative, 15 */
+ 0xFC00 /* negative, infinity or NaN */
+};
+static const uint16_t f16P1[f16NumP1] = {
+ 0x0000,
+ 0x0001,
+ 0x03FF,
+ 0x03FE
+};
+static const uint16_t f16P2[f16NumP2] = {
+ 0x0000,
+ 0x0001,
+ 0x0002,
+ 0x0004,
+ 0x0008,
+ 0x0010,
+ 0x0020,
+ 0x0040,
+ 0x0080,
+ 0x0100,
+ 0x0200,
+ 0x0300,
+ 0x0380,
+ 0x03C0,
+ 0x03E0,
+ 0x03F0,
+ 0x03F8,
+ 0x03FC,
+ 0x03FE,
+ 0x03FF,
+ 0x03FD,
+ 0x03FB,
+ 0x03F7,
+ 0x03EF,
+ 0x03DF,
+ 0x03BF,
+ 0x037F,
+ 0x02FF,
+ 0x01FF,
+ 0x00FF,
+ 0x007F,
+ 0x003F,
+ 0x001F,
+ 0x000F,
+ 0x0007,
+ 0x0003
+};
+
+static const uint_fast64_t f16NumQInP1 = f16NumQIn * f16NumP1;
+static const uint_fast64_t f16NumQOutP1 = f16NumQOut * f16NumP1;
+
+static float16_t f16NextQInP1( struct sequence *sequencePtr )
+{
+ int expNum, sigNum;
+ union ui16_f16 uZ;
+
+ expNum = sequencePtr->expNum;
+ sigNum = sequencePtr->term1Num;
+ uZ.ui = f16QIn[expNum] | f16P1[sigNum];
+ ++sigNum;
+ if ( f16NumP1 <= sigNum ) {
+ sigNum = 0;
+ ++expNum;
+ if ( f16NumQIn <= expNum ) {
+ expNum = 0;
+ sequencePtr->done = true;
+ }
+ sequencePtr->expNum = expNum;
+ }
+ sequencePtr->term1Num = sigNum;
+ return uZ.f;
+
+}
+
+static float16_t f16NextQOutP1( struct sequence *sequencePtr )
+{
+ int expNum, sigNum;
+ union ui16_f16 uZ;
+
+ expNum = sequencePtr->expNum;
+ sigNum = sequencePtr->term1Num;
+ uZ.ui = f16QOut[expNum] | f16P1[sigNum];
+ ++sigNum;
+ if ( f16NumP1 <= sigNum ) {
+ sigNum = 0;
+ ++expNum;
+ if ( f16NumQOut <= expNum ) {
+ expNum = 0;
+ sequencePtr->done = true;
+ }
+ sequencePtr->expNum = expNum;
+ }
+ sequencePtr->term1Num = sigNum;
+ return uZ.f;
+
+}
+
+static const uint_fast64_t f16NumQInP2 = f16NumQIn * f16NumP2;
+static const uint_fast64_t f16NumQOutP2 = f16NumQOut * f16NumP2;
+
+static float16_t f16NextQInP2( struct sequence *sequencePtr )
+{
+ int expNum, sigNum;
+ union ui16_f16 uZ;
+
+ expNum = sequencePtr->expNum;
+ sigNum = sequencePtr->term1Num;
+ uZ.ui = f16QIn[expNum] | f16P2[sigNum];
+ ++sigNum;
+ if ( f16NumP2 <= sigNum ) {
+ sigNum = 0;
+ ++expNum;
+ if ( f16NumQIn <= expNum ) {
+ expNum = 0;
+ sequencePtr->done = true;
+ }
+ sequencePtr->expNum = expNum;
+ }
+ sequencePtr->term1Num = sigNum;
+ return uZ.f;
+
+}
+
+static float16_t f16NextQOutP2( struct sequence *sequencePtr )
+{
+ int expNum, sigNum;
+ union ui16_f16 uZ;
+
+ expNum = sequencePtr->expNum;
+ sigNum = sequencePtr->term1Num;
+ uZ.ui = f16QOut[expNum] | f16P2[sigNum];
+ ++sigNum;
+ if ( f16NumP2 <= sigNum ) {
+ sigNum = 0;
+ ++expNum;
+ if ( f16NumQOut <= expNum ) {
+ expNum = 0;
+ sequencePtr->done = true;
+ }
+ sequencePtr->expNum = expNum;
+ }
+ sequencePtr->term1Num = sigNum;
+ return uZ.f;
+
+}
+
+static float16_t f16RandomQOutP3( void )
+{
+ union ui16_f16 uZ;
+
+ uZ.ui =
+ f16QOut[randomN_ui8( f16NumQOut )]
+ | ((f16P2[randomN_ui8( f16NumP2 )] + f16P2[randomN_ui8( f16NumP2 )])
+ & 0x03FF);
+ return uZ.f;
+
+}
+
+static float16_t f16RandomQOutPInf( void )
+{
+ union ui16_f16 uZ;
+
+ uZ.ui = f16QOut[randomN_ui8( f16NumQOut )] | (random_ui16() & 0x03FF);
+ return uZ.f;
+
+}
+
+enum { f16NumQInfWeightMasks = 4 };
+static const uint16_t f16QInfWeightMasks[f16NumQInfWeightMasks] =
+ { 0xFC00, 0xFC00, 0xBC00, 0x9C00 };
+static const uint16_t f16QInfWeightOffsets[f16NumQInfWeightMasks] =
+ { 0x0000, 0x0000, 0x2000, 0x3000 };
+
+static float16_t f16RandomQInfP3( void )
+{
+ int weightMaskNum;
+ union ui16_f16 uZ;
+
+ weightMaskNum = randomN_ui8( f16NumQInfWeightMasks );
+ uZ.ui =
+ ((random_ui16() & f16QInfWeightMasks[weightMaskNum])
+ + f16QInfWeightOffsets[weightMaskNum])
+ | ((f16P2[randomN_ui8( f16NumP2 )] + f16P2[randomN_ui8( f16NumP2 )])
+ & 0x03FF);
+ return uZ.f;
+
+}
+
+static float16_t f16RandomQInfPInf( void )
+{
+ int weightMaskNum;
+ union ui16_f16 uZ;
+
+ weightMaskNum = randomN_ui8( f16NumQInfWeightMasks );
+ uZ.ui =
+ (random_ui16() & (f16QInfWeightMasks[weightMaskNum] | 0x03FF))
+ + f16QInfWeightOffsets[weightMaskNum];
+ return uZ.f;
+
+}
+
+static float16_t f16Random( void )
+{
+
+ switch ( random_ui8() & 7 ) {
+ case 0:
+ case 1:
+ case 2:
+ return f16RandomQOutP3();
+ case 3:
+ return f16RandomQOutPInf();
+ case 4:
+ case 5:
+ case 6:
+ return f16RandomQInfP3();
+ case 7:
+ return f16RandomQInfPInf();
+ }
+
+}
+
+static struct sequence sequenceA, sequenceB, sequenceC;
+static float16_t currentA, currentB, currentC;
+static int subcase;
+
+float16_t genCases_f16_a, genCases_f16_b, genCases_f16_c;
+
+void genCases_f16_a_init( void )
+{
+
+ sequenceA.expNum = 0;
+ sequenceA.term1Num = 0;
+ sequenceA.term2Num = 0;
+ sequenceA.done = false;
+ subcase = 0;
+ genCases_total =
+ (genCases_level == 1) ? 3 * f16NumQOutP1 : 2 * f16NumQOutP2;
+ genCases_done = false;
+
+}
+
+void genCases_f16_a_next( void )
+{
+
+ if ( genCases_level == 1 ) {
+ switch ( subcase ) {
+ case 0:
+ case 1:
+ genCases_f16_a = f16Random();
+ break;
+ case 2:
+ genCases_f16_a = f16NextQOutP1( &sequenceA );
+ genCases_done = sequenceA.done;
+ subcase = -1;
+ break;
+ }
+ } else {
+ switch ( subcase ) {
+ case 0:
+ genCases_f16_a = f16Random();
+ break;
+ case 1:
+ genCases_f16_a = f16NextQOutP2( &sequenceA );
+ genCases_done = sequenceA.done;
+ subcase = -1;
+ break;
+ }
+ }
+ ++subcase;
+
+}
+
+void genCases_f16_ab_init( void )
+{
+
+ sequenceA.expNum = 0;
+ sequenceA.term1Num = 0;
+ sequenceA.term2Num = 0;
+ sequenceA.done = false;
+ sequenceB.expNum = 0;
+ sequenceB.term1Num = 0;
+ sequenceB.term2Num = 0;
+ sequenceB.done = false;
+ subcase = 0;
+ if ( genCases_level == 1 ) {
+ genCases_total = 6 * f16NumQInP1 * f16NumQInP1;
+ currentA = f16NextQInP1( &sequenceA );
+ } else {
+ genCases_total = 2 * f16NumQInP2 * f16NumQInP2;
+ currentA = f16NextQInP2( &sequenceA );
+ }
+ genCases_done = false;
+
+}
+
+void genCases_f16_ab_next( void )
+{
+
+ if ( genCases_level == 1 ) {
+ switch ( subcase ) {
+ case 0:
+ if ( sequenceB.done ) {
+ sequenceB.done = false;
+ currentA = f16NextQInP1( &sequenceA );
+ }
+ currentB = f16NextQInP1( &sequenceB );
+ case 2:
+ case 4:
+ genCases_f16_a = f16Random();
+ genCases_f16_b = f16Random();
+ break;
+ case 1:
+ genCases_f16_a = currentA;
+ genCases_f16_b = f16Random();
+ break;
+ case 3:
+ genCases_f16_a = f16Random();
+ genCases_f16_b = currentB;
+ break;
+ case 5:
+ genCases_f16_a = currentA;
+ genCases_f16_b = currentB;
+ genCases_done = sequenceA.done & sequenceB.done;
+ subcase = -1;
+ break;
+ }
+ } else {
+ switch ( subcase ) {
+ case 0:
+ genCases_f16_a = f16Random();
+ genCases_f16_b = f16Random();
+ break;
+ case 1:
+ if ( sequenceB.done ) {
+ sequenceB.done = false;
+ currentA = f16NextQInP2( &sequenceA );
+ }
+ genCases_f16_a = currentA;
+ genCases_f16_b = f16NextQInP2( &sequenceB );
+ genCases_done = sequenceA.done & sequenceB.done;
+ subcase = -1;
+ break;
+ }
+ }
+ ++subcase;
+
+}
+
+void genCases_f16_abc_init( void )
+{
+
+ sequenceA.expNum = 0;
+ sequenceA.term1Num = 0;
+ sequenceA.term2Num = 0;
+ sequenceA.done = false;
+ sequenceB.expNum = 0;
+ sequenceB.term1Num = 0;
+ sequenceB.term2Num = 0;
+ sequenceB.done = false;
+ sequenceC.expNum = 0;
+ sequenceC.term1Num = 0;
+ sequenceC.term2Num = 0;
+ sequenceC.done = false;
+ subcase = 0;
+ if ( genCases_level == 1 ) {
+ genCases_total = 9 * f16NumQInP1 * f16NumQInP1 * f16NumQInP1;
+ currentA = f16NextQInP1( &sequenceA );
+ currentB = f16NextQInP1( &sequenceB );
+ } else {
+ genCases_total = 2 * f16NumQInP2 * f16NumQInP2 * f16NumQInP2;
+ currentA = f16NextQInP2( &sequenceA );
+ currentB = f16NextQInP2( &sequenceB );
+ }
+ genCases_done = false;
+
+}
+
+void genCases_f16_abc_next( void )
+{
+
+ if ( genCases_level == 1 ) {
+ switch ( subcase ) {
+ case 0:
+ if ( sequenceC.done ) {
+ sequenceC.done = false;
+ if ( sequenceB.done ) {
+ sequenceB.done = false;
+ currentA = f16NextQInP1( &sequenceA );
+ }
+ currentB = f16NextQInP1( &sequenceB );
+ }
+ currentC = f16NextQInP1( &sequenceC );
+ genCases_f16_a = f16Random();
+ genCases_f16_b = f16Random();
+ genCases_f16_c = currentC;
+ break;
+ case 1:
+ genCases_f16_a = currentA;
+ genCases_f16_b = currentB;
+ genCases_f16_c = f16Random();
+ break;
+ case 2:
+ genCases_f16_a = f16Random();
+ genCases_f16_b = f16Random();
+ genCases_f16_c = f16Random();
+ break;
+ case 3:
+ genCases_f16_a = f16Random();
+ genCases_f16_b = currentB;
+ genCases_f16_c = currentC;
+ break;
+ case 4:
+ genCases_f16_a = currentA;
+ genCases_f16_b = f16Random();
+ genCases_f16_c = f16Random();
+ break;
+ case 5:
+ genCases_f16_a = f16Random();
+ genCases_f16_b = currentB;
+ genCases_f16_c = f16Random();
+ break;
+ case 6:
+ genCases_f16_a = currentA;
+ genCases_f16_b = f16Random();
+ genCases_f16_c = currentC;
+ break;
+ case 7:
+ genCases_f16_a = f16Random();
+ genCases_f16_b = f16Random();
+ genCases_f16_c = f16Random();
+ break;
+ case 8:
+ genCases_f16_a = currentA;
+ genCases_f16_b = currentB;
+ genCases_f16_c = currentC;
+ genCases_done = sequenceA.done & sequenceB.done & sequenceC.done;
+ subcase = -1;
+ break;
+ }
+ } else {
+ switch ( subcase ) {
+ case 0:
+ genCases_f16_a = f16Random();
+ genCases_f16_b = f16Random();
+ genCases_f16_c = f16Random();
+ break;
+ case 1:
+ if ( sequenceC.done ) {
+ sequenceC.done = false;
+ if ( sequenceB.done ) {
+ sequenceB.done = false;
+ currentA = f16NextQInP2( &sequenceA );
+ }
+ currentB = f16NextQInP2( &sequenceB );
+ }
+ genCases_f16_a = currentA;
+ genCases_f16_b = currentB;
+ genCases_f16_c = f16NextQInP2( &sequenceC );
+ genCases_done = sequenceA.done & sequenceB.done & sequenceC.done;
+ subcase = -1;
+ break;
+ }
+ }
+ ++subcase;
+
+}
+
+#endif
+
diff --git a/source/genCases_f32.c b/source/genCases_f32.c
index aef84ba..7e81530 100644
--- a/source/genCases_f32.c
+++ b/source/genCases_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/genCases_f64.c b/source/genCases_f64.c
index d9cbf0a..1ef34be 100644
--- a/source/genCases_f64.c
+++ b/source/genCases_f64.c
@@ -1,12 +1,12 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -770,7 +770,7 @@ void genCases_f64_abc_next( void )
genCases_f64_a = currentA;
genCases_f64_b = currentB;
genCases_f64_c = currentC;
- genCases_done = sequenceA.done & sequenceB.done & sequenceC.done;;
+ genCases_done = sequenceA.done & sequenceB.done & sequenceC.done;
subcase = -1;
break;
}
@@ -793,7 +793,7 @@ void genCases_f64_abc_next( void )
genCases_f64_a = currentA;
genCases_f64_b = currentB;
genCases_f64_c = f64NextQInP2( &sequenceC );
- genCases_done = sequenceA.done & sequenceB.done & sequenceC.done;;
+ genCases_done = sequenceA.done & sequenceB.done & sequenceC.done;
subcase = -1;
break;
}
diff --git a/source/genCases_i32.c b/source/genCases_i32.c
index f900563..ff6ac15 100644
--- a/source/genCases_i32.c
+++ b/source/genCases_i32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/genCases_i64.c b/source/genCases_i64.c
index a25d495..a7daf0c 100644
--- a/source/genCases_i64.c
+++ b/source/genCases_i64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/genCases_ui32.c b/source/genCases_ui32.c
index 6eae344..08c978f 100644
--- a/source/genCases_ui32.c
+++ b/source/genCases_ui32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/genCases_ui64.c b/source/genCases_ui64.c
index 28d08ac..9e28757 100644
--- a/source/genCases_ui64.c
+++ b/source/genCases_ui64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/genCases_writeTestsTotal.c b/source/genCases_writeTestsTotal.c
index 1902331..833cda4 100644
--- a/source/genCases_writeTestsTotal.c
+++ b/source/genCases_writeTestsTotal.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/genLoops.c b/source/genLoops.c
index 620d306..f8a843a 100644
--- a/source/genLoops.c
+++ b/source/genLoops.c
@@ -1,12 +1,12 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -53,6 +53,9 @@ bool genLoops_givenCount;
uint_fast64_t genLoops_count;
uint_fast8_t *genLoops_trueFlagsPtr;
+#ifdef FLOAT16
+union ui16_f16 { uint16_t ui; float16_t f; };
+#endif
union ui32_f32 { uint32_t ui; float32_t f; };
union ui64_f64 { uint64_t ui; float64_t f; };
@@ -102,6 +105,23 @@ static bool writeGenOutputs_bool( bool z, uint_fast8_t flags )
}
+#ifdef FLOAT16
+
+static bool writeGenOutputs_ui16( uint_fast16_t z, uint_fast8_t flags )
+{
+
+ writeHex_ui16( z, ' ' );
+ writeGenOutput_flags( flags );
+ if ( genLoops_givenCount ) {
+ --genLoops_count;
+ if ( ! genLoops_count ) return true;
+ }
+ return false;
+
+}
+
+#endif
+
static bool writeGenOutputs_ui32( uint_fast32_t z, uint_fast8_t flags )
{
@@ -141,7 +161,7 @@ static void writeHex_uiExtF80M( const extFloat80_t *aPtr, char sepChar )
}
static
- bool writeGenOutputs_extF80M( const extFloat80_t *aPtr, uint_fast8_t flags )
+bool writeGenOutputs_extF80M( const extFloat80_t *aPtr, uint_fast8_t flags )
{
writeHex_uiExtF80M( aPtr, ' ' );
@@ -247,6 +267,70 @@ void gen_a_i64( void )
}
+#ifdef FLOAT16
+
+void gen_a_f16( void )
+{
+ union ui16_f16 uA;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ uA.f = genCases_f16_a;
+ writeHex_ui16( uA.ui, '\n' );
+ if ( genLoops_givenCount ) {
+ --genLoops_count;
+ if ( ! genLoops_count ) break;
+ }
+ }
+
+}
+
+void gen_ab_f16( void )
+{
+ union ui16_f16 u;
+
+ genCases_f16_ab_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_ab_next();
+ u.f = genCases_f16_a;
+ writeHex_ui16( u.ui, ' ' );
+ u.f = genCases_f16_b;
+ writeHex_ui16( u.ui, '\n' );
+ if ( genLoops_givenCount ) {
+ --genLoops_count;
+ if ( ! genLoops_count ) break;
+ }
+ }
+
+}
+
+void gen_abc_f16( void )
+{
+ union ui16_f16 u;
+
+ genCases_f16_abc_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_abc_next();
+ u.f = genCases_f16_a;
+ writeHex_ui16( u.ui, ' ' );
+ u.f = genCases_f16_b;
+ writeHex_ui16( u.ui, ' ' );
+ u.f = genCases_f16_c;
+ writeHex_ui16( u.ui, '\n' );
+ if ( genLoops_givenCount ) {
+ --genLoops_count;
+ if ( ! genLoops_count ) break;
+ }
+ }
+
+}
+
+#endif
+
void gen_a_f32( void )
{
union ui32_f32 uA;
@@ -477,6 +561,28 @@ void gen_abc_f128( void )
#endif
+#ifdef FLOAT16
+
+void gen_a_ui32_z_f16( float16_t trueFunction( uint32_t ) )
+{
+ union ui16_f16 uTrueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_ui32_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_ui32_a_next();
+ writeHex_ui32( genCases_ui32_a, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ uTrueZ.f = trueFunction( genCases_ui32_a );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break;
+ }
+
+}
+
+#endif
+
void gen_a_ui32_z_f32( float32_t trueFunction( uint32_t ) )
{
union ui32_f32 uTrueZ;
@@ -557,6 +663,28 @@ void gen_a_ui32_z_f128( void trueFunction( uint32_t, float128_t * ) )
#endif
+#ifdef FLOAT16
+
+void gen_a_ui64_z_f16( float16_t trueFunction( uint64_t ) )
+{
+ union ui16_f16 uTrueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_ui64_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_ui64_a_next();
+ writeHex_ui64( genCases_ui64_a, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ uTrueZ.f = trueFunction( genCases_ui64_a );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break;
+ }
+
+}
+
+#endif
+
void gen_a_ui64_z_f32( float32_t trueFunction( uint64_t ) )
{
union ui32_f32 uTrueZ;
@@ -637,6 +765,28 @@ void gen_a_ui64_z_f128( void trueFunction( uint64_t, float128_t * ) )
#endif
+#ifdef FLOAT16
+
+void gen_a_i32_z_f16( float16_t trueFunction( int32_t ) )
+{
+ union ui16_f16 uTrueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_i32_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_i32_a_next();
+ writeHex_ui32( genCases_i32_a, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ uTrueZ.f = trueFunction( genCases_i32_a );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break;
+ }
+
+}
+
+#endif
+
void gen_a_i32_z_f32( float32_t trueFunction( int32_t ) )
{
union ui32_f32 uTrueZ;
@@ -717,6 +867,28 @@ void gen_a_i32_z_f128( void trueFunction( int32_t, float128_t * ) )
#endif
+#ifdef FLOAT16
+
+void gen_a_i64_z_f16( float16_t trueFunction( int64_t ) )
+{
+ union ui16_f16 uTrueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_i64_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_i64_a_next();
+ writeHex_ui64( genCases_i64_a, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ uTrueZ.f = trueFunction( genCases_i64_a );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break;
+ }
+
+}
+
+#endif
+
void gen_a_i64_z_f32( float32_t trueFunction( int64_t ) )
{
union ui32_f32 uTrueZ;
@@ -797,6 +969,393 @@ void gen_a_i64_z_f128( void trueFunction( int64_t, float128_t * ) )
#endif
+#ifdef FLOAT16
+
+void
+ gen_a_f16_z_ui32_rx(
+ uint_fast32_t trueFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ union ui16_f16 uA;
+ uint_fast32_t trueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ uA.f = genCases_f16_a;
+ writeHex_ui16( uA.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, roundingMode, exact );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break;
+ }
+
+}
+
+void
+ gen_a_f16_z_ui64_rx(
+ uint_fast64_t trueFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ union ui16_f16 uA;
+ uint_fast64_t trueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ uA.f = genCases_f16_a;
+ writeHex_ui16( uA.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, roundingMode, exact );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break;
+ }
+
+}
+
+void
+ gen_a_f16_z_i32_rx(
+ int_fast32_t trueFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ union ui16_f16 uA;
+ int_fast32_t trueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ uA.f = genCases_f16_a;
+ writeHex_ui16( uA.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, roundingMode, exact );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break;
+ }
+
+}
+
+void
+ gen_a_f16_z_i64_rx(
+ int_fast64_t trueFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ union ui16_f16 uA;
+ int_fast64_t trueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ uA.f = genCases_f16_a;
+ writeHex_ui16( uA.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, roundingMode, exact );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break;
+ }
+
+}
+
+void
+ gen_a_f16_z_ui32_x(
+ uint_fast32_t trueFunction( float16_t, bool ), bool exact )
+{
+ union ui16_f16 uA;
+ uint_fast32_t trueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ uA.f = genCases_f16_a;
+ writeHex_ui16( uA.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, exact );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break;
+ }
+
+}
+
+void
+ gen_a_f16_z_ui64_x(
+ uint_fast64_t trueFunction( float16_t, bool ), bool exact )
+{
+ union ui16_f16 uA;
+ uint_fast64_t trueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ uA.f = genCases_f16_a;
+ writeHex_ui16( uA.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, exact );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break;
+ }
+
+}
+
+void
+ gen_a_f16_z_i32_x( int_fast32_t trueFunction( float16_t, bool ), bool exact )
+{
+ union ui16_f16 uA;
+ int_fast32_t trueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ uA.f = genCases_f16_a;
+ writeHex_ui16( uA.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, exact );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break;
+ }
+
+}
+
+void
+ gen_a_f16_z_i64_x( int_fast64_t trueFunction( float16_t, bool ), bool exact )
+{
+ union ui16_f16 uA;
+ int_fast64_t trueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ uA.f = genCases_f16_a;
+ writeHex_ui16( uA.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, exact );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break;
+ }
+
+}
+
+void gen_a_f16_z_f32( float32_t trueFunction( float16_t ) )
+{
+ union ui16_f16 uA;
+ union ui32_f32 uTrueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ uA.f = genCases_f16_a;
+ writeHex_ui16( uA.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ uTrueZ.f = trueFunction( genCases_f16_a );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui32( uTrueZ.ui, trueFlags ) ) break;
+ }
+
+}
+
+void gen_a_f16_z_f64( float64_t trueFunction( float16_t ) )
+{
+ union ui16_f16 uA;
+ union ui64_f64 uTrueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ uA.f = genCases_f16_a;
+ writeHex_ui16( uA.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ uTrueZ.f = trueFunction( genCases_f16_a );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui64( uTrueZ.ui, trueFlags ) ) break;
+ }
+
+}
+
+#ifdef EXTFLOAT80
+
+void gen_a_f16_z_extF80( void trueFunction( float16_t, extFloat80_t * ) )
+{
+ union ui16_f16 uA;
+ extFloat80_t trueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ uA.f = genCases_f16_a;
+ writeHex_ui16( uA.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ trueFunction( genCases_f16_a, &trueZ );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_extF80M( &trueZ, trueFlags ) ) break;
+ }
+
+}
+
+#endif
+
+#ifdef FLOAT128
+
+void gen_a_f16_z_f128( void trueFunction( float16_t, float128_t * ) )
+{
+ union ui16_f16 uA;
+ float128_t trueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ uA.f = genCases_f16_a;
+ writeHex_ui16( uA.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ trueFunction( genCases_f16_a, &trueZ );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_f128M( &trueZ, trueFlags ) ) break;
+ }
+
+}
+
+#endif
+
+void gen_az_f16( float16_t trueFunction( float16_t ) )
+{
+ union ui16_f16 u;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ u.f = genCases_f16_a;
+ writeHex_ui16( u.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ u.f = trueFunction( genCases_f16_a );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui16( u.ui, trueFlags ) ) break;
+ }
+
+}
+
+void
+ gen_az_f16_rx(
+ float16_t trueFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ union ui16_f16 u;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_a_next();
+ u.f = genCases_f16_a;
+ writeHex_ui16( u.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ u.f = trueFunction( genCases_f16_a, roundingMode, exact );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui16( u.ui, trueFlags ) ) break;
+ }
+
+}
+
+void gen_abz_f16( float16_t trueFunction( float16_t, float16_t ) )
+{
+ union ui16_f16 u;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_ab_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_ab_next();
+ u.f = genCases_f16_a;
+ writeHex_ui16( u.ui, ' ' );
+ u.f = genCases_f16_b;
+ writeHex_ui16( u.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ u.f = trueFunction( genCases_f16_a, genCases_f16_b );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui16( u.ui, trueFlags ) ) break;
+ }
+
+}
+
+void gen_abcz_f16( float16_t trueFunction( float16_t, float16_t, float16_t ) )
+{
+ union ui16_f16 u;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_abc_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_abc_next();
+ u.f = genCases_f16_a;
+ writeHex_ui16( u.ui, ' ' );
+ u.f = genCases_f16_b;
+ writeHex_ui16( u.ui, ' ' );
+ u.f = genCases_f16_c;
+ writeHex_ui16( u.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ u.f = trueFunction( genCases_f16_a, genCases_f16_b, genCases_f16_c );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui16( u.ui, trueFlags ) ) break;
+ }
+
+}
+
+void gen_ab_f16_z_bool( bool trueFunction( float16_t, float16_t ) )
+{
+ union ui16_f16 u;
+ bool trueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f16_ab_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f16_ab_next();
+ u.f = genCases_f16_a;
+ writeHex_ui16( u.ui, ' ' );
+ u.f = genCases_f16_b;
+ writeHex_ui16( u.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, genCases_f16_b );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_bool( trueZ, trueFlags ) ) break;
+ }
+
+}
+
+#endif
+
void
gen_a_f32_z_ui32_rx(
uint_fast32_t trueFunction( float32_t, uint_fast8_t, bool ),
@@ -983,6 +1542,30 @@ void
}
+#ifdef FLOAT16
+
+void gen_a_f32_z_f16( float16_t trueFunction( float32_t ) )
+{
+ union ui32_f32 uA;
+ union ui16_f16 uTrueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f32_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f32_a_next();
+ uA.f = genCases_f32_a;
+ writeHex_ui32( uA.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ uTrueZ.f = trueFunction( genCases_f32_a );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break;
+ }
+
+}
+
+#endif
+
void gen_a_f32_z_f64( float64_t trueFunction( float32_t ) )
{
union ui32_f32 uA;
@@ -1346,6 +1929,30 @@ void
}
+#ifdef FLOAT16
+
+void gen_a_f64_z_f16( float16_t trueFunction( float64_t ) )
+{
+ union ui64_f64 uA;
+ union ui16_f16 uTrueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f64_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f64_a_next();
+ uA.f = genCases_f64_a;
+ writeHex_ui64( uA.ui, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ uTrueZ.f = trueFunction( genCases_f64_a );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break;
+ }
+
+}
+
+#endif
+
void gen_a_f64_z_f32( float32_t trueFunction( float64_t ) )
{
union ui64_f64 uA;
@@ -1697,6 +2304,28 @@ void
}
+#ifdef FLOAT16
+
+void gen_a_extF80_z_f16( float16_t trueFunction( const extFloat80_t * ) )
+{
+ union ui16_f16 uTrueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_extF80_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_extF80_a_next();
+ writeHex_uiExtF80M( &genCases_extF80_a, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ uTrueZ.f = trueFunction( &genCases_extF80_a );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break;
+ }
+
+}
+
+#endif
+
void gen_a_extF80_z_f32( float32_t trueFunction( const extFloat80_t * ) )
{
union ui32_f32 uTrueZ;
@@ -2050,6 +2679,28 @@ void
}
+#ifdef FLOAT16
+
+void gen_a_f128_z_f16( float16_t trueFunction( const float128_t * ) )
+{
+ union ui16_f16 uTrueZ;
+ uint_fast8_t trueFlags;
+
+ genCases_f128_a_init();
+ checkEnoughCases();
+ while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) {
+ genCases_f128_a_next();
+ writeHex_uiF128M( &genCases_f128_a, ' ' );
+ *genLoops_trueFlagsPtr = 0;
+ uTrueZ.f = trueFunction( &genCases_f128_a );
+ trueFlags = *genLoops_trueFlagsPtr;
+ if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break;
+ }
+
+}
+
+#endif
+
void gen_a_f128_z_f32( float32_t trueFunction( const float128_t * ) )
{
union ui32_f32 uTrueZ;
diff --git a/source/genLoops.h b/source/genLoops.h
index 30363af..2125a96 100644
--- a/source/genLoops.h
+++ b/source/genLoops.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -50,6 +50,11 @@ void gen_a_ui32( void );
void gen_a_ui64( void );
void gen_a_i32( void );
void gen_a_i64( void );
+#ifdef FLOAT16
+void gen_a_f16( void );
+void gen_ab_f16( void );
+void gen_abc_f16( void );
+#endif
void gen_a_f32( void );
void gen_ab_f32( void );
void gen_abc_f32( void );
@@ -67,6 +72,9 @@ void gen_ab_f128( void );
void gen_abc_f128( void );
#endif
+#ifdef FLOAT16
+void gen_a_ui32_z_f16( float16_t ( uint32_t ) );
+#endif
void gen_a_ui32_z_f32( float32_t ( uint32_t ) );
void gen_a_ui32_z_f64( float64_t ( uint32_t ) );
#ifdef EXTFLOAT80
@@ -75,6 +83,9 @@ void gen_a_ui32_z_extF80( void ( uint32_t, extFloat80_t * ) );
#ifdef FLOAT128
void gen_a_ui32_z_f128( void ( uint32_t, float128_t * ) );
#endif
+#ifdef FLOAT16
+void gen_a_ui64_z_f16( float16_t ( uint64_t ) );
+#endif
void gen_a_ui64_z_f32( float32_t ( uint64_t ) );
void gen_a_ui64_z_f64( float64_t ( uint64_t ) );
#ifdef EXTFLOAT80
@@ -83,6 +94,9 @@ void gen_a_ui64_z_extF80( void ( uint64_t, extFloat80_t * ) );
#ifdef FLOAT128
void gen_a_ui64_z_f128( void ( uint64_t, float128_t * ) );
#endif
+#ifdef FLOAT16
+void gen_a_i32_z_f16( float16_t ( int32_t ) );
+#endif
void gen_a_i32_z_f32( float32_t ( int32_t ) );
void gen_a_i32_z_f64( float64_t ( int32_t ) );
#ifdef EXTFLOAT80
@@ -91,6 +105,9 @@ void gen_a_i32_z_extF80( void ( int32_t, extFloat80_t * ) );
#ifdef FLOAT128
void gen_a_i32_z_f128( void ( int32_t, float128_t * ) );
#endif
+#ifdef FLOAT16
+void gen_a_i64_z_f16( float16_t ( int64_t ) );
+#endif
void gen_a_i64_z_f32( float32_t ( int64_t ) );
void gen_a_i64_z_f64( float64_t ( int64_t ) );
#ifdef EXTFLOAT80
@@ -100,6 +117,40 @@ void gen_a_i64_z_extF80( void ( int64_t, extFloat80_t * ) );
void gen_a_i64_z_f128( void ( int64_t, float128_t * ) );
#endif
+#ifdef FLOAT16
+void
+ gen_a_f16_z_ui32_rx(
+ uint_fast32_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool );
+void
+ gen_a_f16_z_ui64_rx(
+ uint_fast64_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool );
+void
+ gen_a_f16_z_i32_rx(
+ int_fast32_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool );
+void
+ gen_a_f16_z_i64_rx(
+ int_fast64_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool );
+void gen_a_f16_z_ui32_x( uint_fast32_t ( float16_t, bool ), bool );
+void gen_a_f16_z_ui64_x( uint_fast64_t ( float16_t, bool ), bool );
+void gen_a_f16_z_i32_x( int_fast32_t ( float16_t, bool ), bool );
+void gen_a_f16_z_i64_x( int_fast64_t ( float16_t, bool ), bool );
+void gen_a_f16_z_f32( float32_t ( float16_t ) );
+void gen_a_f16_z_f64( float64_t ( float16_t ) );
+#ifdef EXTFLOAT80
+void gen_a_f16_z_extF80( void ( float16_t, extFloat80_t * ) );
+#endif
+#ifdef FLOAT128
+void gen_a_f16_z_f128( void ( float16_t, float128_t * ) );
+#endif
+void gen_az_f16( float16_t ( float16_t ) );
+void
+ gen_az_f16_rx(
+ float16_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool );
+void gen_abz_f16( float16_t ( float16_t, float16_t ) );
+void gen_abcz_f16( float16_t ( float16_t, float16_t, float16_t ) );
+void gen_ab_f16_z_bool( bool ( float16_t, float16_t ) );
+#endif
+
void
gen_a_f32_z_ui32_rx(
uint_fast32_t ( float32_t, uint_fast8_t, bool ), uint_fast8_t, bool );
@@ -116,6 +167,9 @@ void gen_a_f32_z_ui32_x( uint_fast32_t ( float32_t, bool ), bool );
void gen_a_f32_z_ui64_x( uint_fast64_t ( float32_t, bool ), bool );
void gen_a_f32_z_i32_x( int_fast32_t ( float32_t, bool ), bool );
void gen_a_f32_z_i64_x( int_fast64_t ( float32_t, bool ), bool );
+#ifdef FLOAT16
+void gen_a_f32_z_f16( float16_t ( float32_t ) );
+#endif
void gen_a_f32_z_f64( float64_t ( float32_t ) );
#ifdef EXTFLOAT80
void gen_a_f32_z_extF80( void ( float32_t, extFloat80_t * ) );
@@ -147,6 +201,9 @@ void gen_a_f64_z_ui32_x( uint_fast32_t ( float64_t, bool ), bool );
void gen_a_f64_z_ui64_x( uint_fast64_t ( float64_t, bool ), bool );
void gen_a_f64_z_i32_x( int_fast32_t ( float64_t, bool ), bool );
void gen_a_f64_z_i64_x( int_fast64_t ( float64_t, bool ), bool );
+#ifdef FLOAT16
+void gen_a_f64_z_f16( float16_t ( float64_t ) );
+#endif
void gen_a_f64_z_f32( float32_t ( float64_t ) );
#ifdef EXTFLOAT80
void gen_a_f64_z_extF80( void ( float64_t, extFloat80_t * ) );
@@ -193,6 +250,9 @@ void
gen_a_extF80_z_ui64_x( uint_fast64_t ( const extFloat80_t *, bool ), bool );
void gen_a_extF80_z_i32_x( int_fast32_t ( const extFloat80_t *, bool ), bool );
void gen_a_extF80_z_i64_x( int_fast64_t ( const extFloat80_t *, bool ), bool );
+#ifdef FLOAT16
+void gen_a_extF80_z_f16( float16_t ( const extFloat80_t * ) );
+#endif
void gen_a_extF80_z_f32( float32_t ( const extFloat80_t * ) );
void gen_a_extF80_z_f64( float64_t ( const extFloat80_t * ) );
#ifdef FLOAT128
@@ -251,6 +311,9 @@ void gen_a_f128_z_ui32_x( uint_fast32_t ( const float128_t *, bool ), bool );
void gen_a_f128_z_ui64_x( uint_fast64_t ( const float128_t *, bool ), bool );
void gen_a_f128_z_i32_x( int_fast32_t ( const float128_t *, bool ), bool );
void gen_a_f128_z_i64_x( int_fast64_t ( const float128_t *, bool ), bool );
+#ifdef FLOAT16
+void gen_a_f128_z_f16( float16_t ( const float128_t * ) );
+#endif
void gen_a_f128_z_f32( float32_t ( const float128_t * ) );
void gen_a_f128_z_f64( float64_t ( const float128_t * ) );
#ifdef EXTFLOAT80
diff --git a/source/random.c b/source/random.c
index 6f61d42..9e81ae7 100644
--- a/source/random.c
+++ b/source/random.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/random.h b/source/random.h
index 7a0757c..4dfa33f 100644
--- a/source/random.h
+++ b/source/random.h
@@ -1,7 +1,7 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/readHex.c b/source/readHex.c
index 6384ae8..0acb363 100644
--- a/source/readHex.c
+++ b/source/readHex.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/readHex.h b/source/readHex.h
index 944894f..4632d14 100644
--- a/source/readHex.h
+++ b/source/readHex.h
@@ -1,7 +1,7 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/slowfloat.c b/source/slowfloat.c
index d79cf06..8ecf41f 100644
--- a/source/slowfloat.c
+++ b/source/slowfloat.c
@@ -1,9 +1,9 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a+, a package of programs
-for testing the correctness of floating-point arithmetic complying with the
-IEEE Standard for Floating-Point, by John R. Hauser.
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
California. All rights reserved.
@@ -49,6 +49,9 @@ uint_fast8_t slowfloat_exceptionFlags;
uint_fast8_t slow_extF80_roundingPrecision;
#endif
+#ifdef FLOAT16
+union ui16_f16 { uint16_t ui; float16_t f; };
+#endif
union ui32_f32 { uint32_t ui; float32_t f; };
union ui64_f64 { uint64_t ui; float64_t f; };
@@ -72,17 +75,64 @@ static const struct floatX floatXNegativeZero =
{ false, false, true, true, 0, { 0, 0 } };
static
- void
- roundFloatXTo24(
- bool isTiny, struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
+void
+ roundFloatXTo11(
+ bool isTiny, struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
+{
+ uint_fast64_t roundBits, sigX64;
+
+ sigX64 = xPtr->sig.v64;
+ roundBits = (sigX64 & UINT64_C( 0x1FFFFFFFFFFF )) | (xPtr->sig.v0 != 0);
+ if ( roundBits ) {
+ sigX64 &= UINT64_C( 0xFFFFE00000000000 );
+ if ( exact ) slowfloat_exceptionFlags |= softfloat_flag_inexact;
+ if ( isTiny ) slowfloat_exceptionFlags |= softfloat_flag_underflow;
+ switch ( roundingMode ) {
+ case softfloat_round_near_even:
+ if ( roundBits < UINT64_C( 0x100000000000 ) ) goto noIncrement;
+ if (
+ (roundBits == UINT64_C( 0x100000000000 ))
+ && ! (sigX64 & UINT64_C( 0x200000000000 ))
+ ) {
+ goto noIncrement;
+ }
+ break;
+ case softfloat_round_minMag:
+ goto noIncrement;
+ case softfloat_round_min:
+ if ( ! xPtr->sign ) goto noIncrement;
+ break;
+ case softfloat_round_max:
+ if ( xPtr->sign ) goto noIncrement;
+ break;
+ case softfloat_round_near_maxMag:
+ if ( roundBits < UINT64_C( 0x100000000000 ) ) goto noIncrement;
+ break;
+ }
+ sigX64 += UINT64_C( 0x200000000000 );
+ if ( sigX64 == UINT64_C( 0x0100000000000000 ) ) {
+ ++xPtr->exp;
+ sigX64 = UINT64_C( 0x0080000000000000 );
+ }
+ noIncrement:
+ xPtr->sig.v64 = sigX64;
+ xPtr->sig.v0 = 0;
+ }
+
+}
+
+static
+void
+ roundFloatXTo24(
+ bool isTiny, struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
{
uint_fast64_t sigX64;
uint_fast32_t roundBits;
- sigX64 = xPtr->sig.v64 | (xPtr->sig.v0 != 0);
- roundBits = (uint32_t) sigX64;
- sigX64 -= roundBits;
+ sigX64 = xPtr->sig.v64;
+ roundBits = (uint32_t) sigX64 | (xPtr->sig.v0 != 0);
if ( roundBits ) {
+ sigX64 &= UINT64_C( 0xFFFFFFFF00000000 );
if ( exact ) slowfloat_exceptionFlags |= softfloat_flag_inexact;
if ( isTiny ) slowfloat_exceptionFlags |= softfloat_flag_underflow;
switch ( roundingMode ) {
@@ -112,25 +162,25 @@ static
++xPtr->exp;
sigX64 = UINT64_C( 0x0080000000000000 );
}
+ noIncrement:
+ xPtr->sig.v64 = sigX64;
+ xPtr->sig.v0 = 0;
}
- noIncrement:
- xPtr->sig.v64 = sigX64;
- xPtr->sig.v0 = 0;
}
static
- void
- roundFloatXTo53(
- bool isTiny, struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
+void
+ roundFloatXTo53(
+ bool isTiny, struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
{
uint_fast64_t sigX64;
uint_fast8_t roundBits;
- sigX64 = xPtr->sig.v64 | (xPtr->sig.v0 != 0);
- roundBits = sigX64 & 7;
- sigX64 -= roundBits;
+ sigX64 = xPtr->sig.v64;
+ roundBits = (sigX64 & 7) | (xPtr->sig.v0 != 0);
if ( roundBits ) {
+ sigX64 &= UINT64_C( 0xFFFFFFFFFFFFFFF8 );
if ( exact ) slowfloat_exceptionFlags |= softfloat_flag_inexact;
if ( isTiny ) slowfloat_exceptionFlags |= softfloat_flag_underflow;
switch ( roundingMode ) {
@@ -155,26 +205,24 @@ static
++xPtr->exp;
sigX64 = UINT64_C( 0x0080000000000000 );
}
+ noIncrement:
+ xPtr->sig.v64 = sigX64;
+ xPtr->sig.v0 = 0;
}
- noIncrement:
- xPtr->sig.v64 = sigX64;
- xPtr->sig.v0 = 0;
}
static
- void
- roundFloatXTo64(
- bool isTiny, struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
+void
+ roundFloatXTo64(
+ bool isTiny, struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
{
- uint_fast64_t sigX0;
- int_fast64_t roundBits;
- uint_fast64_t sigX64;
+ uint_fast64_t sigX0, roundBits, sigX64;
sigX0 = xPtr->sig.v0;
roundBits = sigX0 & UINT64_C( 0x00FFFFFFFFFFFFFF );
- sigX0 -= roundBits;
if ( roundBits ) {
+ sigX0 &= UINT64_C( 0xFF00000000000000 );
if ( exact ) slowfloat_exceptionFlags |= softfloat_flag_inexact;
if ( isTiny ) slowfloat_exceptionFlags |= softfloat_flag_underflow;
switch ( roundingMode ) {
@@ -206,25 +254,25 @@ static
sigX64 = UINT64_C( 0x0080000000000000 );
}
xPtr->sig.v64 = sigX64;
+ noIncrement:
+ xPtr->sig.v0 = sigX0;
}
- noIncrement:
- xPtr->sig.v0 = sigX0;
}
static
- void
- roundFloatXTo113(
- bool isTiny, struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
+void
+ roundFloatXTo113(
+ bool isTiny, struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
{
uint_fast64_t sigX0;
- int_fast64_t roundBits;
+ uint_fast8_t roundBits;
uint_fast64_t sigX64;
sigX0 = xPtr->sig.v0;
roundBits = sigX0 & 0x7F;
- sigX0 -= roundBits;
if ( roundBits ) {
+ sigX0 &= UINT64_C( 0xFFFFFFFFFFFFFF80 );
if ( exact ) slowfloat_exceptionFlags |= softfloat_flag_inexact;
if ( isTiny ) slowfloat_exceptionFlags |= softfloat_flag_underflow;
switch ( roundingMode ) {
@@ -251,9 +299,9 @@ static
sigX64 = UINT64_C( 0x0080000000000000 );
}
xPtr->sig.v64 = sigX64;
+ noIncrement:
+ xPtr->sig.v0 = sigX0;
}
- noIncrement:
- xPtr->sig.v0 = sigX0;
}
@@ -284,9 +332,9 @@ static void ui32ToFloatX( uint_fast32_t a, struct floatX *xPtr )
}
static
- uint_fast32_t
- floatXToUI32(
- const struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
+uint_fast32_t
+ floatXToUI32(
+ const struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
{
uint_fast8_t savedExceptionFlags;
struct floatX x;
@@ -295,7 +343,7 @@ static
if ( xPtr->isInf || xPtr->isNaN ) {
slowfloat_exceptionFlags |= softfloat_flag_invalid;
- return (xPtr->isInf & xPtr->sign) ? 0 : 0xFFFFFFFF;
+ return (xPtr->isInf && xPtr->sign) ? 0 : 0xFFFFFFFF;
}
if ( xPtr->isZero ) return 0;
savedExceptionFlags = slowfloat_exceptionFlags;
@@ -349,9 +397,9 @@ static void ui64ToFloatX( uint_fast64_t a, struct floatX *xPtr )
}
static
- uint_fast64_t
- floatXToUI64(
- const struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
+uint_fast64_t
+ floatXToUI64(
+ const struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
{
uint_fast8_t savedExceptionFlags;
struct floatX x;
@@ -360,7 +408,8 @@ static
if ( xPtr->isInf || xPtr->isNaN ) {
slowfloat_exceptionFlags |= softfloat_flag_invalid;
- return (xPtr->isInf & xPtr->sign) ? 0 : UINT64_C( 0xFFFFFFFFFFFFFFFF );
+ return
+ (xPtr->isInf && xPtr->sign) ? 0 : UINT64_C( 0xFFFFFFFFFFFFFFFF );
}
if ( xPtr->isZero ) return 0;
savedExceptionFlags = slowfloat_exceptionFlags;
@@ -416,9 +465,9 @@ static void i32ToFloatX( int_fast32_t a, struct floatX *xPtr )
}
static
- int_fast32_t
- floatXToI32(
- const struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
+int_fast32_t
+ floatXToI32(
+ const struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
{
uint_fast8_t savedExceptionFlags;
struct floatX x;
@@ -427,7 +476,7 @@ static
if ( xPtr->isInf || xPtr->isNaN ) {
slowfloat_exceptionFlags |= softfloat_flag_invalid;
- return (xPtr->isInf & xPtr->sign) ? -0x7FFFFFFF - 1 : 0x7FFFFFFF;
+ return (xPtr->isInf && xPtr->sign) ? -0x7FFFFFFF - 1 : 0x7FFFFFFF;
}
if ( xPtr->isZero ) return 0;
savedExceptionFlags = slowfloat_exceptionFlags;
@@ -487,9 +536,9 @@ static void i64ToFloatX( int_fast64_t a, struct floatX *xPtr )
}
static
- int_fast64_t
- floatXToI64(
- const struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
+int_fast64_t
+ floatXToI64(
+ const struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
{
uint_fast8_t savedExceptionFlags;
struct floatX x;
@@ -499,7 +548,7 @@ static
if ( xPtr->isInf || xPtr->isNaN ) {
slowfloat_exceptionFlags |= softfloat_flag_invalid;
return
- (xPtr->isInf & xPtr->sign) ? -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1
+ (xPtr->isInf && xPtr->sign) ? -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1
: INT64_C( 0x7FFFFFFFFFFFFFFF );
}
if ( xPtr->isZero ) return 0;
@@ -532,6 +581,142 @@ static
}
+#ifdef FLOAT16
+
+static void f16ToFloatX( float16_t a, struct floatX *xPtr )
+{
+ union ui16_f16 uA;
+ uint_fast16_t uiA;
+ int_fast8_t exp;
+ uint_fast64_t sig64;
+
+ uA.f = a;
+ uiA = uA.ui;
+ xPtr->isNaN = false;
+ xPtr->isInf = false;
+ xPtr->isZero = false;
+ xPtr->sign = ((uiA & 0x8000) != 0);
+ exp = uiA>>10 & 0x1F;
+ sig64 = uiA & 0x03FF;
+ sig64 <<= 45;
+ if ( exp == 0x1F ) {
+ if ( sig64 ) {
+ xPtr->isNaN = true;
+ } else {
+ xPtr->isInf = true;
+ }
+ } else if ( ! exp ) {
+ if ( ! sig64 ) {
+ xPtr->isZero = true;
+ } else {
+ exp = 1 - 0xF;
+ do {
+ --exp;
+ sig64 <<= 1;
+ } while ( sig64 < UINT64_C( 0x0080000000000000 ) );
+ xPtr->exp = exp;
+ }
+ } else {
+ xPtr->exp = exp - 0xF;
+ sig64 |= UINT64_C( 0x0080000000000000 );
+ }
+ xPtr->sig.v64 = sig64;
+ xPtr->sig.v0 = 0;
+
+}
+
+static float16_t floatXToF16( const struct floatX *xPtr )
+{
+ uint_fast16_t uiZ;
+ struct floatX x, savedX;
+ bool isTiny;
+ int_fast32_t exp;
+ union ui16_f16 uZ;
+
+ if ( xPtr->isNaN ) {
+ uiZ = 0xFFFF;
+ goto uiZ;
+ }
+ if ( xPtr->isInf ) {
+ uiZ = xPtr->sign ? 0xFC00 : 0x7C00;
+ goto uiZ;
+ }
+ if ( xPtr->isZero ) {
+ uiZ = xPtr->sign ? 0x8000 : 0;
+ goto uiZ;
+ }
+ x = *xPtr;
+ while ( UINT64_C( 0x0100000000000000 ) <= x.sig.v64 ) {
+ ++x.exp;
+ x.sig = shortShiftRightJam128( x.sig, 1 );
+ }
+ while ( x.sig.v64 < UINT64_C( 0x0080000000000000 ) ) {
+ --x.exp;
+ x.sig = shortShiftLeft128( x.sig, 1 );
+ }
+ savedX = x;
+ isTiny =
+ (slowfloat_detectTininess == softfloat_tininess_beforeRounding)
+ && (x.exp + 0xF <= 0);
+ roundFloatXTo11( isTiny, &x, slowfloat_roundingMode, true );
+ exp = x.exp + 0xF;
+ if ( 0x1F <= exp ) {
+ slowfloat_exceptionFlags |=
+ softfloat_flag_overflow | softfloat_flag_inexact;
+ if ( x.sign ) {
+ switch ( slowfloat_roundingMode ) {
+ case softfloat_round_near_even:
+ case softfloat_round_min:
+ case softfloat_round_near_maxMag:
+ uiZ = 0xFC00;
+ break;
+ case softfloat_round_minMag:
+ case softfloat_round_max:
+ uiZ = 0xFBFF;
+ break;
+ }
+ } else {
+ switch ( slowfloat_roundingMode ) {
+ case softfloat_round_near_even:
+ case softfloat_round_max:
+ case softfloat_round_near_maxMag:
+ uiZ = 0x7C00;
+ break;
+ case softfloat_round_minMag:
+ case softfloat_round_min:
+ uiZ = 0x7BFF;
+ break;
+ }
+ }
+ goto uiZ;
+ }
+ if ( exp <= 0 ) {
+ isTiny = true;
+ x = savedX;
+ exp = x.exp + 0xF;
+ if ( exp < -14 ) {
+ x.sig.v0 = (x.sig.v64 != 0) || (x.sig.v0 != 0);
+ x.sig.v64 = 0;
+ } else {
+ while ( exp <= 0 ) {
+ ++exp;
+ x.sig = shortShiftRightJam128( x.sig, 1 );
+ }
+ }
+ roundFloatXTo11( isTiny, &x, slowfloat_roundingMode, true );
+ exp = (UINT64_C( 0x0080000000000000 ) <= x.sig.v64) ? 1 : 0;
+ }
+ uiZ = (uint_fast16_t) exp<<10;
+ if ( x.sign ) uiZ |= 0x8000;
+ uiZ |= x.sig.v64>>45 & 0x03FF;
+ uiZ:
+ uZ.ui = uiZ;
+ return uZ.f;
+
+}
+
+#endif
+
static void f32ToFloatX( float32_t a, struct floatX *xPtr )
{
union ui32_f32 uA;
@@ -1133,9 +1318,8 @@ static void floatXInvalid( struct floatX *xPtr )
}
static
- void
- floatXRoundToInt(
- struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
+void
+ floatXRoundToInt( struct floatX *xPtr, uint_fast8_t roundingMode, bool exact )
{
int_fast32_t exp, shiftDist;
struct uint128 sig;
@@ -1670,7 +1854,7 @@ static void floatX256Invalid( struct floatX256 *xPtr )
}
static
- void floatX256Add( struct floatX256 *xPtr, const struct floatX256 *yPtr )
+void floatX256Add( struct floatX256 *xPtr, const struct floatX256 *yPtr )
{
int_fast32_t expX, expY, expDiff;
struct uint256 sigY;
@@ -1747,7 +1931,7 @@ static
}
static
- void floatX256Mul( struct floatX256 *xPtr, const struct floatX256 *yPtr )
+void floatX256Mul( struct floatX256 *xPtr, const struct floatX256 *yPtr )
{
struct uint256 sig;
int bitNum;
@@ -1804,6 +1988,19 @@ static
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+#ifdef FLOAT16
+
+float16_t slow_ui32_to_f16( uint32_t a )
+{
+ struct floatX x;
+
+ ui32ToFloatX( a, &x );
+ return floatXToF16( &x );
+
+}
+
+#endif
+
float32_t slow_ui32_to_f32( uint32_t a )
{
struct floatX x;
@@ -1848,6 +2045,19 @@ void slow_ui32_to_f128M( uint32_t a, float128_t *zPtr )
#endif
+#ifdef FLOAT16
+
+float16_t slow_ui64_to_f16( uint64_t a )
+{
+ struct floatX x;
+
+ ui64ToFloatX( a, &x );
+ return floatXToF16( &x );
+
+}
+
+#endif
+
float32_t slow_ui64_to_f32( uint64_t a )
{
struct floatX x;
@@ -1892,6 +2102,19 @@ void slow_ui64_to_f128M( uint64_t a, float128_t *zPtr )
#endif
+#ifdef FLOAT16
+
+float16_t slow_i32_to_f16( int32_t a )
+{
+ struct floatX x;
+
+ i32ToFloatX( a, &x );
+ return floatXToF16( &x );
+
+}
+
+#endif
+
float32_t slow_i32_to_f32( int32_t a )
{
struct floatX x;
@@ -1936,6 +2159,19 @@ void slow_i32_to_f128M( int32_t a, float128_t *zPtr )
#endif
+#ifdef FLOAT16
+
+float16_t slow_i64_to_f16( int64_t a )
+{
+ struct floatX x;
+
+ i64ToFloatX( a, &x );
+ return floatXToF16( &x );
+
+}
+
+#endif
+
float32_t slow_i64_to_f32( int64_t a )
{
struct floatX x;
@@ -1980,6 +2216,290 @@ void slow_i64_to_f128M( int64_t a, float128_t *zPtr )
#endif
+#ifdef FLOAT16
+
+uint_fast32_t
+ slow_f16_to_ui32( float16_t a, uint_fast8_t roundingMode, bool exact )
+{
+ struct floatX x;
+
+ f16ToFloatX( a, &x );
+ return floatXToUI32( &x, roundingMode, exact );
+
+}
+
+uint_fast64_t
+ slow_f16_to_ui64( float16_t a, uint_fast8_t roundingMode, bool exact )
+{
+ struct floatX x;
+
+ f16ToFloatX( a, &x );
+ return floatXToUI64( &x, roundingMode, exact );
+
+}
+
+int_fast32_t
+ slow_f16_to_i32( float16_t a, uint_fast8_t roundingMode, bool exact )
+{
+ struct floatX x;
+
+ f16ToFloatX( a, &x );
+ return floatXToI32( &x, roundingMode, exact );
+
+}
+
+int_fast64_t
+ slow_f16_to_i64( float16_t a, uint_fast8_t roundingMode, bool exact )
+{
+ struct floatX x;
+
+ f16ToFloatX( a, &x );
+ return floatXToI64( &x, roundingMode, exact );
+
+}
+
+uint_fast32_t slow_f16_to_ui32_r_minMag( float16_t a, bool exact )
+{
+ struct floatX x;
+
+ f16ToFloatX( a, &x );
+ return floatXToUI32( &x, softfloat_round_minMag, exact );
+
+}
+
+uint_fast64_t slow_f16_to_ui64_r_minMag( float16_t a, bool exact )
+{
+ struct floatX x;
+
+ f16ToFloatX( a, &x );
+ return floatXToUI64( &x, softfloat_round_minMag, exact );
+
+}
+
+int_fast32_t slow_f16_to_i32_r_minMag( float16_t a, bool exact )
+{
+ struct floatX x;
+
+ f16ToFloatX( a, &x );
+ return floatXToI32( &x, softfloat_round_minMag, exact );
+
+}
+
+int_fast64_t slow_f16_to_i64_r_minMag( float16_t a, bool exact )
+{
+ struct floatX x;
+
+ f16ToFloatX( a, &x );
+ return floatXToI64( &x, softfloat_round_minMag, exact );
+
+}
+
+float32_t slow_f16_to_f32( float16_t a )
+{
+ struct floatX x;
+
+ f16ToFloatX( a, &x );
+ return floatXToF32( &x );
+
+}
+
+float64_t slow_f16_to_f64( float16_t a )
+{
+ struct floatX x;
+
+ f16ToFloatX( a, &x );
+ return floatXToF64( &x );
+
+}
+
+#ifdef EXTFLOAT80
+
+void slow_f16_to_extF80M( float16_t a, extFloat80_t *zPtr )
+{
+ struct floatX x;
+
+ f16ToFloatX( a, &x );
+ floatXToExtF80M( &x, zPtr );
+
+}
+
+#endif
+
+#ifdef FLOAT128
+
+void slow_f16_to_f128M( float16_t a, float128_t *zPtr )
+{
+ struct floatX x;
+
+ f16ToFloatX( a, &x );
+ floatXToF128M( &x, zPtr );
+
+}
+
+#endif
+
+float16_t
+ slow_f16_roundToInt( float16_t a, uint_fast8_t roundingMode, bool exact )
+{
+ struct floatX x;
+
+ f16ToFloatX( a, &x );
+ floatXRoundToInt( &x, roundingMode, exact );
+ return floatXToF16( &x );
+
+}
+
+float16_t slow_f16_add( float16_t a, float16_t b )
+{
+ struct floatX x, y;
+
+ f16ToFloatX( a, &x );
+ f16ToFloatX( b, &y );
+ floatXAdd( &x, &y );
+ return floatXToF16( &x );
+
+}
+
+float16_t slow_f16_sub( float16_t a, float16_t b )
+{
+ struct floatX x, y;
+
+ f16ToFloatX( a, &x );
+ f16ToFloatX( b, &y );
+ y.sign = ! y.sign;
+ floatXAdd( &x, &y );
+ return floatXToF16( &x );
+
+
+}
+
+float16_t slow_f16_mul( float16_t a, float16_t b )
+{
+ struct floatX x, y;
+
+ f16ToFloatX( a, &x );
+ f16ToFloatX( b, &y );
+ floatXMul( &x, &y );
+ return floatXToF16( &x );
+
+}
+
+float16_t slow_f16_mulAdd( float16_t a, float16_t b, float16_t c )
+{
+ struct floatX x, y;
+
+ f16ToFloatX( a, &x );
+ f16ToFloatX( b, &y );
+ floatXMul( &x, &y );
+ f16ToFloatX( c, &y );
+ floatXAdd( &x, &y );
+ return floatXToF16( &x );
+
+}
+
+float16_t slow_f16_div( float16_t a, float16_t b )
+{
+ struct floatX x, y;
+
+ f16ToFloatX( a, &x );
+ f16ToFloatX( b, &y );
+ floatXDiv( &x, &y );
+ return floatXToF16( &x );
+
+}
+
+float16_t slow_f16_rem( float16_t a, float16_t b )
+{
+ struct floatX x, y;
+
+ f16ToFloatX( a, &x );
+ f16ToFloatX( b, &y );
+ floatXRem( &x, &y );
+ return floatXToF16( &x );
+
+}
+
+float16_t slow_f16_sqrt( float16_t a )
+{
+ struct floatX x;
+
+ f16ToFloatX( a, &x );
+ floatXSqrt( &x );
+ return floatXToF16( &x );
+
+}
+
+bool slow_f16_eq( float16_t a, float16_t b )
+{
+ struct floatX x, y;
+
+ f16ToFloatX( a, &x );
+ f16ToFloatX( b, &y );
+ return floatXEq( &x, &y );
+
+}
+
+bool slow_f16_le( float16_t a, float16_t b )
+{
+ struct floatX x, y;
+
+ f16ToFloatX( a, &x );
+ f16ToFloatX( b, &y );
+ if ( x.isNaN || y.isNaN ) {
+ slowfloat_exceptionFlags |= softfloat_flag_invalid;
+ }
+ return floatXLe( &x, &y );
+
+}
+
+bool slow_f16_lt( float16_t a, float16_t b )
+{
+ struct floatX x, y;
+
+ f16ToFloatX( a, &x );
+ f16ToFloatX( b, &y );
+ if ( x.isNaN || y.isNaN ) {
+ slowfloat_exceptionFlags |= softfloat_flag_invalid;
+ }
+ return floatXLt( &x, &y );
+
+}
+
+bool slow_f16_eq_signaling( float16_t a, float16_t b )
+{
+ struct floatX x, y;
+
+ f16ToFloatX( a, &x );
+ f16ToFloatX( b, &y );
+ if ( x.isNaN || y.isNaN ) {
+ slowfloat_exceptionFlags |= softfloat_flag_invalid;
+ }
+ return floatXEq( &x, &y );
+
+}
+
+bool slow_f16_le_quiet( float16_t a, float16_t b )
+{
+ struct floatX x, y;
+
+ f16ToFloatX( a, &x );
+ f16ToFloatX( b, &y );
+ return floatXLe( &x, &y );
+
+}
+
+bool slow_f16_lt_quiet( float16_t a, float16_t b )
+{
+ struct floatX x, y;
+
+ f16ToFloatX( a, &x );
+ f16ToFloatX( b, &y );
+ return floatXLt( &x, &y );
+
+}
+
+#endif
+
uint_fast32_t
slow_f32_to_ui32( float32_t a, uint_fast8_t roundingMode, bool exact )
{
@@ -2056,6 +2576,19 @@ int_fast64_t slow_f32_to_i64_r_minMag( float32_t a, bool exact )
}
+#ifdef FLOAT16
+
+float16_t slow_f32_to_f16( float32_t a )
+{
+ struct floatX x;
+
+ f32ToFloatX( a, &x );
+ return floatXToF16( &x );
+
+}
+
+#endif
+
float64_t slow_f32_to_f64( float32_t a )
{
struct floatX x;
@@ -2327,6 +2860,19 @@ int_fast64_t slow_f64_to_i64_r_minMag( float64_t a, bool exact )
}
+#ifdef FLOAT16
+
+float16_t slow_f64_to_f16( float64_t a )
+{
+ struct floatX x;
+
+ f64ToFloatX( a, &x );
+ return floatXToF16( &x );
+
+}
+
+#endif
+
float32_t slow_f64_to_f32( float64_t a )
{
struct floatX x;
@@ -2607,6 +3153,19 @@ int_fast64_t
}
+#ifdef FLOAT16
+
+float16_t slow_extF80M_to_f16( const extFloat80_t *aPtr )
+{
+ struct floatX x;
+
+ extF80MToFloatX( aPtr, &x );
+ return floatXToF16( &x );
+
+}
+
+#endif
+
float32_t slow_extF80M_to_f32( const extFloat80_t *aPtr )
{
struct floatX x;
@@ -2885,6 +3444,19 @@ int_fast64_t slow_f128M_to_i64_r_minMag( const float128_t *aPtr, bool exact )
}
+#ifdef FLOAT16
+
+float16_t slow_f128M_to_f16( const float128_t *aPtr )
+{
+ struct floatX x;
+
+ f128MToFloatX( aPtr, &x );
+ return floatXToF16( &x );
+
+}
+
+#endif
+
float32_t slow_f128M_to_f32( const float128_t *aPtr )
{
struct floatX x;
diff --git a/source/slowfloat.h b/source/slowfloat.h
index efa13c3..7e9d5f5 100644
--- a/source/slowfloat.h
+++ b/source/slowfloat.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -46,6 +46,9 @@ extern uint_fast8_t slowfloat_exceptionFlags;
extern uint_fast8_t slow_extF80_roundingPrecision;
#endif
+#ifdef FLOAT16
+float16_t slow_ui32_to_f16( uint32_t );
+#endif
float32_t slow_ui32_to_f32( uint32_t );
float64_t slow_ui32_to_f64( uint32_t );
#ifdef EXTFLOAT80
@@ -54,6 +57,9 @@ void slow_ui32_to_extF80M( uint32_t, extFloat80_t * );
#ifdef FLOAT128
void slow_ui32_to_f128M( uint32_t, float128_t * );
#endif
+#ifdef FLOAT16
+float16_t slow_ui64_to_f16( uint64_t );
+#endif
float32_t slow_ui64_to_f32( uint64_t );
float64_t slow_ui64_to_f64( uint64_t );
#ifdef EXTFLOAT80
@@ -62,6 +68,9 @@ void slow_ui64_to_extF80M( uint64_t, extFloat80_t * );
#ifdef FLOAT128
void slow_ui64_to_f128M( uint64_t, float128_t * );
#endif
+#ifdef FLOAT16
+float16_t slow_i32_to_f16( int32_t );
+#endif
float32_t slow_i32_to_f32( int32_t );
float64_t slow_i32_to_f64( int32_t );
#ifdef EXTFLOAT80
@@ -70,6 +79,9 @@ void slow_i32_to_extF80M( int32_t, extFloat80_t * );
#ifdef FLOAT128
void slow_i32_to_f128M( int32_t, float128_t * );
#endif
+#ifdef FLOAT16
+float16_t slow_i64_to_f16( int64_t );
+#endif
float32_t slow_i64_to_f32( int64_t );
float64_t slow_i64_to_f64( int64_t );
#ifdef EXTFLOAT80
@@ -79,6 +91,39 @@ void slow_i64_to_extF80M( int64_t, extFloat80_t * );
void slow_i64_to_f128M( int64_t, float128_t * );
#endif
+#ifdef FLOAT16
+uint_fast32_t slow_f16_to_ui32( float16_t, uint_fast8_t, bool );
+uint_fast64_t slow_f16_to_ui64( float16_t, uint_fast8_t, bool );
+int_fast32_t slow_f16_to_i32( float16_t, uint_fast8_t, bool );
+int_fast64_t slow_f16_to_i64( float16_t, uint_fast8_t, bool );
+uint_fast32_t slow_f16_to_ui32_r_minMag( float16_t, bool );
+uint_fast64_t slow_f16_to_ui64_r_minMag( float16_t, bool );
+int_fast32_t slow_f16_to_i32_r_minMag( float16_t, bool );
+int_fast64_t slow_f16_to_i64_r_minMag( float16_t, bool );
+float32_t slow_f16_to_f32( float16_t );
+float64_t slow_f16_to_f64( float16_t );
+#ifdef EXTFLOAT80
+void slow_f16_to_extF80M( float16_t, extFloat80_t * );
+#endif
+#ifdef FLOAT128
+void slow_f16_to_f128M( float16_t, float128_t * );
+#endif
+float16_t slow_f16_roundToInt( float16_t, uint_fast8_t, bool );
+float16_t slow_f16_add( float16_t, float16_t );
+float16_t slow_f16_sub( float16_t, float16_t );
+float16_t slow_f16_mul( float16_t, float16_t );
+float16_t slow_f16_mulAdd( float16_t, float16_t, float16_t );
+float16_t slow_f16_div( float16_t, float16_t );
+float16_t slow_f16_rem( float16_t, float16_t );
+float16_t slow_f16_sqrt( float16_t );
+bool slow_f16_eq( float16_t, float16_t );
+bool slow_f16_le( float16_t, float16_t );
+bool slow_f16_lt( float16_t, float16_t );
+bool slow_f16_eq_signaling( float16_t, float16_t );
+bool slow_f16_le_quiet( float16_t, float16_t );
+bool slow_f16_lt_quiet( float16_t, float16_t );
+#endif
+
uint_fast32_t slow_f32_to_ui32( float32_t, uint_fast8_t, bool );
uint_fast64_t slow_f32_to_ui64( float32_t, uint_fast8_t, bool );
int_fast32_t slow_f32_to_i32( float32_t, uint_fast8_t, bool );
@@ -87,6 +132,9 @@ uint_fast32_t slow_f32_to_ui32_r_minMag( float32_t, bool );
uint_fast64_t slow_f32_to_ui64_r_minMag( float32_t, bool );
int_fast32_t slow_f32_to_i32_r_minMag( float32_t, bool );
int_fast64_t slow_f32_to_i64_r_minMag( float32_t, bool );
+#ifdef FLOAT16
+float16_t slow_f32_to_f16( float32_t );
+#endif
float64_t slow_f32_to_f64( float32_t );
#ifdef EXTFLOAT80
void slow_f32_to_extF80M( float32_t, extFloat80_t * );
@@ -117,6 +165,9 @@ uint_fast32_t slow_f64_to_ui32_r_minMag( float64_t, bool );
uint_fast64_t slow_f64_to_ui64_r_minMag( float64_t, bool );
int_fast32_t slow_f64_to_i32_r_minMag( float64_t, bool );
int_fast64_t slow_f64_to_i64_r_minMag( float64_t, bool );
+#ifdef FLOAT16
+float16_t slow_f64_to_f16( float64_t );
+#endif
float32_t slow_f64_to_f32( float64_t );
#ifdef EXTFLOAT80
void slow_f64_to_extF80M( float64_t, extFloat80_t * );
@@ -148,6 +199,9 @@ uint_fast32_t slow_extF80M_to_ui32_r_minMag( const extFloat80_t *, bool );
uint_fast64_t slow_extF80M_to_ui64_r_minMag( const extFloat80_t *, bool );
int_fast32_t slow_extF80M_to_i32_r_minMag( const extFloat80_t *, bool );
int_fast64_t slow_extF80M_to_i64_r_minMag( const extFloat80_t *, bool );
+#ifdef FLOAT16
+float16_t slow_extF80M_to_f16( const extFloat80_t * );
+#endif
float32_t slow_extF80M_to_f32( const extFloat80_t * );
float64_t slow_extF80M_to_f64( const extFloat80_t * );
#ifdef FLOAT128
@@ -196,6 +250,9 @@ uint_fast32_t slow_f128M_to_ui32_r_minMag( const float128_t *, bool );
uint_fast64_t slow_f128M_to_ui64_r_minMag( const float128_t *, bool );
int_fast32_t slow_f128M_to_i32_r_minMag( const float128_t *, bool );
int_fast64_t slow_f128M_to_i64_r_minMag( const float128_t *, bool );
+#ifdef FLOAT16
+float16_t slow_f128M_to_f16( const float128_t * );
+#endif
float32_t slow_f128M_to_f32( const float128_t * );
float64_t slow_f128M_to_f64( const float128_t * );
#ifdef EXTFLOAT80
diff --git a/source/standardFunctionInfos.c b/source/standardFunctionInfos.c
index 7fbe4cf..3432d39 100644
--- a/source/standardFunctionInfos.c
+++ b/source/standardFunctionInfos.c
@@ -1,12 +1,12 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -48,6 +48,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
const struct standardFunctionInfo standardFunctionInfos[] = {
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
+#ifdef FLOAT16
+ { "ui32_to_f16", UI32_TO_F16, 0, 0 },
+#endif
{ "ui32_to_f32", UI32_TO_F32, 0, 0 },
{ "ui32_to_f64", UI32_TO_F64, 0, 0 },
#ifdef EXTFLOAT80
@@ -56,6 +59,9 @@ const struct standardFunctionInfo standardFunctionInfos[] = {
#ifdef FLOAT128
{ "ui32_to_f128", UI32_TO_F128, 0, 0 },
#endif
+#ifdef FLOAT16
+ { "ui64_to_f16", UI64_TO_F16, 0, 0 },
+#endif
{ "ui64_to_f32", UI64_TO_F32, 0, 0 },
{ "ui64_to_f64", UI64_TO_F64, 0, 0 },
#ifdef EXTFLOAT80
@@ -64,6 +70,9 @@ const struct standardFunctionInfo standardFunctionInfos[] = {
#ifdef FLOAT128
{ "ui64_to_f128", UI64_TO_F128, 0, 0 },
#endif
+#ifdef FLOAT16
+ { "i32_to_f16", I32_TO_F16, 0, 0 },
+#endif
{ "i32_to_f32", I32_TO_F32, 0, 0 },
{ "i32_to_f64", I32_TO_F64, 0, 0 },
#ifdef EXTFLOAT80
@@ -72,6 +81,9 @@ const struct standardFunctionInfo standardFunctionInfos[] = {
#ifdef FLOAT128
{ "i32_to_f128", I32_TO_F128, 0, 0 },
#endif
+#ifdef FLOAT16
+ { "i64_to_f16", I64_TO_F16, 0, 0 },
+#endif
{ "i64_to_f32", I64_TO_F32, 0, 0 },
{ "i64_to_f64", I64_TO_F64, 0, 0 },
#ifdef EXTFLOAT80
@@ -82,6 +94,77 @@ const struct standardFunctionInfo standardFunctionInfos[] = {
#endif
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
+#ifdef FLOAT16
+ { "f16_to_ui32_r_near_even", F16_TO_UI32, RNEVEN, false },
+ { "f16_to_ui32_r_minMag", F16_TO_UI32, RMINM, false },
+ { "f16_to_ui32_r_min", F16_TO_UI32, RMIN, false },
+ { "f16_to_ui32_r_max", F16_TO_UI32, RMAX, false },
+ { "f16_to_ui32_r_near_maxMag", F16_TO_UI32, RNMAXM, false },
+ { "f16_to_ui64_r_near_even", F16_TO_UI64, RNEVEN, false },
+ { "f16_to_ui64_r_minMag", F16_TO_UI64, RMINM, false },
+ { "f16_to_ui64_r_min", F16_TO_UI64, RMIN, false },
+ { "f16_to_ui64_r_max", F16_TO_UI64, RMAX, false },
+ { "f16_to_ui64_r_near_maxMag", F16_TO_UI64, RNMAXM, false },
+ { "f16_to_i32_r_near_even", F16_TO_I32, RNEVEN, false },
+ { "f16_to_i32_r_minMag", F16_TO_I32, RMINM, false },
+ { "f16_to_i32_r_min", F16_TO_I32, RMIN, false },
+ { "f16_to_i32_r_max", F16_TO_I32, RMAX, false },
+ { "f16_to_i32_r_near_maxMag", F16_TO_I32, RNMAXM, false },
+ { "f16_to_i64_r_near_even", F16_TO_I64, RNEVEN, false },
+ { "f16_to_i64_r_minMag", F16_TO_I64, RMINM, false },
+ { "f16_to_i64_r_min", F16_TO_I64, RMIN, false },
+ { "f16_to_i64_r_max", F16_TO_I64, RMAX, false },
+ { "f16_to_i64_r_near_maxMag", F16_TO_I64, RNMAXM, false },
+ { "f16_to_ui32_rx_near_even", F16_TO_UI32, RNEVEN, true },
+ { "f16_to_ui32_rx_minMag", F16_TO_UI32, RMINM, true },
+ { "f16_to_ui32_rx_min", F16_TO_UI32, RMIN, true },
+ { "f16_to_ui32_rx_max", F16_TO_UI32, RMAX, true },
+ { "f16_to_ui32_rx_near_maxMag", F16_TO_UI32, RNMAXM, true },
+ { "f16_to_ui64_rx_near_even", F16_TO_UI64, RNEVEN, true },
+ { "f16_to_ui64_rx_minMag", F16_TO_UI64, RMINM, true },
+ { "f16_to_ui64_rx_min", F16_TO_UI64, RMIN, true },
+ { "f16_to_ui64_rx_max", F16_TO_UI64, RMAX, true },
+ { "f16_to_ui64_rx_near_maxMag", F16_TO_UI64, RNMAXM, true },
+ { "f16_to_i32_rx_near_even", F16_TO_I32, RNEVEN, true },
+ { "f16_to_i32_rx_minMag", F16_TO_I32, RMINM, true },
+ { "f16_to_i32_rx_min", F16_TO_I32, RMIN, true },
+ { "f16_to_i32_rx_max", F16_TO_I32, RMAX, true },
+ { "f16_to_i32_rx_near_maxMag", F16_TO_I32, RNMAXM, true },
+ { "f16_to_i64_rx_near_even", F16_TO_I64, RNEVEN, true },
+ { "f16_to_i64_rx_minMag", F16_TO_I64, RMINM, true },
+ { "f16_to_i64_rx_min", F16_TO_I64, RMIN, true },
+ { "f16_to_i64_rx_max", F16_TO_I64, RMAX, true },
+ { "f16_to_i64_rx_near_maxMag", F16_TO_I64, RNMAXM, true },
+ { "f16_to_f32", F16_TO_F32, 0, 0 },
+ { "f16_to_f64", F16_TO_F64, 0, 0 },
+#ifdef EXTFLOAT80
+ { "f16_to_extF80", F16_TO_EXTF80, 0, 0 },
+#endif
+#ifdef FLOAT128
+ { "f16_to_f128", F16_TO_F128, 0, 0 },
+#endif
+ { "f16_roundToInt_r_near_even", F16_ROUNDTOINT, RNEVEN, false },
+ { "f16_roundToInt_r_minMag", F16_ROUNDTOINT, RMINM, false },
+ { "f16_roundToInt_r_min", F16_ROUNDTOINT, RMIN, false },
+ { "f16_roundToInt_r_max", F16_ROUNDTOINT, RMAX, false },
+ { "f16_roundToInt_r_near_maxMag", F16_ROUNDTOINT, RNMAXM, false },
+ { "f16_roundToInt_x", F16_ROUNDTOINT, 0, true },
+ { "f16_add", F16_ADD, 0, 0 },
+ { "f16_sub", F16_SUB, 0, 0 },
+ { "f16_mul", F16_MUL, 0, 0 },
+ { "f16_mulAdd", F16_MULADD, 0, 0 },
+ { "f16_div", F16_DIV, 0, 0 },
+ { "f16_rem", F16_REM, 0, 0 },
+ { "f16_sqrt", F16_SQRT, 0, 0 },
+ { "f16_eq", F16_EQ, 0, 0 },
+ { "f16_le", F16_LE, 0, 0 },
+ { "f16_lt", F16_LT, 0, 0 },
+ { "f16_eq_signaling", F16_EQ_SIGNALING, 0, 0 },
+ { "f16_le_quiet", F16_LE_QUIET, 0, 0 },
+ { "f16_lt_quiet", F16_LT_QUIET, 0, 0 },
+#endif
+ /*------------------------------------------------------------------------
+ *------------------------------------------------------------------------*/
{ "f32_to_ui32_r_near_even", F32_TO_UI32, RNEVEN, false },
{ "f32_to_ui32_r_minMag", F32_TO_UI32, RMINM, false },
{ "f32_to_ui32_r_min", F32_TO_UI32, RMIN, false },
@@ -122,6 +205,9 @@ const struct standardFunctionInfo standardFunctionInfos[] = {
{ "f32_to_i64_rx_min", F32_TO_I64, RMIN, true },
{ "f32_to_i64_rx_max", F32_TO_I64, RMAX, true },
{ "f32_to_i64_rx_near_maxMag", F32_TO_I64, RNMAXM, true },
+#ifdef FLOAT16
+ { "f32_to_f16", F32_TO_F16, 0, 0 },
+#endif
{ "f32_to_f64", F32_TO_F64, 0, 0 },
#ifdef EXTFLOAT80
{ "f32_to_extF80", F32_TO_EXTF80, 0, 0 },
@@ -190,6 +276,9 @@ const struct standardFunctionInfo standardFunctionInfos[] = {
{ "f64_to_i64_rx_min", F64_TO_I64, RMIN, true },
{ "f64_to_i64_rx_max", F64_TO_I64, RMAX, true },
{ "f64_to_i64_rx_near_maxMag", F64_TO_I64, RNMAXM, true },
+#ifdef FLOAT16
+ { "f64_to_f16", F64_TO_F16, 0, 0 },
+#endif
{ "f64_to_f32", F64_TO_F32, 0, 0 },
#ifdef EXTFLOAT80
{ "f64_to_extF80", F64_TO_EXTF80, 0, 0 },
@@ -259,6 +348,9 @@ const struct standardFunctionInfo standardFunctionInfos[] = {
{ "extF80_to_i64_rx_min", EXTF80_TO_I64, RMIN, true },
{ "extF80_to_i64_rx_max", EXTF80_TO_I64, RMAX, true },
{ "extF80_to_i64_rx_near_maxMag", EXTF80_TO_I64, RNMAXM, true },
+#ifdef FLOAT16
+ { "extF80_to_f16", EXTF80_TO_F16, 0, 0 },
+#endif
{ "extF80_to_f32", EXTF80_TO_F32, 0, 0 },
{ "extF80_to_f64", EXTF80_TO_F64, 0, 0 },
#ifdef FLOAT128
@@ -326,6 +418,9 @@ const struct standardFunctionInfo standardFunctionInfos[] = {
{ "f128_to_i64_rx_min", F128_TO_I64, RMIN, true },
{ "f128_to_i64_rx_max", F128_TO_I64, RMAX, true },
{ "f128_to_i64_rx_near_maxMag", F128_TO_I64, RNMAXM, true },
+#ifdef FLOAT16
+ { "f128_to_f16", F128_TO_F16, 0, 0 },
+#endif
{ "f128_to_f32", F128_TO_F32, 0, 0 },
{ "f128_to_f64", F128_TO_F64, 0, 0 },
#ifdef EXTFLOAT80
diff --git a/source/subj-C/subjfloat.c b/source/subj-C/subjfloat.c
index 986d9fc..b42075e 100644
--- a/source/subj-C/subjfloat.c
+++ b/source/subj-C/subjfloat.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/subjfloat.h b/source/subjfloat.h
index 587ba65..7f83302 100644
--- a/source/subjfloat.h
+++ b/source/subjfloat.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -54,6 +54,9 @@ uint_fast8_t subjfloat_clearExceptionFlags( void );
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+#ifdef FLOAT16
+float16_t subj_ui32_to_f16( uint32_t );
+#endif
float32_t subj_ui32_to_f32( uint32_t );
float64_t subj_ui32_to_f64( uint32_t );
#ifdef EXTFLOAT80
@@ -62,6 +65,9 @@ void subj_ui32_to_extF80M( uint32_t, extFloat80_t * );
#ifdef FLOAT128
void subj_ui32_to_f128M( uint32_t, float128_t * );
#endif
+#ifdef FLOAT16
+float16_t subj_ui64_to_f16( uint64_t );
+#endif
float32_t subj_ui64_to_f32( uint64_t );
float64_t subj_ui64_to_f64( uint64_t );
#ifdef EXTFLOAT80
@@ -70,6 +76,9 @@ void subj_ui64_to_extF80M( uint64_t, extFloat80_t * );
#ifdef FLOAT128
void subj_ui64_to_f128M( uint64_t, float128_t * );
#endif
+#ifdef FLOAT16
+float16_t subj_i32_to_f16( int32_t );
+#endif
float32_t subj_i32_to_f32( int32_t );
float64_t subj_i32_to_f64( int32_t );
#ifdef EXTFLOAT80
@@ -78,6 +87,9 @@ void subj_i32_to_extF80M( int32_t, extFloat80_t * );
#ifdef FLOAT128
void subj_i32_to_f128M( int32_t, float128_t * );
#endif
+#ifdef FLOAT16
+float16_t subj_i64_to_f16( int64_t );
+#endif
float32_t subj_i64_to_f32( int64_t );
float64_t subj_i64_to_f64( int64_t );
#ifdef EXTFLOAT80
@@ -89,6 +101,83 @@ void subj_i64_to_f128M( int64_t, float128_t * );
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+#ifdef FLOAT16
+
+uint_fast32_t subj_f16_to_ui32_r_near_even( float16_t );
+uint_fast32_t subj_f16_to_ui32_r_minMag( float16_t );
+uint_fast32_t subj_f16_to_ui32_r_min( float16_t );
+uint_fast32_t subj_f16_to_ui32_r_max( float16_t );
+uint_fast32_t subj_f16_to_ui32_r_near_maxMag( float16_t );
+uint_fast64_t subj_f16_to_ui64_r_near_even( float16_t );
+uint_fast64_t subj_f16_to_ui64_r_minMag( float16_t );
+uint_fast64_t subj_f16_to_ui64_r_min( float16_t );
+uint_fast64_t subj_f16_to_ui64_r_max( float16_t );
+uint_fast64_t subj_f16_to_ui64_r_near_maxMag( float16_t );
+int_fast32_t subj_f16_to_i32_r_near_even( float16_t );
+int_fast32_t subj_f16_to_i32_r_minMag( float16_t );
+int_fast32_t subj_f16_to_i32_r_min( float16_t );
+int_fast32_t subj_f16_to_i32_r_max( float16_t );
+int_fast32_t subj_f16_to_i32_r_near_maxMag( float16_t );
+int_fast64_t subj_f16_to_i64_r_near_even( float16_t );
+int_fast64_t subj_f16_to_i64_r_minMag( float16_t );
+int_fast64_t subj_f16_to_i64_r_min( float16_t );
+int_fast64_t subj_f16_to_i64_r_max( float16_t );
+int_fast64_t subj_f16_to_i64_r_near_maxMag( float16_t );
+
+uint_fast32_t subj_f16_to_ui32_rx_near_even( float16_t );
+uint_fast32_t subj_f16_to_ui32_rx_minMag( float16_t );
+uint_fast32_t subj_f16_to_ui32_rx_min( float16_t );
+uint_fast32_t subj_f16_to_ui32_rx_max( float16_t );
+uint_fast32_t subj_f16_to_ui32_rx_near_maxMag( float16_t );
+uint_fast64_t subj_f16_to_ui64_rx_near_even( float16_t );
+uint_fast64_t subj_f16_to_ui64_rx_minMag( float16_t );
+uint_fast64_t subj_f16_to_ui64_rx_min( float16_t );
+uint_fast64_t subj_f16_to_ui64_rx_max( float16_t );
+uint_fast64_t subj_f16_to_ui64_rx_near_maxMag( float16_t );
+int_fast32_t subj_f16_to_i32_rx_near_even( float16_t );
+int_fast32_t subj_f16_to_i32_rx_minMag( float16_t );
+int_fast32_t subj_f16_to_i32_rx_min( float16_t );
+int_fast32_t subj_f16_to_i32_rx_max( float16_t );
+int_fast32_t subj_f16_to_i32_rx_near_maxMag( float16_t );
+int_fast64_t subj_f16_to_i64_rx_near_even( float16_t );
+int_fast64_t subj_f16_to_i64_rx_minMag( float16_t );
+int_fast64_t subj_f16_to_i64_rx_min( float16_t );
+int_fast64_t subj_f16_to_i64_rx_max( float16_t );
+int_fast64_t subj_f16_to_i64_rx_near_maxMag( float16_t );
+
+float32_t subj_f16_to_f32( float16_t );
+float64_t subj_f16_to_f64( float16_t );
+#ifdef EXTFLOAT80
+void subj_f16_to_extF80M( float16_t, extFloat80_t * );
+#endif
+#ifdef FLOAT128
+void subj_f16_to_f128M( float16_t, float128_t * );
+#endif
+
+float16_t subj_f16_roundToInt_r_near_even( float16_t );
+float16_t subj_f16_roundToInt_r_minMag( float16_t );
+float16_t subj_f16_roundToInt_r_min( float16_t );
+float16_t subj_f16_roundToInt_r_max( float16_t );
+float16_t subj_f16_roundToInt_r_near_maxMag( float16_t );
+float16_t subj_f16_roundToInt_x( float16_t );
+float16_t subj_f16_add( float16_t, float16_t );
+float16_t subj_f16_sub( float16_t, float16_t );
+float16_t subj_f16_mul( float16_t, float16_t );
+float16_t subj_f16_mulAdd( float16_t, float16_t, float16_t );
+float16_t subj_f16_div( float16_t, float16_t );
+float16_t subj_f16_rem( float16_t, float16_t );
+float16_t subj_f16_sqrt( float16_t );
+bool subj_f16_eq( float16_t, float16_t );
+bool subj_f16_le( float16_t, float16_t );
+bool subj_f16_lt( float16_t, float16_t );
+bool subj_f16_eq_signaling( float16_t, float16_t );
+bool subj_f16_le_quiet( float16_t, float16_t );
+bool subj_f16_lt_quiet( float16_t, float16_t );
+
+#endif
+
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
uint_fast32_t subj_f32_to_ui32_r_near_even( float32_t );
uint_fast32_t subj_f32_to_ui32_r_minMag( float32_t );
uint_fast32_t subj_f32_to_ui32_r_min( float32_t );
@@ -131,6 +220,9 @@ int_fast64_t subj_f32_to_i64_rx_min( float32_t );
int_fast64_t subj_f32_to_i64_rx_max( float32_t );
int_fast64_t subj_f32_to_i64_rx_near_maxMag( float32_t );
+#ifdef FLOAT16
+float16_t subj_f32_to_f16( float32_t );
+#endif
float64_t subj_f32_to_f64( float32_t );
#ifdef EXTFLOAT80
void subj_f32_to_extF80M( float32_t, extFloat80_t * );
@@ -203,6 +295,9 @@ int_fast64_t subj_f64_to_i64_rx_min( float64_t );
int_fast64_t subj_f64_to_i64_rx_max( float64_t );
int_fast64_t subj_f64_to_i64_rx_near_maxMag( float64_t );
+#ifdef FLOAT16
+float16_t subj_f64_to_f16( float64_t );
+#endif
float32_t subj_f64_to_f32( float64_t );
#ifdef EXTFLOAT80
void subj_f64_to_extF80M( float64_t, extFloat80_t * );
@@ -277,6 +372,9 @@ int_fast64_t subj_extF80M_to_i64_rx_min( const extFloat80_t * );
int_fast64_t subj_extF80M_to_i64_rx_max( const extFloat80_t * );
int_fast64_t subj_extF80M_to_i64_rx_near_maxMag( const extFloat80_t * );
+#ifdef FLOAT16
+float16_t subj_extF80M_to_f16( const extFloat80_t * );
+#endif
float32_t subj_extF80M_to_f32( const extFloat80_t * );
float64_t subj_extF80M_to_f64( const extFloat80_t * );
#ifdef EXTFLOAT80
@@ -362,6 +460,9 @@ int_fast64_t subj_f128M_to_i64_rx_min( const float128_t * );
int_fast64_t subj_f128M_to_i64_rx_max( const float128_t * );
int_fast64_t subj_f128M_to_i64_rx_near_maxMag( extFloat80_t * );
+#ifdef FLOAT16
+float16_t subj_f128M_to_f16( const float128_t * );
+#endif
float32_t subj_f128M_to_f32( const float128_t * );
float64_t subj_f128M_to_f64( const float128_t * );
#ifdef FLOAT128
diff --git a/source/subjfloat_functions.c b/source/subjfloat_functions.c
index 07584b4..ab1983e 100644
--- a/source/subjfloat_functions.c
+++ b/source/subjfloat_functions.c
@@ -1,12 +1,12 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -54,6 +54,13 @@ typedef void genericFuncType();
genericFuncType *const subjfloat_functions[] = {
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
+#ifdef FLOAT16
+#ifdef SUBJ_UI32_TO_F16
+ (genericFuncType *) subj_ui32_to_f16,
+#else
+ 0,
+#endif
+#endif
#ifdef SUBJ_UI32_TO_F32
(genericFuncType *) subj_ui32_to_f32,
#else
@@ -78,6 +85,13 @@ genericFuncType *const subjfloat_functions[] = {
0,
#endif
#endif
+#ifdef FLOAT16
+#ifdef SUBJ_UI64_TO_F16
+ (genericFuncType *) subj_ui64_to_f16,
+#else
+ 0,
+#endif
+#endif
#ifdef SUBJ_UI64_TO_F32
(genericFuncType *) subj_ui64_to_f32,
#else
@@ -102,6 +116,13 @@ genericFuncType *const subjfloat_functions[] = {
0,
#endif
#endif
+#ifdef FLOAT16
+#ifdef SUBJ_I32_TO_F16
+ (genericFuncType *) subj_i32_to_f16,
+#else
+ 0,
+#endif
+#endif
#ifdef SUBJ_I32_TO_F32
(genericFuncType *) subj_i32_to_f32,
#else
@@ -126,6 +147,13 @@ genericFuncType *const subjfloat_functions[] = {
0,
#endif
#endif
+#ifdef FLOAT16
+#ifdef SUBJ_I64_TO_F16
+ (genericFuncType *) subj_i64_to_f16,
+#else
+ 0,
+#endif
+#endif
#ifdef SUBJ_I64_TO_F32
(genericFuncType *) subj_i64_to_f32,
#else
@@ -152,6 +180,329 @@ genericFuncType *const subjfloat_functions[] = {
#endif
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
+#ifdef FLOAT16
+#ifdef SUBJ_F16_TO_UI32_R_NEAR_EVEN
+ (genericFuncType *) subj_f16_to_ui32_r_near_even,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI32_R_MINMAG
+ (genericFuncType *) subj_f16_to_ui32_r_minMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI32_R_MIN
+ (genericFuncType *) subj_f16_to_ui32_r_min,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI32_R_MAX
+ (genericFuncType *) subj_f16_to_ui32_r_max,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI32_R_NEAR_MAXMAG
+ (genericFuncType *) subj_f16_to_ui32_r_near_maxMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI64_R_NEAR_EVEN
+ (genericFuncType *) subj_f16_to_ui64_r_near_even,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI64_R_MINMAG
+ (genericFuncType *) subj_f16_to_ui64_r_minMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI64_R_MIN
+ (genericFuncType *) subj_f16_to_ui64_r_min,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI64_R_MAX
+ (genericFuncType *) subj_f16_to_ui64_r_max,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI64_R_NEAR_MAXMAG
+ (genericFuncType *) subj_f16_to_ui64_r_near_maxMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I32_R_NEAR_EVEN
+ (genericFuncType *) subj_f16_to_i32_r_near_even,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I32_R_MINMAG
+ (genericFuncType *) subj_f16_to_i32_r_minMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I32_R_MIN
+ (genericFuncType *) subj_f16_to_i32_r_min,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I32_R_MAX
+ (genericFuncType *) subj_f16_to_i32_r_max,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I32_R_NEAR_MAXMAG
+ (genericFuncType *) subj_f16_to_i32_r_near_maxMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I64_R_NEAR_EVEN
+ (genericFuncType *) subj_f16_to_i64_r_near_even,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I64_R_MINMAG
+ (genericFuncType *) subj_f16_to_i64_r_minMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I64_R_MIN
+ (genericFuncType *) subj_f16_to_i64_r_min,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I64_R_MAX
+ (genericFuncType *) subj_f16_to_i64_r_max,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I64_R_NEAR_MAXMAG
+ (genericFuncType *) subj_f16_to_i64_r_near_maxMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI32_RX_NEAR_EVEN
+ (genericFuncType *) subj_f16_to_ui32_rx_near_even,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI32_RX_MINMAG
+ (genericFuncType *) subj_f16_to_ui32_rx_minMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI32_RX_MIN
+ (genericFuncType *) subj_f16_to_ui32_rx_min,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI32_RX_MAX
+ (genericFuncType *) subj_f16_to_ui32_rx_max,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI32_RX_NEAR_MAXMAG
+ (genericFuncType *) subj_f16_to_ui32_rx_near_maxMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI64_RX_NEAR_EVEN
+ (genericFuncType *) subj_f16_to_ui64_rx_near_even,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI64_RX_MINMAG
+ (genericFuncType *) subj_f16_to_ui64_rx_minMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI64_RX_MIN
+ (genericFuncType *) subj_f16_to_ui64_rx_min,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI64_RX_MAX
+ (genericFuncType *) subj_f16_to_ui64_rx_max,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_UI64_RX_NEAR_MAXMAG
+ (genericFuncType *) subj_f16_to_ui64_rx_near_maxMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I32_RX_NEAR_EVEN
+ (genericFuncType *) subj_f16_to_i32_rx_near_even,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I32_RX_MINMAG
+ (genericFuncType *) subj_f16_to_i32_rx_minMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I32_RX_MIN
+ (genericFuncType *) subj_f16_to_i32_rx_min,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I32_RX_MAX
+ (genericFuncType *) subj_f16_to_i32_rx_max,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I32_RX_NEAR_MAXMAG
+ (genericFuncType *) subj_f16_to_i32_rx_near_maxMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I64_RX_NEAR_EVEN
+ (genericFuncType *) subj_f16_to_i64_rx_near_even,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I64_RX_MINMAG
+ (genericFuncType *) subj_f16_to_i64_rx_minMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I64_RX_MIN
+ (genericFuncType *) subj_f16_to_i64_rx_min,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I64_RX_MAX
+ (genericFuncType *) subj_f16_to_i64_rx_max,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_I64_RX_NEAR_MAXMAG
+ (genericFuncType *) subj_f16_to_i64_rx_near_maxMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_F32
+ (genericFuncType *) subj_f16_to_f32,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_TO_F64
+ (genericFuncType *) subj_f16_to_f64,
+#else
+ 0,
+#endif
+#ifdef EXTFLOAT80
+#ifdef SUBJ_F16_TO_EXTF80
+ (genericFuncType *) subj_f16_to_extF80M,
+#else
+ 0,
+#endif
+#endif
+#ifdef FLOAT128
+#ifdef SUBJ_F16_TO_F128
+ (genericFuncType *) subj_f16_to_f128M,
+#else
+ 0,
+#endif
+#endif
+#ifdef SUBJ_F16_ROUNDTOINT_R_NEAR_EVEN
+ (genericFuncType *) subj_f16_roundToInt_r_near_even,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_ROUNDTOINT_R_MINMAG
+ (genericFuncType *) subj_f16_roundToInt_r_minMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_ROUNDTOINT_R_MIN
+ (genericFuncType *) subj_f16_roundToInt_r_min,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_ROUNDTOINT_R_MAX
+ (genericFuncType *) subj_f16_roundToInt_r_max,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_ROUNDTOINT_R_NEAR_MAXMAG
+ (genericFuncType *) subj_f16_roundToInt_r_near_maxMag,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_ROUNDTOINT_X
+ (genericFuncType *) subj_f16_roundToInt_x,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_ADD
+ (genericFuncType *) subj_f16_add,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_SUB
+ (genericFuncType *) subj_f16_sub,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_MUL
+ (genericFuncType *) subj_f16_mul,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_MULADD
+ (genericFuncType *) subj_f16_mulAdd,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_DIV
+ (genericFuncType *) subj_f16_div,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_REM
+ (genericFuncType *) subj_f16_rem,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_SQRT
+ (genericFuncType *) subj_f16_sqrt,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_EQ
+ (genericFuncType *) subj_f16_eq,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_LE
+ (genericFuncType *) subj_f16_le,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_LT
+ (genericFuncType *) subj_f16_lt,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_EQ_SIGNALING
+ (genericFuncType *) subj_f16_eq_signaling,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_LE_QUIET
+ (genericFuncType *) subj_f16_le_quiet,
+#else
+ 0,
+#endif
+#ifdef SUBJ_F16_LT_QUIET
+ (genericFuncType *) subj_f16_lt_quiet,
+#else
+ 0,
+#endif
+#endif
+ /*------------------------------------------------------------------------
+ *------------------------------------------------------------------------*/
#ifdef SUBJ_F32_TO_UI32_R_NEAR_EVEN
(genericFuncType *) subj_f32_to_ui32_r_near_even,
#else
@@ -352,6 +703,13 @@ genericFuncType *const subjfloat_functions[] = {
#else
0,
#endif
+#ifdef FLOAT16
+#ifdef SUBJ_F32_TO_F16
+ (genericFuncType *) subj_f32_to_f16,
+#else
+ 0,
+#endif
+#endif
#ifdef SUBJ_F32_TO_F64
(genericFuncType *) subj_f32_to_f64,
#else
@@ -668,6 +1026,13 @@ genericFuncType *const subjfloat_functions[] = {
#else
0,
#endif
+#ifdef FLOAT16
+#ifdef SUBJ_F64_TO_F16
+ (genericFuncType *) subj_f64_to_f16,
+#else
+ 0,
+#endif
+#endif
#ifdef SUBJ_F64_TO_F32
(genericFuncType *) subj_f64_to_f32,
#else
@@ -985,6 +1350,13 @@ genericFuncType *const subjfloat_functions[] = {
#else
0,
#endif
+#ifdef FLOAT16
+#ifdef SUBJ_EXTF80_TO_F16
+ (genericFuncType *) subj_extF80M_to_f16,
+#else
+ 0,
+#endif
+#endif
#ifdef SUBJ_EXTF80_TO_F32
(genericFuncType *) subj_extF80M_to_f32,
#else
@@ -1296,6 +1668,13 @@ genericFuncType *const subjfloat_functions[] = {
#else
0,
#endif
+#ifdef FLOAT16
+#ifdef SUBJ_F128_TO_F16
+ (genericFuncType *) subj_f128M_to_f16,
+#else
+ 0,
+#endif
+#endif
#ifdef SUBJ_F128_TO_F32
(genericFuncType *) subj_f128M_to_f32,
#else
diff --git a/source/testLoops.h b/source/testLoops.h
index 5222fae..77f6e61 100644
--- a/source/testLoops.h
+++ b/source/testLoops.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -47,6 +47,9 @@ extern uint_fast8_t (*testLoops_subjFlagsFunction)( void );
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+#ifdef FLOAT16
+void test_a_ui32_z_f16( float16_t ( uint32_t ), float16_t ( uint32_t ) );
+#endif
void test_a_ui32_z_f32( float32_t ( uint32_t ), float32_t ( uint32_t ) );
void test_a_ui32_z_f64( float64_t ( uint32_t ), float64_t ( uint32_t ) );
#ifdef EXTFLOAT80
@@ -60,6 +63,9 @@ void
void ( uint32_t, float128_t * ), void ( uint32_t, float128_t * )
);
#endif
+#ifdef FLOAT16
+void test_a_ui64_z_f16( float16_t ( uint64_t ), float16_t ( uint64_t ) );
+#endif
void test_a_ui64_z_f32( float32_t ( uint64_t ), float32_t ( uint64_t ) );
void test_a_ui64_z_f64( float64_t ( uint64_t ), float64_t ( uint64_t ) );
#ifdef EXTFLOAT80
@@ -72,6 +78,9 @@ void
test_a_ui64_z_f128(
void ( uint64_t, float128_t * ), void ( uint64_t, float128_t * ) );
#endif
+#ifdef FLOAT16
+void test_a_i32_z_f16( float16_t ( int32_t ), float16_t ( int32_t ) );
+#endif
void test_a_i32_z_f32( float32_t ( int32_t ), float32_t ( int32_t ) );
void test_a_i32_z_f64( float64_t ( int32_t ), float64_t ( int32_t ) );
#ifdef EXTFLOAT80
@@ -84,6 +93,9 @@ void
test_a_i32_z_f128(
void ( int32_t, float128_t * ), void ( int32_t, float128_t * ) );
#endif
+#ifdef FLOAT16
+void test_a_i64_z_f16( float16_t ( int64_t ), float16_t ( int64_t ) );
+#endif
void test_a_i64_z_f32( float32_t ( int64_t ), float32_t ( int64_t ) );
void test_a_i64_z_f64( float64_t ( int64_t ), float64_t ( int64_t ) );
#ifdef EXTFLOAT80
@@ -99,6 +111,86 @@ void
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+#ifdef FLOAT16
+void
+ test_a_f16_z_ui32_rx(
+ uint_fast32_t ( float16_t, uint_fast8_t, bool ),
+ uint_fast32_t ( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t,
+ bool
+ );
+void
+ test_a_f16_z_ui64_rx(
+ uint_fast64_t ( float16_t, uint_fast8_t, bool ),
+ uint_fast64_t ( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t,
+ bool
+ );
+void
+ test_a_f16_z_i32_rx(
+ int_fast32_t ( float16_t, uint_fast8_t, bool ),
+ int_fast32_t ( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t,
+ bool
+ );
+void
+ test_a_f16_z_i64_rx(
+ int_fast64_t ( float16_t, uint_fast8_t, bool ),
+ int_fast64_t ( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t,
+ bool
+ );
+void
+ test_a_f16_z_ui32_x(
+ uint_fast32_t ( float16_t, bool ), uint_fast32_t ( float16_t, bool ), bool
+ );
+void
+ test_a_f16_z_ui64_x(
+ uint_fast64_t ( float16_t, bool ), uint_fast64_t ( float16_t, bool ), bool
+ );
+void
+ test_a_f16_z_i32_x(
+ int_fast32_t ( float16_t, bool ), int_fast32_t ( float16_t, bool ), bool
+ );
+void
+ test_a_f16_z_i64_x(
+ int_fast64_t ( float16_t, bool ), int_fast64_t ( float16_t, bool ), bool
+ );
+void test_a_f16_z_f32( float32_t ( float16_t ), float32_t ( float16_t ) );
+void test_a_f16_z_f64( float64_t ( float16_t ), float64_t ( float16_t ) );
+#ifdef EXTFLOAT80
+void
+ test_a_f16_z_extF80(
+ void ( float16_t, extFloat80_t * ), void ( float16_t, extFloat80_t * ) );
+#endif
+#ifdef FLOAT128
+void
+ test_a_f16_z_f128(
+ void ( float16_t, float128_t * ), void ( float16_t, float128_t * ) );
+#endif
+void test_az_f16( float16_t ( float16_t ), float16_t ( float16_t ) );
+void
+ test_az_f16_rx(
+ float16_t ( float16_t, uint_fast8_t, bool ),
+ float16_t ( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t,
+ bool
+ );
+void
+ test_abz_f16(
+ float16_t ( float16_t, float16_t ), float16_t ( float16_t, float16_t ) );
+void
+ test_abcz_f16(
+ float16_t ( float16_t, float16_t, float16_t ),
+ float16_t ( float16_t, float16_t, float16_t )
+ );
+void
+ test_ab_f16_z_bool(
+ bool ( float16_t, float16_t ), bool ( float16_t, float16_t ) );
+#endif
+
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
void
test_a_f32_z_ui32_rx(
uint_fast32_t ( float32_t, uint_fast8_t, bool ),
@@ -143,6 +235,9 @@ void
test_a_f32_z_i64_x(
int_fast64_t ( float32_t, bool ), int_fast64_t ( float32_t, bool ), bool
);
+#ifdef FLOAT16
+void test_a_f32_z_f16( float16_t ( float32_t ), float16_t ( float32_t ) );
+#endif
void test_a_f32_z_f64( float64_t ( float32_t ), float64_t ( float32_t ) );
#ifdef EXTFLOAT80
void
@@ -220,6 +315,9 @@ void
test_a_f64_z_i64_x(
int_fast64_t ( float64_t, bool ), int_fast64_t ( float64_t, bool ), bool
);
+#ifdef FLOAT16
+void test_a_f64_z_f16( float16_t ( float64_t ), float16_t ( float64_t ) );
+#endif
void test_a_f64_z_f32( float32_t ( float64_t ), float32_t ( float64_t ) );
#ifdef EXTFLOAT80
void
@@ -306,6 +404,11 @@ void
int_fast64_t ( const extFloat80_t *, bool ),
bool
);
+#ifdef FLOAT16
+void
+ test_a_extF80_z_f16(
+ float16_t ( const extFloat80_t * ), float16_t ( const extFloat80_t * ) );
+#endif
void
test_a_extF80_z_f32(
float32_t ( const extFloat80_t * ), float32_t ( const extFloat80_t * ) );
@@ -415,6 +518,11 @@ void
int_fast64_t ( const float128_t *, bool ),
bool
);
+#ifdef FLOAT16
+void
+ test_a_f128_z_f16(
+ float16_t ( const float128_t * ), float16_t ( const float128_t * ) );
+#endif
void
test_a_f128_z_f32(
float32_t ( const float128_t * ), float32_t ( const float128_t * ) );
diff --git a/source/testLoops_common.c b/source/testLoops_common.c
index 291d01a..78c79b3 100644
--- a/source/testLoops_common.c
+++ b/source/testLoops_common.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_extF80_z_f128.c b/source/test_a_extF80_z_f128.c
index 44200ca..d1c7bd0 100644
--- a/source/test_a_extF80_z_f128.c
+++ b/source/test_a_extF80_z_f128.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_extF80_z_f16.c b/source/test_a_extF80_z_f16.c
new file mode 100644
index 0000000..19e0b83
--- /dev/null
+++ b/source/test_a_extF80_z_f16.c
@@ -0,0 +1,107 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdio.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#if defined FLOAT16 && defined EXTFLOAT80
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_extF80_z_f16(
+ float16_t trueFunction( const extFloat80_t * ),
+ float16_t subjFunction( const extFloat80_t * )
+ )
+{
+ int count;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_extF80_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_extF80_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( &genCases_extF80_a );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( &genCases_extF80_a );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs
+ && extF80M_isSignalingNaN( &genCases_extF80_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_extF80M( &genCases_extF80_a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_a_extF80_z_f32.c b/source/test_a_extF80_z_f32.c
index 2ee1699..5a5f885 100644
--- a/source/test_a_extF80_z_f32.c
+++ b/source/test_a_extF80_z_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_extF80_z_f64.c b/source/test_a_extF80_z_f64.c
index 973baf8..f6016c8 100644
--- a/source/test_a_extF80_z_f64.c
+++ b/source/test_a_extF80_z_f64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_extF80_z_i32_rx.c b/source/test_a_extF80_z_i32_rx.c
index 60c450a..9df8dc6 100644
--- a/source/test_a_extF80_z_i32_rx.c
+++ b/source/test_a_extF80_z_i32_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_extF80_z_i32_x.c b/source/test_a_extF80_z_i32_x.c
index 754a6bc..8c70e79 100644
--- a/source/test_a_extF80_z_i32_x.c
+++ b/source/test_a_extF80_z_i32_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_extF80_z_i64_rx.c b/source/test_a_extF80_z_i64_rx.c
index 1b3a9bb..54d7ea6 100644
--- a/source/test_a_extF80_z_i64_rx.c
+++ b/source/test_a_extF80_z_i64_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_extF80_z_i64_x.c b/source/test_a_extF80_z_i64_x.c
index f13d00b..f52ae5a 100644
--- a/source/test_a_extF80_z_i64_x.c
+++ b/source/test_a_extF80_z_i64_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_extF80_z_ui32_rx.c b/source/test_a_extF80_z_ui32_rx.c
index 446602e..f768040 100644
--- a/source/test_a_extF80_z_ui32_rx.c
+++ b/source/test_a_extF80_z_ui32_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_extF80_z_ui32_x.c b/source/test_a_extF80_z_ui32_x.c
index 8beb35c..bbef2dd 100644
--- a/source/test_a_extF80_z_ui32_x.c
+++ b/source/test_a_extF80_z_ui32_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_extF80_z_ui64_rx.c b/source/test_a_extF80_z_ui64_rx.c
index 704b8ba..25346ba 100644
--- a/source/test_a_extF80_z_ui64_rx.c
+++ b/source/test_a_extF80_z_ui64_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_extF80_z_ui64_x.c b/source/test_a_extF80_z_ui64_x.c
index 88ec271..9323f44 100644
--- a/source/test_a_extF80_z_ui64_x.c
+++ b/source/test_a_extF80_z_ui64_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f128_z_extF80.c b/source/test_a_f128_z_extF80.c
index f742225..b65b37d 100644
--- a/source/test_a_f128_z_extF80.c
+++ b/source/test_a_f128_z_extF80.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f128_z_f16.c b/source/test_a_f128_z_f16.c
new file mode 100644
index 0000000..f9438fb
--- /dev/null
+++ b/source/test_a_f128_z_f16.c
@@ -0,0 +1,107 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#if defined FLOAT16 && defined FLOAT128
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f128_z_f16(
+ float16_t trueFunction( const float128_t * ),
+ float16_t subjFunction( const float128_t * )
+ )
+{
+ int count;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f128_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f128_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( &genCases_f128_a );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( &genCases_f128_a );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs
+ && f128M_isSignalingNaN( &genCases_f128_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f128M( &genCases_f128_a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_a_f128_z_f32.c b/source/test_a_f128_z_f32.c
index ac684ad..3064231 100644
--- a/source/test_a_f128_z_f32.c
+++ b/source/test_a_f128_z_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f128_z_f64.c b/source/test_a_f128_z_f64.c
index c93ccbc..4f09acb 100644
--- a/source/test_a_f128_z_f64.c
+++ b/source/test_a_f128_z_f64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f128_z_i32_rx.c b/source/test_a_f128_z_i32_rx.c
index 2344d3c..92ca0d4 100644
--- a/source/test_a_f128_z_i32_rx.c
+++ b/source/test_a_f128_z_i32_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f128_z_i32_x.c b/source/test_a_f128_z_i32_x.c
index 82779b9..06f1f69 100644
--- a/source/test_a_f128_z_i32_x.c
+++ b/source/test_a_f128_z_i32_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f128_z_i64_rx.c b/source/test_a_f128_z_i64_rx.c
index 5a172d1..71cca80 100644
--- a/source/test_a_f128_z_i64_rx.c
+++ b/source/test_a_f128_z_i64_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f128_z_i64_x.c b/source/test_a_f128_z_i64_x.c
index 66e0d6c..c219e5d 100644
--- a/source/test_a_f128_z_i64_x.c
+++ b/source/test_a_f128_z_i64_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f128_z_ui32_rx.c b/source/test_a_f128_z_ui32_rx.c
index a6ec1ad..30e8806 100644
--- a/source/test_a_f128_z_ui32_rx.c
+++ b/source/test_a_f128_z_ui32_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f128_z_ui32_x.c b/source/test_a_f128_z_ui32_x.c
index 3b4fcaf..9bce868 100644
--- a/source/test_a_f128_z_ui32_x.c
+++ b/source/test_a_f128_z_ui32_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f128_z_ui64_rx.c b/source/test_a_f128_z_ui64_rx.c
index e5274a7..28c27a2 100644
--- a/source/test_a_f128_z_ui64_rx.c
+++ b/source/test_a_f128_z_ui64_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f128_z_ui64_x.c b/source/test_a_f128_z_ui64_x.c
index 33f4cb5..66fb1f1 100644
--- a/source/test_a_f128_z_ui64_x.c
+++ b/source/test_a_f128_z_ui64_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f16_z_extF80.c b/source/test_a_f16_z_extF80.c
new file mode 100644
index 0000000..150b71b
--- /dev/null
+++ b/source/test_a_f16_z_extF80.c
@@ -0,0 +1,106 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#if defined FLOAT16 && defined EXTFLOAT80
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f16_z_extF80(
+ void trueFunction( float16_t, extFloat80_t * ),
+ void subjFunction( float16_t, extFloat80_t * )
+ )
+{
+ int count;
+ extFloat80_t trueZ;
+ uint_fast8_t trueFlags;
+ extFloat80_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueFunction( genCases_f16_a, &trueZ );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjFunction( genCases_f16_a, &subjZ );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! extF80M_isNaN( &trueZ )
+ || ! extF80M_isNaN( &subjZ )
+ || extF80M_isSignalingNaN( &subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( genCases_f16_a, " " );
+ writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_a_f16_z_f128.c b/source/test_a_f16_z_f128.c
new file mode 100644
index 0000000..2372955
--- /dev/null
+++ b/source/test_a_f16_z_f128.c
@@ -0,0 +1,106 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#if defined FLOAT16 && defined FLOAT128
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f16_z_f128(
+ void trueFunction( float16_t, float128_t * ),
+ void subjFunction( float16_t, float128_t * )
+ )
+{
+ int count;
+ float128_t trueZ;
+ uint_fast8_t trueFlags;
+ float128_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueFunction( genCases_f16_a, &trueZ );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjFunction( genCases_f16_a, &subjZ );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f128M_isNaN( &trueZ )
+ || ! f128M_isNaN( &subjZ )
+ || f128M_isSignalingNaN( &subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( genCases_f16_a, " " );
+ writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_a_f16_z_f32.c b/source/test_a_f16_z_f32.c
new file mode 100644
index 0000000..7612e5d
--- /dev/null
+++ b/source/test_a_f16_z_f32.c
@@ -0,0 +1,104 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#ifdef FLOAT16
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f16_z_f32(
+ float32_t trueFunction( float16_t ), float32_t subjFunction( float16_t ) )
+{
+ int count;
+ float32_t trueZ;
+ uint_fast8_t trueFlags;
+ float32_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f32_isNaN( trueZ )
+ || ! f32_isNaN( subjZ )
+ || f32_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( genCases_f16_a, " " );
+ writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_a_f16_z_f64.c b/source/test_a_f16_z_f64.c
new file mode 100644
index 0000000..bbc3f69
--- /dev/null
+++ b/source/test_a_f16_z_f64.c
@@ -0,0 +1,104 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#ifdef FLOAT16
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f16_z_f64(
+ float64_t trueFunction( float16_t ), float64_t subjFunction( float16_t ) )
+{
+ int count;
+ float64_t trueZ;
+ uint_fast8_t trueFlags;
+ float64_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f64_isNaN( trueZ )
+ || ! f64_isNaN( subjZ )
+ || f64_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( genCases_f16_a, " " );
+ writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_a_f16_z_i32_rx.c b/source/test_a_f16_z_i32_rx.c
new file mode 100644
index 0000000..326bf3d
--- /dev/null
+++ b/source/test_a_f16_z_i32_rx.c
@@ -0,0 +1,104 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f16_z_i32_rx(
+ int_fast32_t trueFunction( float16_t, uint_fast8_t, bool ),
+ int_fast32_t subjFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int count;
+ int_fast32_t trueZ;
+ uint_fast8_t trueFlags;
+ int_fast32_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, roundingMode, exact );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a, roundingMode, exact );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != 0x7FFFFFFF)
+ || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1))
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( genCases_f16_a, " " );
+ writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
diff --git a/source/test_a_f16_z_i32_x.c b/source/test_a_f16_z_i32_x.c
new file mode 100644
index 0000000..217cfae
--- /dev/null
+++ b/source/test_a_f16_z_i32_x.c
@@ -0,0 +1,103 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f16_z_i32_x(
+ int_fast32_t trueFunction( float16_t, bool ),
+ int_fast32_t subjFunction( float16_t, bool ),
+ bool exact
+ )
+{
+ int count;
+ int_fast32_t trueZ;
+ uint_fast8_t trueFlags;
+ int_fast32_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, exact );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a, exact );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != 0x7FFFFFFF)
+ || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1))
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( genCases_f16_a, " " );
+ writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
diff --git a/source/test_a_f16_z_i64_rx.c b/source/test_a_f16_z_i64_rx.c
new file mode 100644
index 0000000..e5b445b
--- /dev/null
+++ b/source/test_a_f16_z_i64_rx.c
@@ -0,0 +1,105 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f16_z_i64_rx(
+ int_fast64_t trueFunction( float16_t, uint_fast8_t, bool ),
+ int_fast64_t subjFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int count;
+ int_fast64_t trueZ;
+ uint_fast8_t trueFlags;
+ int_fast64_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, roundingMode, exact );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a, roundingMode, exact );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != INT64_C( 0x7FFFFFFFFFFFFFFF ))
+ || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF ))
+ && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1))
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( genCases_f16_a, " " );
+ writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
diff --git a/source/test_a_f16_z_i64_x.c b/source/test_a_f16_z_i64_x.c
new file mode 100644
index 0000000..392d747
--- /dev/null
+++ b/source/test_a_f16_z_i64_x.c
@@ -0,0 +1,104 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f16_z_i64_x(
+ int_fast64_t trueFunction( float16_t, bool ),
+ int_fast64_t subjFunction( float16_t, bool ),
+ bool exact
+ )
+{
+ int count;
+ int_fast64_t trueZ;
+ uint_fast8_t trueFlags;
+ int_fast64_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, exact );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a, exact );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != INT64_C( 0x7FFFFFFFFFFFFFFF ))
+ || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF ))
+ && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1))
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( genCases_f16_a, " " );
+ writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
diff --git a/source/test_a_f16_z_ui32_rx.c b/source/test_a_f16_z_ui32_rx.c
new file mode 100644
index 0000000..bb0ed33
--- /dev/null
+++ b/source/test_a_f16_z_ui32_rx.c
@@ -0,0 +1,104 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f16_z_ui32_rx(
+ uint_fast32_t trueFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast32_t subjFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int count;
+ uint_fast32_t trueZ;
+ uint_fast8_t trueFlags;
+ uint_fast32_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, roundingMode, exact );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a, roundingMode, exact );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != 0xFFFFFFFF)
+ || (subjZ != 0xFFFFFFFF)
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( genCases_f16_a, " " );
+ writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
diff --git a/source/test_a_f16_z_ui32_x.c b/source/test_a_f16_z_ui32_x.c
new file mode 100644
index 0000000..42184ba
--- /dev/null
+++ b/source/test_a_f16_z_ui32_x.c
@@ -0,0 +1,103 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f16_z_ui32_x(
+ uint_fast32_t trueFunction( float16_t, bool ),
+ uint_fast32_t subjFunction( float16_t, bool ),
+ bool exact
+ )
+{
+ int count;
+ uint_fast32_t trueZ;
+ uint_fast8_t trueFlags;
+ uint_fast32_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, exact );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a, exact );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != 0xFFFFFFFF)
+ || (subjZ != 0xFFFFFFFF)
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( genCases_f16_a, " " );
+ writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
diff --git a/source/test_a_f16_z_ui64_rx.c b/source/test_a_f16_z_ui64_rx.c
new file mode 100644
index 0000000..1ee7359
--- /dev/null
+++ b/source/test_a_f16_z_ui64_rx.c
@@ -0,0 +1,104 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f16_z_ui64_rx(
+ uint_fast64_t trueFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast64_t subjFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int count;
+ uint_fast64_t trueZ;
+ uint_fast8_t trueFlags;
+ uint_fast64_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, roundingMode, exact );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a, roundingMode, exact );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != 0xFFFFFFFF)
+ || (subjZ != 0xFFFFFFFF)
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( genCases_f16_a, " " );
+ writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
diff --git a/source/test_a_f16_z_ui64_x.c b/source/test_a_f16_z_ui64_x.c
new file mode 100644
index 0000000..1d9b225
--- /dev/null
+++ b/source/test_a_f16_z_ui64_x.c
@@ -0,0 +1,103 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f16_z_ui64_x(
+ uint_fast64_t trueFunction( float16_t, bool ),
+ uint_fast64_t subjFunction( float16_t, bool ),
+ bool exact
+ )
+{
+ int count;
+ uint_fast64_t trueZ;
+ uint_fast8_t trueFlags;
+ uint_fast64_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, exact );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a, exact );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != 0xFFFFFFFF)
+ || (subjZ != 0xFFFFFFFF)
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( genCases_f16_a, " " );
+ writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
diff --git a/source/test_a_f32_z_extF80.c b/source/test_a_f32_z_extF80.c
index 594aaaf..8a4fd51 100644
--- a/source/test_a_f32_z_extF80.c
+++ b/source/test_a_f32_z_extF80.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f32_z_f128.c b/source/test_a_f32_z_f128.c
index 67f13a3..06b9d2c 100644
--- a/source/test_a_f32_z_f128.c
+++ b/source/test_a_f32_z_f128.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f32_z_f16.c b/source/test_a_f32_z_f16.c
new file mode 100644
index 0000000..8aba974
--- /dev/null
+++ b/source/test_a_f32_z_f16.c
@@ -0,0 +1,104 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#ifdef FLOAT16
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f32_z_f16(
+ float16_t trueFunction( float32_t ), float16_t subjFunction( float32_t ) )
+{
+ int count;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f32_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f32_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f32_a );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f32_a );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f32_isSignalingNaN( genCases_f32_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f32( genCases_f32_a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_a_f32_z_f64.c b/source/test_a_f32_z_f64.c
index 93110b9..895fcf0 100644
--- a/source/test_a_f32_z_f64.c
+++ b/source/test_a_f32_z_f64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f32_z_i32_rx.c b/source/test_a_f32_z_i32_rx.c
index 2d3253e..2d09367 100644
--- a/source/test_a_f32_z_i32_rx.c
+++ b/source/test_a_f32_z_i32_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f32_z_i32_x.c b/source/test_a_f32_z_i32_x.c
index c52581f..5b231cf 100644
--- a/source/test_a_f32_z_i32_x.c
+++ b/source/test_a_f32_z_i32_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f32_z_i64_rx.c b/source/test_a_f32_z_i64_rx.c
index c64f641..2a46473 100644
--- a/source/test_a_f32_z_i64_rx.c
+++ b/source/test_a_f32_z_i64_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f32_z_i64_x.c b/source/test_a_f32_z_i64_x.c
index e2497e6..a226906 100644
--- a/source/test_a_f32_z_i64_x.c
+++ b/source/test_a_f32_z_i64_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f32_z_ui32_rx.c b/source/test_a_f32_z_ui32_rx.c
index edff170..1d60af7 100644
--- a/source/test_a_f32_z_ui32_rx.c
+++ b/source/test_a_f32_z_ui32_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f32_z_ui32_x.c b/source/test_a_f32_z_ui32_x.c
index 3c2b583..0ef3daf 100644
--- a/source/test_a_f32_z_ui32_x.c
+++ b/source/test_a_f32_z_ui32_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f32_z_ui64_rx.c b/source/test_a_f32_z_ui64_rx.c
index dc2d885..8e885c4 100644
--- a/source/test_a_f32_z_ui64_rx.c
+++ b/source/test_a_f32_z_ui64_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f32_z_ui64_x.c b/source/test_a_f32_z_ui64_x.c
index 72af38f..00dc606 100644
--- a/source/test_a_f32_z_ui64_x.c
+++ b/source/test_a_f32_z_ui64_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f64_z_extF80.c b/source/test_a_f64_z_extF80.c
index d18398e..e844f43 100644
--- a/source/test_a_f64_z_extF80.c
+++ b/source/test_a_f64_z_extF80.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f64_z_f128.c b/source/test_a_f64_z_f128.c
index a4c27fc..5a37a5a 100644
--- a/source/test_a_f64_z_f128.c
+++ b/source/test_a_f64_z_f128.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f64_z_f16.c b/source/test_a_f64_z_f16.c
new file mode 100644
index 0000000..faafce6
--- /dev/null
+++ b/source/test_a_f64_z_f16.c
@@ -0,0 +1,104 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#ifdef FLOAT16
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_f64_z_f16(
+ float16_t trueFunction( float64_t ), float16_t subjFunction( float64_t ) )
+{
+ int count;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f64_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f64_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f64_a );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f64_a );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f64_isSignalingNaN( genCases_f64_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f64( genCases_f64_a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_a_f64_z_f32.c b/source/test_a_f64_z_f32.c
index b40b5a6..8239f59 100644
--- a/source/test_a_f64_z_f32.c
+++ b/source/test_a_f64_z_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f64_z_i32_rx.c b/source/test_a_f64_z_i32_rx.c
index a960234..fe692d1 100644
--- a/source/test_a_f64_z_i32_rx.c
+++ b/source/test_a_f64_z_i32_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f64_z_i32_x.c b/source/test_a_f64_z_i32_x.c
index 3eadc59..818dd0a 100644
--- a/source/test_a_f64_z_i32_x.c
+++ b/source/test_a_f64_z_i32_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f64_z_i64_rx.c b/source/test_a_f64_z_i64_rx.c
index 71a03f6..99455cb 100644
--- a/source/test_a_f64_z_i64_rx.c
+++ b/source/test_a_f64_z_i64_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f64_z_i64_x.c b/source/test_a_f64_z_i64_x.c
index e04e71d..42ebd62 100644
--- a/source/test_a_f64_z_i64_x.c
+++ b/source/test_a_f64_z_i64_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f64_z_ui32_rx.c b/source/test_a_f64_z_ui32_rx.c
index f41038f..e627b02 100644
--- a/source/test_a_f64_z_ui32_rx.c
+++ b/source/test_a_f64_z_ui32_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f64_z_ui32_x.c b/source/test_a_f64_z_ui32_x.c
index 234bd18..941ba75 100644
--- a/source/test_a_f64_z_ui32_x.c
+++ b/source/test_a_f64_z_ui32_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f64_z_ui64_rx.c b/source/test_a_f64_z_ui64_rx.c
index 2d5e4d0..9520417 100644
--- a/source/test_a_f64_z_ui64_rx.c
+++ b/source/test_a_f64_z_ui64_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_f64_z_ui64_x.c b/source/test_a_f64_z_ui64_x.c
index 3d6e12e..5af2a02 100644
--- a/source/test_a_f64_z_ui64_x.c
+++ b/source/test_a_f64_z_ui64_x.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_i32_z_extF80.c b/source/test_a_i32_z_extF80.c
index f0d0370..3b2b3e2 100644
--- a/source/test_a_i32_z_extF80.c
+++ b/source/test_a_i32_z_extF80.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_i32_z_f128.c b/source/test_a_i32_z_f128.c
index 692ef91..0053c81 100644
--- a/source/test_a_i32_z_f128.c
+++ b/source/test_a_i32_z_f128.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_i32_z_f16.c b/source/test_a_i32_z_f16.c
new file mode 100644
index 0000000..9e3218e
--- /dev/null
+++ b/source/test_a_i32_z_f16.c
@@ -0,0 +1,99 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#ifdef FLOAT16
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_i32_z_f16(
+ float16_t trueFunction( int32_t ), float16_t subjFunction( int32_t ) )
+{
+ int count;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_i32_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_i32_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_i32_a );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_i32_a );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_i32( genCases_i32_a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_a_i32_z_f32.c b/source/test_a_i32_z_f32.c
index 6e20978..4b9ac1e 100644
--- a/source/test_a_i32_z_f32.c
+++ b/source/test_a_i32_z_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_i32_z_f64.c b/source/test_a_i32_z_f64.c
index 3c6d827..f526772 100644
--- a/source/test_a_i32_z_f64.c
+++ b/source/test_a_i32_z_f64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_i64_z_extF80.c b/source/test_a_i64_z_extF80.c
index 66d2974..f729c29 100644
--- a/source/test_a_i64_z_extF80.c
+++ b/source/test_a_i64_z_extF80.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_i64_z_f128.c b/source/test_a_i64_z_f128.c
index 3b5e3db..6b0f57e 100644
--- a/source/test_a_i64_z_f128.c
+++ b/source/test_a_i64_z_f128.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_i64_z_f16.c b/source/test_a_i64_z_f16.c
new file mode 100644
index 0000000..c775908
--- /dev/null
+++ b/source/test_a_i64_z_f16.c
@@ -0,0 +1,99 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#ifdef FLOAT16
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_i64_z_f16(
+ float16_t trueFunction( int64_t ), float16_t subjFunction( int64_t ) )
+{
+ int count;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_i64_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_i64_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_i64_a );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_i64_a );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_i64( genCases_i64_a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_a_i64_z_f32.c b/source/test_a_i64_z_f32.c
index c1a823d..794d6df 100644
--- a/source/test_a_i64_z_f32.c
+++ b/source/test_a_i64_z_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_i64_z_f64.c b/source/test_a_i64_z_f64.c
index 605ba7f..8788494 100644
--- a/source/test_a_i64_z_f64.c
+++ b/source/test_a_i64_z_f64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_ui32_z_extF80.c b/source/test_a_ui32_z_extF80.c
index 227646a..701fd86 100644
--- a/source/test_a_ui32_z_extF80.c
+++ b/source/test_a_ui32_z_extF80.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_ui32_z_f128.c b/source/test_a_ui32_z_f128.c
index 6429f2c..a1505d7 100644
--- a/source/test_a_ui32_z_f128.c
+++ b/source/test_a_ui32_z_f128.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_ui32_z_f16.c b/source/test_a_ui32_z_f16.c
new file mode 100644
index 0000000..149c1b4
--- /dev/null
+++ b/source/test_a_ui32_z_f16.c
@@ -0,0 +1,99 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#ifdef FLOAT16
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_ui32_z_f16(
+ float16_t trueFunction( uint32_t ), float16_t subjFunction( uint32_t ) )
+{
+ int count;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_ui32_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_ui32_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_ui32_a );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_ui32_a );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_ui32( genCases_ui32_a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_a_ui32_z_f32.c b/source/test_a_ui32_z_f32.c
index ee789e7..82710a3 100644
--- a/source/test_a_ui32_z_f32.c
+++ b/source/test_a_ui32_z_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_ui32_z_f64.c b/source/test_a_ui32_z_f64.c
index bbee48c..c47cba8 100644
--- a/source/test_a_ui32_z_f64.c
+++ b/source/test_a_ui32_z_f64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_ui64_z_extF80.c b/source/test_a_ui64_z_extF80.c
index bcd687f..8e84802 100644
--- a/source/test_a_ui64_z_extF80.c
+++ b/source/test_a_ui64_z_extF80.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_ui64_z_f128.c b/source/test_a_ui64_z_f128.c
index f9d9cab..9e5c346 100644
--- a/source/test_a_ui64_z_f128.c
+++ b/source/test_a_ui64_z_f128.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_ui64_z_f16.c b/source/test_a_ui64_z_f16.c
new file mode 100644
index 0000000..2b74134
--- /dev/null
+++ b/source/test_a_ui64_z_f16.c
@@ -0,0 +1,99 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#ifdef FLOAT16
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_a_ui64_z_f16(
+ float16_t trueFunction( uint64_t ), float16_t subjFunction( uint64_t ) )
+{
+ int count;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_ui64_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_ui64_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_ui64_a );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_ui64_a );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_ui64( genCases_ui64_a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_a_ui64_z_f32.c b/source/test_a_ui64_z_f32.c
index 7f612fb..e9818d5 100644
--- a/source/test_a_ui64_z_f32.c
+++ b/source/test_a_ui64_z_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_a_ui64_z_f64.c b/source/test_a_ui64_z_f64.c
index 22964af..e194060 100644
--- a/source/test_a_ui64_z_f64.c
+++ b/source/test_a_ui64_z_f64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_ab_extF80_z_bool.c b/source/test_ab_extF80_z_bool.c
index f101726..8a04c32 100644
--- a/source/test_ab_extF80_z_bool.c
+++ b/source/test_ab_extF80_z_bool.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_ab_f128_z_bool.c b/source/test_ab_f128_z_bool.c
index 029b83a..49187ef 100644
--- a/source/test_ab_f128_z_bool.c
+++ b/source/test_ab_f128_z_bool.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_ab_f16_z_bool.c b/source/test_ab_f16_z_bool.c
new file mode 100644
index 0000000..2424d38
--- /dev/null
+++ b/source/test_ab_f16_z_bool.c
@@ -0,0 +1,103 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#ifdef FLOAT16
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_ab_f16_z_bool(
+ bool trueFunction( float16_t, float16_t ),
+ bool subjFunction( float16_t, float16_t )
+ )
+{
+ int count;
+ bool trueZ;
+ uint_fast8_t trueFlags;
+ bool subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_ab_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_ab_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, genCases_f16_b );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a, genCases_f16_b );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs
+ && (f16_isSignalingNaN( genCases_f16_a )
+ || f16_isSignalingNaN( genCases_f16_b ))
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_ab_f16( genCases_f16_a, genCases_f16_b, " " );
+ writeCase_z_bool( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_ab_f32_z_bool.c b/source/test_ab_f32_z_bool.c
index 30ca986..0cf4da4 100644
--- a/source/test_ab_f32_z_bool.c
+++ b/source/test_ab_f32_z_bool.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_ab_f64_z_bool.c b/source/test_ab_f64_z_bool.c
index 2dbdc0a..d239996 100644
--- a/source/test_ab_f64_z_bool.c
+++ b/source/test_ab_f64_z_bool.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_abcz_f128.c b/source/test_abcz_f128.c
index aae1e59..bffdec3 100644
--- a/source/test_abcz_f128.c
+++ b/source/test_abcz_f128.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_abcz_f16.c b/source/test_abcz_f16.c
new file mode 100644
index 0000000..87945db
--- /dev/null
+++ b/source/test_abcz_f16.c
@@ -0,0 +1,111 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#ifdef FLOAT16
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_abcz_f16(
+ float16_t trueFunction( float16_t, float16_t, float16_t ),
+ float16_t subjFunction( float16_t, float16_t, float16_t )
+ )
+{
+ int count;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_abc_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_abc_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, genCases_f16_b, genCases_f16_c );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a, genCases_f16_b, genCases_f16_c );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs
+ && ( f16_isSignalingNaN( genCases_f16_a )
+ || f16_isSignalingNaN( genCases_f16_b )
+ || f16_isSignalingNaN( genCases_f16_c )
+ )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_abc_f16(
+ genCases_f16_a, genCases_f16_b, genCases_f16_c, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_abcz_f32.c b/source/test_abcz_f32.c
index 1b270e8..1b06deb 100644
--- a/source/test_abcz_f32.c
+++ b/source/test_abcz_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_abcz_f64.c b/source/test_abcz_f64.c
index 00e06cd..ce34e7c 100644
--- a/source/test_abcz_f64.c
+++ b/source/test_abcz_f64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_abz_extF80.c b/source/test_abz_extF80.c
index e131496..c697dbe 100644
--- a/source/test_abz_extF80.c
+++ b/source/test_abz_extF80.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_abz_f128.c b/source/test_abz_f128.c
index 957da36..46b9333 100644
--- a/source/test_abz_f128.c
+++ b/source/test_abz_f128.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_abz_f16.c b/source/test_abz_f16.c
new file mode 100644
index 0000000..5220788
--- /dev/null
+++ b/source/test_abz_f16.c
@@ -0,0 +1,108 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#ifdef FLOAT16
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_abz_f16(
+ float16_t trueFunction( float16_t, float16_t ),
+ float16_t subjFunction( float16_t, float16_t )
+ )
+{
+ int count;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_ab_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_ab_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, genCases_f16_b );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a, genCases_f16_b );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs
+ && (f16_isSignalingNaN( genCases_f16_a )
+ || f16_isSignalingNaN( genCases_f16_b ))
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_ab_f16( genCases_f16_a, genCases_f16_b, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_abz_f32.c b/source/test_abz_f32.c
index eb9955d..1d57bb7 100644
--- a/source/test_abz_f32.c
+++ b/source/test_abz_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_abz_f64.c b/source/test_abz_f64.c
index 0d7130a..9b7c517 100644
--- a/source/test_abz_f64.c
+++ b/source/test_abz_f64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_az_extF80.c b/source/test_az_extF80.c
index fc50198..4469628 100644
--- a/source/test_az_extF80.c
+++ b/source/test_az_extF80.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_az_extF80_rx.c b/source/test_az_extF80_rx.c
index f631e9f..2f754c4 100644
--- a/source/test_az_extF80_rx.c
+++ b/source/test_az_extF80_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_az_f128.c b/source/test_az_f128.c
index 1d1afd0..9ea38c3 100644
--- a/source/test_az_f128.c
+++ b/source/test_az_f128.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_az_f128_rx.c b/source/test_az_f128_rx.c
index 2590bd6..5335490 100644
--- a/source/test_az_f128_rx.c
+++ b/source/test_az_f128_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_az_f16.c b/source/test_az_f16.c
new file mode 100644
index 0000000..a5f34f4
--- /dev/null
+++ b/source/test_az_f16.c
@@ -0,0 +1,104 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#ifdef FLOAT16
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_az_f16(
+ float16_t trueFunction( float16_t ), float16_t subjFunction( float16_t ) )
+{
+ int count;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( genCases_f16_a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_az_f16_rx.c b/source/test_az_f16_rx.c
new file mode 100644
index 0000000..a919fc3
--- /dev/null
+++ b/source/test_az_f16_rx.c
@@ -0,0 +1,109 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "genCases.h"
+#include "verCases.h"
+#include "writeCase.h"
+#include "testLoops.h"
+
+#ifdef FLOAT16
+
+#pragma STDC FENV_ACCESS ON
+
+void
+ test_az_f16_rx(
+ float16_t trueFunction( float16_t, uint_fast8_t, bool ),
+ float16_t subjFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int count;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+
+ genCases_f16_a_init();
+ genCases_writeTestsTotal( testLoops_forever );
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! genCases_done || testLoops_forever ) {
+ genCases_f16_a_next();
+ *testLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( genCases_f16_a, roundingMode, exact );
+ trueFlags = *testLoops_trueFlagsPtr;
+ testLoops_subjFlagsFunction();
+ subjZ = subjFunction( genCases_f16_a, roundingMode, exact );
+ subjFlags = testLoops_subjFlagsFunction();
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a )
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( genCases_f16_a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
diff --git a/source/test_az_f32.c b/source/test_az_f32.c
index 14be1ae..a76ae05 100644
--- a/source/test_az_f32.c
+++ b/source/test_az_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_az_f32_rx.c b/source/test_az_f32_rx.c
index ac8e6c9..2b2892f 100644
--- a/source/test_az_f32_rx.c
+++ b/source/test_az_f32_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_az_f64.c b/source/test_az_f64.c
index 2c72909..e6e0d63 100644
--- a/source/test_az_f64.c
+++ b/source/test_az_f64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/test_az_f64_rx.c b/source/test_az_f64_rx.c
index d19fa10..fcab07d 100644
--- a/source/test_az_f64_rx.c
+++ b/source/test_az_f64_rx.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/testfloat.c b/source/testfloat.c
index 96258ec..f58cf53 100644
--- a/source/testfloat.c
+++ b/source/testfloat.c
@@ -1,11 +1,11 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
California. All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -61,6 +61,9 @@ static void catchSIGINT( int signalCode )
static void (*subjFunctionPtr)();
+#ifdef FLOAT16
+typedef float16_t funcType_a_ui32_z_f16( uint32_t );
+#endif
typedef float32_t funcType_a_ui32_z_f32( uint32_t );
typedef float64_t funcType_a_ui32_z_f64( uint32_t );
#ifdef EXTFLOAT80
@@ -69,6 +72,9 @@ typedef void funcType_a_ui32_z_extF80( uint32_t, extFloat80_t * );
#ifdef FLOAT128
typedef void funcType_a_ui32_z_f128( uint32_t, float128_t * );
#endif
+#ifdef FLOAT16
+typedef float16_t funcType_a_ui64_z_f16( uint64_t );
+#endif
typedef float32_t funcType_a_ui64_z_f32( uint64_t );
typedef float64_t funcType_a_ui64_z_f64( uint64_t );
#ifdef EXTFLOAT80
@@ -77,6 +83,9 @@ typedef void funcType_a_ui64_z_extF80( uint64_t, extFloat80_t * );
#ifdef FLOAT128
typedef void funcType_a_ui64_z_f128( uint64_t, float128_t * );
#endif
+#ifdef FLOAT16
+typedef float16_t funcType_a_i32_z_f16( int32_t );
+#endif
typedef float32_t funcType_a_i32_z_f32( int32_t );
typedef float64_t funcType_a_i32_z_f64( int32_t );
#ifdef EXTFLOAT80
@@ -85,6 +94,9 @@ typedef void funcType_a_i32_z_extF80( int32_t, extFloat80_t * );
#ifdef FLOAT128
typedef void funcType_a_i32_z_f128( int32_t, float128_t * );
#endif
+#ifdef FLOAT16
+typedef float16_t funcType_a_i64_z_f16( int64_t );
+#endif
typedef float32_t funcType_a_i64_z_f32( int64_t );
typedef float64_t funcType_a_i64_z_f64( int64_t );
#ifdef EXTFLOAT80
@@ -94,10 +106,32 @@ typedef void funcType_a_i64_z_extF80( int64_t, extFloat80_t * );
typedef void funcType_a_i64_z_f128( int64_t, float128_t * );
#endif
+#ifdef FLOAT16
+typedef uint_fast32_t funcType_a_f16_z_ui32( float16_t );
+typedef uint_fast64_t funcType_a_f16_z_ui64( float16_t );
+typedef int_fast32_t funcType_a_f16_z_i32( float16_t );
+typedef int_fast64_t funcType_a_f16_z_i64( float16_t );
+typedef float32_t funcType_a_f16_z_f32( float16_t );
+typedef float64_t funcType_a_f16_z_f64( float16_t );
+#ifdef EXTFLOAT80
+typedef void funcType_a_f16_z_extF80( float16_t, extFloat80_t * );
+#endif
+#ifdef FLOAT128
+typedef void funcType_a_f16_z_f128( float16_t, float128_t * );
+#endif
+typedef float16_t funcType_az_f16( float16_t );
+typedef float16_t funcType_abz_f16( float16_t, float16_t );
+typedef float16_t funcType_abcz_f16( float16_t, float16_t, float16_t );
+typedef bool funcType_ab_f16_z_bool( float16_t, float16_t );
+#endif
+
typedef uint_fast32_t funcType_a_f32_z_ui32( float32_t );
typedef uint_fast64_t funcType_a_f32_z_ui64( float32_t );
typedef int_fast32_t funcType_a_f32_z_i32( float32_t );
typedef int_fast64_t funcType_a_f32_z_i64( float32_t );
+#ifdef FLOAT16
+typedef float16_t funcType_a_f32_z_f16( float32_t );
+#endif
typedef float64_t funcType_a_f32_z_f64( float32_t );
#ifdef EXTFLOAT80
typedef void funcType_a_f32_z_extF80( float32_t, extFloat80_t * );
@@ -114,6 +148,9 @@ typedef uint_fast32_t funcType_a_f64_z_ui32( float64_t );
typedef uint_fast64_t funcType_a_f64_z_ui64( float64_t );
typedef int_fast32_t funcType_a_f64_z_i32( float64_t );
typedef int_fast64_t funcType_a_f64_z_i64( float64_t );
+#ifdef FLOAT16
+typedef float16_t funcType_a_f64_z_f16( float64_t );
+#endif
typedef float32_t funcType_a_f64_z_f32( float64_t );
#ifdef EXTFLOAT80
typedef void funcType_a_f64_z_extF80( float64_t, extFloat80_t * );
@@ -131,6 +168,9 @@ typedef uint_fast32_t funcType_a_extF80_z_ui32( const extFloat80_t * );
typedef uint_fast64_t funcType_a_extF80_z_ui64( const extFloat80_t * );
typedef int_fast32_t funcType_a_extF80_z_i32( const extFloat80_t * );
typedef int_fast64_t funcType_a_extF80_z_i64( const extFloat80_t * );
+#ifdef FLOAT16
+typedef float16_t funcType_a_extF80_z_f16( const extFloat80_t * );
+#endif
typedef float32_t funcType_a_extF80_z_f32( const extFloat80_t * );
typedef float64_t funcType_a_extF80_z_f64( const extFloat80_t * );
#ifdef FLOAT128
@@ -150,6 +190,9 @@ typedef uint_fast32_t funcType_a_f128_z_ui32( const float128_t * );
typedef uint_fast64_t funcType_a_f128_z_ui64( const float128_t * );
typedef int_fast32_t funcType_a_f128_z_i32( const float128_t * );
typedef int_fast64_t funcType_a_f128_z_i64( const float128_t * );
+#ifdef FLOAT16
+typedef float16_t funcType_a_f128_z_f16( const float128_t * );
+#endif
typedef float32_t funcType_a_f128_z_f32( const float128_t * );
typedef float64_t funcType_a_f128_z_f64( const float128_t * );
#ifdef EXTFLOAT80
@@ -167,10 +210,63 @@ typedef
typedef bool funcType_ab_f128_z_bool( const float128_t *, const float128_t * );
#endif
+#ifdef FLOAT16
+
+static
+uint_fast32_t
+ subjFunction_a_f16_z_ui32_rx(
+ float16_t a, uint_fast8_t roundingMode, bool exact )
+{
+
+ return ((funcType_a_f16_z_ui32 *) subjFunctionPtr)( a );
+
+}
+
static
- uint_fast32_t
- subjFunction_a_f32_z_ui32_rx(
- float32_t a, uint_fast8_t roundingMode, bool exact )
+uint_fast64_t
+ subjFunction_a_f16_z_ui64_rx(
+ float16_t a, uint_fast8_t roundingMode, bool exact )
+{
+
+ return ((funcType_a_f16_z_ui64 *) subjFunctionPtr)( a );
+
+}
+
+static
+int_fast32_t
+ subjFunction_a_f16_z_i32_rx(
+ float16_t a, uint_fast8_t roundingMode, bool exact )
+{
+
+ return ((funcType_a_f16_z_i32 *) subjFunctionPtr)( a );
+
+}
+
+static
+int_fast64_t
+ subjFunction_a_f16_z_i64_rx(
+ float16_t a, uint_fast8_t roundingMode, bool exact )
+{
+
+ return ((funcType_a_f16_z_i64 *) subjFunctionPtr)( a );
+
+}
+
+static
+float16_t
+ subjFunction_az_f16_rx( float16_t a, uint_fast8_t roundingMode, bool exact )
+{
+
+ return ((funcType_az_f16 *) subjFunctionPtr)( a );
+
+}
+
+#endif
+
+static
+uint_fast32_t
+ subjFunction_a_f32_z_ui32_rx(
+ float32_t a, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_f32_z_ui32 *) subjFunctionPtr)( a );
@@ -178,9 +274,9 @@ static
}
static
- uint_fast64_t
- subjFunction_a_f32_z_ui64_rx(
- float32_t a, uint_fast8_t roundingMode, bool exact )
+uint_fast64_t
+ subjFunction_a_f32_z_ui64_rx(
+ float32_t a, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_f32_z_ui64 *) subjFunctionPtr)( a );
@@ -188,9 +284,9 @@ static
}
static
- int_fast32_t
- subjFunction_a_f32_z_i32_rx(
- float32_t a, uint_fast8_t roundingMode, bool exact )
+int_fast32_t
+ subjFunction_a_f32_z_i32_rx(
+ float32_t a, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_f32_z_i32 *) subjFunctionPtr)( a );
@@ -198,9 +294,9 @@ static
}
static
- int_fast64_t
- subjFunction_a_f32_z_i64_rx(
- float32_t a, uint_fast8_t roundingMode, bool exact )
+int_fast64_t
+ subjFunction_a_f32_z_i64_rx(
+ float32_t a, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_f32_z_i64 *) subjFunctionPtr)( a );
@@ -208,8 +304,8 @@ static
}
static
- float32_t
- subjFunction_az_f32_rx( float32_t a, uint_fast8_t roundingMode, bool exact )
+float32_t
+ subjFunction_az_f32_rx( float32_t a, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_az_f32 *) subjFunctionPtr)( a );
@@ -217,9 +313,9 @@ static
}
static
- uint_fast32_t
- subjFunction_a_f64_z_ui32_rx(
- float64_t a, uint_fast8_t roundingMode, bool exact )
+uint_fast32_t
+ subjFunction_a_f64_z_ui32_rx(
+ float64_t a, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_f64_z_ui32 *) subjFunctionPtr)( a );
@@ -227,9 +323,9 @@ static
}
static
- uint_fast64_t
- subjFunction_a_f64_z_ui64_rx(
- float64_t a, uint_fast8_t roundingMode, bool exact )
+uint_fast64_t
+ subjFunction_a_f64_z_ui64_rx(
+ float64_t a, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_f64_z_ui64 *) subjFunctionPtr)( a );
@@ -237,9 +333,9 @@ static
}
static
- int_fast32_t
- subjFunction_a_f64_z_i32_rx(
- float64_t a, uint_fast8_t roundingMode, bool exact )
+int_fast32_t
+ subjFunction_a_f64_z_i32_rx(
+ float64_t a, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_f64_z_i32 *) subjFunctionPtr)( a );
@@ -247,9 +343,9 @@ static
}
static
- int_fast64_t
- subjFunction_a_f64_z_i64_rx(
- float64_t a, uint_fast8_t roundingMode, bool exact )
+int_fast64_t
+ subjFunction_a_f64_z_i64_rx(
+ float64_t a, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_f64_z_i64 *) subjFunctionPtr)( a );
@@ -257,8 +353,8 @@ static
}
static
- float64_t
- subjFunction_az_f64_rx( float64_t a, uint_fast8_t roundingMode, bool exact )
+float64_t
+ subjFunction_az_f64_rx( float64_t a, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_az_f64 *) subjFunctionPtr)( a );
@@ -268,9 +364,9 @@ static
#ifdef EXTFLOAT80
static
- uint_fast32_t
- subjFunction_a_extF80_z_ui32_rx(
- const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact )
+uint_fast32_t
+ subjFunction_a_extF80_z_ui32_rx(
+ const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_extF80_z_ui32 *) subjFunctionPtr)( aPtr );
@@ -278,9 +374,9 @@ static
}
static
- uint_fast64_t
- subjFunction_a_extF80_z_ui64_rx(
- const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact )
+uint_fast64_t
+ subjFunction_a_extF80_z_ui64_rx(
+ const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_extF80_z_ui64 *) subjFunctionPtr)( aPtr );
@@ -288,9 +384,9 @@ static
}
static
- int_fast32_t
- subjFunction_a_extF80_z_i32_rx(
- const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact )
+int_fast32_t
+ subjFunction_a_extF80_z_i32_rx(
+ const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_extF80_z_i32 *) subjFunctionPtr)( aPtr );
@@ -298,9 +394,9 @@ static
}
static
- int_fast64_t
- subjFunction_a_extF80_z_i64_rx(
- const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact )
+int_fast64_t
+ subjFunction_a_extF80_z_i64_rx(
+ const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_extF80_z_i64 *) subjFunctionPtr)( aPtr );
@@ -308,13 +404,13 @@ static
}
static
- void
- subjFunction_az_extF80_rx(
- const extFloat80_t *aPtr,
- uint_fast8_t roundingMode,
- bool exact,
- extFloat80_t *zPtr
- )
+void
+ subjFunction_az_extF80_rx(
+ const extFloat80_t *aPtr,
+ uint_fast8_t roundingMode,
+ bool exact,
+ extFloat80_t *zPtr
+ )
{
return ((funcType_az_extF80 *) subjFunctionPtr)( aPtr, zPtr );
@@ -326,9 +422,9 @@ static
#ifdef FLOAT128
static
- uint_fast32_t
- subjFunction_a_f128_z_ui32_rx(
- const float128_t *aPtr, uint_fast8_t roundingMode, bool exact )
+uint_fast32_t
+ subjFunction_a_f128_z_ui32_rx(
+ const float128_t *aPtr, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_f128_z_ui32 *) subjFunctionPtr)( aPtr );
@@ -336,9 +432,9 @@ static
}
static
- uint_fast64_t
- subjFunction_a_f128_z_ui64_rx(
- const float128_t *aPtr, uint_fast8_t roundingMode, bool exact )
+uint_fast64_t
+ subjFunction_a_f128_z_ui64_rx(
+ const float128_t *aPtr, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_f128_z_ui64 *) subjFunctionPtr)( aPtr );
@@ -346,9 +442,9 @@ static
}
static
- int_fast32_t
- subjFunction_a_f128_z_i32_rx(
- const float128_t *aPtr, uint_fast8_t roundingMode, bool exact )
+int_fast32_t
+ subjFunction_a_f128_z_i32_rx(
+ const float128_t *aPtr, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_f128_z_i32 *) subjFunctionPtr)( aPtr );
@@ -356,9 +452,9 @@ static
}
static
- int_fast64_t
- subjFunction_a_f128_z_i64_rx(
- const float128_t *aPtr, uint_fast8_t roundingMode, bool exact )
+int_fast64_t
+ subjFunction_a_f128_z_i64_rx(
+ const float128_t *aPtr, uint_fast8_t roundingMode, bool exact )
{
return ((funcType_a_f128_z_i64 *) subjFunctionPtr)( aPtr );
@@ -366,13 +462,13 @@ static
}
static
- void
- subjFunction_az_f128_rx(
- const float128_t *aPtr,
- uint_fast8_t roundingMode,
- bool exact,
- float128_t *zPtr
- )
+void
+ subjFunction_az_f128_rx(
+ const float128_t *aPtr,
+ uint_fast8_t roundingMode,
+ bool exact,
+ float128_t *zPtr
+ )
{
return ((funcType_az_f128 *) subjFunctionPtr)( aPtr, zPtr );
@@ -382,10 +478,14 @@ static
#endif
static
- void
- testFunctionInstance(
- int functionCode, uint_fast8_t roundingMode, bool exact )
+void
+ testFunctionInstance(
+ int functionCode, uint_fast8_t roundingMode, bool exact )
{
+#ifdef FLOAT16
+ funcType_abz_f16 *trueFunction_abz_f16;
+ funcType_ab_f16_z_bool *trueFunction_ab_f16_z_bool;
+#endif
funcType_abz_f32 *trueFunction_abz_f32;
funcType_ab_f32_z_bool *trueFunction_ab_f32_z_bool;
funcType_abz_f64 *trueFunction_abz_f64;
@@ -405,6 +505,14 @@ static
switch ( functionCode ) {
/*--------------------------------------------------------------------
*--------------------------------------------------------------------*/
+#ifdef FLOAT16
+#ifdef SUBJ_UI32_TO_F16
+ case UI32_TO_F16:
+ test_a_ui32_z_f16(
+ ui32_to_f16, (funcType_a_ui32_z_f16 *) subjFunctionPtr );
+ break;
+#endif
+#endif
#ifdef SUBJ_UI32_TO_F32
case UI32_TO_F32:
test_a_ui32_z_f32(
@@ -433,6 +541,14 @@ static
break;
#endif
#endif
+#ifdef FLOAT16
+#ifdef SUBJ_UI64_TO_F16
+ case UI64_TO_F16:
+ test_a_ui64_z_f16(
+ ui64_to_f16, (funcType_a_ui64_z_f16 *) subjFunctionPtr );
+ break;
+#endif
+#endif
#ifdef SUBJ_UI64_TO_F32
case UI64_TO_F32:
test_a_ui64_z_f32(
@@ -461,6 +577,14 @@ static
break;
#endif
#endif
+#ifdef FLOAT16
+#ifdef SUBJ_I32_TO_F16
+ case I32_TO_F16:
+ test_a_i32_z_f16(
+ i32_to_f16, (funcType_a_i32_z_f16 *) subjFunctionPtr );
+ break;
+#endif
+#endif
#ifdef SUBJ_I32_TO_F32
case I32_TO_F32:
test_a_i32_z_f32(
@@ -489,6 +613,14 @@ static
break;
#endif
#endif
+#ifdef FLOAT16
+#ifdef SUBJ_I64_TO_F16
+ case I64_TO_F16:
+ test_a_i64_z_f16(
+ i64_to_f16, (funcType_a_i64_z_f16 *) subjFunctionPtr );
+ break;
+#endif
+#endif
#ifdef SUBJ_I64_TO_F32
case I64_TO_F32:
test_a_i64_z_f32(
@@ -519,6 +651,133 @@ static
#endif
/*--------------------------------------------------------------------
*--------------------------------------------------------------------*/
+#ifdef FLOAT16
+ case F16_TO_UI32:
+ test_a_f16_z_ui32_rx(
+ f16_to_ui32, subjFunction_a_f16_z_ui32_rx, roundingMode, exact );
+ break;
+ case F16_TO_UI64:
+ test_a_f16_z_ui64_rx(
+ f16_to_ui64, subjFunction_a_f16_z_ui64_rx, roundingMode, exact );
+ break;
+ case F16_TO_I32:
+ test_a_f16_z_i32_rx(
+ f16_to_i32, subjFunction_a_f16_z_i32_rx, roundingMode, exact );
+ break;
+ case F16_TO_I64:
+ test_a_f16_z_i64_rx(
+ f16_to_i64, subjFunction_a_f16_z_i64_rx, roundingMode, exact );
+ break;
+#ifdef SUBJ_F16_TO_F32
+ case F16_TO_F32:
+ test_a_f16_z_f32(
+ f16_to_f32, (funcType_a_f16_z_f32 *) subjFunctionPtr );
+ break;
+#endif
+#ifdef SUBJ_F16_TO_F64
+ case F16_TO_F64:
+ test_a_f16_z_f64(
+ f16_to_f64, (funcType_a_f16_z_f64 *) subjFunctionPtr );
+ break;
+#endif
+#ifdef EXTFLOAT80
+#ifdef SUBJ_F16_TO_EXTF80
+ case F16_TO_EXTF80:
+ test_a_f16_z_extF80(
+ f16_to_extF80M, (funcType_a_f16_z_extF80 *) subjFunctionPtr );
+ break;
+#endif
+#endif
+#ifdef FLOAT128
+#ifdef SUBJ_F16_TO_F128
+ case F16_TO_F128:
+ test_a_f16_z_f128(
+ f16_to_f128M, (funcType_a_f16_z_f128 *) subjFunctionPtr );
+ break;
+#endif
+#endif
+ case F16_ROUNDTOINT:
+ test_az_f16_rx(
+ f16_roundToInt, subjFunction_az_f16_rx, roundingMode, exact );
+ break;
+#ifdef SUBJ_F16_ADD
+ case F16_ADD:
+ trueFunction_abz_f16 = f16_add;
+ goto test_abz_f16;
+#endif
+#ifdef SUBJ_F16_SUB
+ case F16_SUB:
+ trueFunction_abz_f16 = f16_sub;
+ goto test_abz_f16;
+#endif
+#ifdef SUBJ_F16_MUL
+ case F16_MUL:
+ trueFunction_abz_f16 = f16_mul;
+ goto test_abz_f16;
+#endif
+#ifdef SUBJ_F16_MULADD
+ case F16_MULADD:
+ test_abcz_f16( f16_mulAdd, (funcType_abcz_f16 *) subjFunctionPtr );
+ break;
+#endif
+#ifdef SUBJ_F16_DIV
+ case F16_DIV:
+ trueFunction_abz_f16 = f16_div;
+ goto test_abz_f16;
+#endif
+#ifdef SUBJ_F16_REM
+ case F16_REM:
+ trueFunction_abz_f16 = f16_rem;
+ goto test_abz_f16;
+#endif
+ test_abz_f16:
+ test_abz_f16(
+ trueFunction_abz_f16, (funcType_abz_f16 *) subjFunctionPtr );
+ break;
+#ifdef SUBJ_F16_SQRT
+ case F16_SQRT:
+ test_az_f16( f16_sqrt, (funcType_az_f16 *) subjFunctionPtr );
+ break;
+#endif
+#ifdef SUBJ_F16_EQ
+ case F16_EQ:
+ trueFunction_ab_f16_z_bool = f16_eq;
+ goto test_ab_f16_z_bool;
+#endif
+#ifdef SUBJ_F16_LE
+ case F16_LE:
+ trueFunction_ab_f16_z_bool = f16_le;
+ goto test_ab_f16_z_bool;
+#endif
+#ifdef SUBJ_F16_LT
+ case F16_LT:
+ trueFunction_ab_f16_z_bool = f16_lt;
+ goto test_ab_f16_z_bool;
+#endif
+#ifdef SUBJ_F16_EQ_SIGNALING
+ case F16_EQ_SIGNALING:
+ trueFunction_ab_f16_z_bool = f16_eq_signaling;
+ goto test_ab_f16_z_bool;
+#endif
+#ifdef SUBJ_F16_LE_QUIET
+ case F16_LE_QUIET:
+ trueFunction_ab_f16_z_bool = f16_le_quiet;
+ goto test_ab_f16_z_bool;
+#endif
+#ifdef SUBJ_F16_LT_QUIET
+ case F16_LT_QUIET:
+ trueFunction_ab_f16_z_bool = f16_lt_quiet;
+ goto test_ab_f16_z_bool;
+#endif
+ test_ab_f16_z_bool:
+ test_ab_f16_z_bool(
+ trueFunction_ab_f16_z_bool,
+ (funcType_ab_f16_z_bool *) subjFunctionPtr
+ );
+ break;
+#endif
+ /*--------------------------------------------------------------------
+ *--------------------------------------------------------------------*/
case F32_TO_UI32:
test_a_f32_z_ui32_rx(
f32_to_ui32, subjFunction_a_f32_z_ui32_rx, roundingMode, exact );
@@ -535,6 +794,14 @@ static
test_a_f32_z_i64_rx(
f32_to_i64, subjFunction_a_f32_z_i64_rx, roundingMode, exact );
break;
+#ifdef FLOAT16
+#ifdef SUBJ_F32_TO_F16
+ case F32_TO_F16:
+ test_a_f32_z_f16(
+ f32_to_f16, (funcType_a_f32_z_f16 *) subjFunctionPtr );
+ break;
+#endif
+#endif
#ifdef SUBJ_F32_TO_F64
case F32_TO_F64:
test_a_f32_z_f64(
@@ -654,6 +921,14 @@ static
test_a_f64_z_i64_rx(
f64_to_i64, subjFunction_a_f64_z_i64_rx, roundingMode, exact );
break;
+#ifdef FLOAT16
+#ifdef SUBJ_F64_TO_F16
+ case F64_TO_F16:
+ test_a_f64_z_f16(
+ f64_to_f16, (funcType_a_f64_z_f16 *) subjFunctionPtr );
+ break;
+#endif
+#endif
#ifdef SUBJ_F64_TO_F32
case F64_TO_F32:
test_a_f64_z_f32(
@@ -784,6 +1059,14 @@ static
extF80M_to_i64, subjFunction_a_extF80_z_i64_rx, roundingMode, exact
);
break;
+#ifdef FLOAT16
+#ifdef SUBJ_EXTF80_TO_F16
+ case EXTF80_TO_F16:
+ test_a_extF80_z_f16(
+ extF80M_to_f16, (funcType_a_extF80_z_f16 *) subjFunctionPtr );
+ break;
+#endif
+#endif
#ifdef SUBJ_EXTF80_TO_F32
case EXTF80_TO_F32:
test_a_extF80_z_f32(
@@ -901,6 +1184,14 @@ static
test_a_f128_z_i64_rx(
f128M_to_i64, subjFunction_a_f128_z_i64_rx, roundingMode, exact );
break;
+#ifdef FLOAT16
+#ifdef SUBJ_F128_TO_F16
+ case F128_TO_F16:
+ test_a_f128_z_f16(
+ f128M_to_f16, (funcType_a_f128_z_f16 *) subjFunctionPtr );
+ break;
+#endif
+#endif
#ifdef SUBJ_F128_TO_F32
case F128_TO_F32:
test_a_f128_z_f32(
@@ -1009,12 +1300,12 @@ static
}
static
- void
- testFunction(
- const struct standardFunctionInfo *standardFunctionInfoPtr,
- uint_fast8_t roundingPrecisionIn,
- int roundingCodeIn
- )
+void
+ testFunction(
+ const struct standardFunctionInfo *standardFunctionInfoPtr,
+ uint_fast8_t roundingPrecisionIn,
+ int roundingCodeIn
+ )
{
int functionCode, functionAttribs;
bool standardFunctionHasFixedRounding;
@@ -1099,6 +1390,7 @@ int main( int argc, char *argv[] )
const char *argPtr;
void (*const *subjFunctionPtrPtr)();
const char *functionNamePtr;
+ unsigned long ui;
long i;
/*------------------------------------------------------------------------
@@ -1130,6 +1422,8 @@ int main( int argc, char *argv[] )
" <option>: (* is default)\n"
" -help --Write this message and exit.\n"
" -list --List all testable subject functions and exit.\n"
+" -seed <num> --Set pseudo-random number generator seed to <num>.\n"
+" * -seed 1\n"
" -level <num> --Testing level <num> (1 or 2).\n"
" * -level 1\n"
" -errors <num> --Stop each function test after <num> errors.\n"
@@ -1162,6 +1456,9 @@ int main( int argc, char *argv[] )
" i32 --Signed 32-bit integer.\n"
" i64 --Signed 64-bit integer.\n"
" <float>:\n"
+#ifdef FLOAT16
+" f16 --Binary 16-bit floating-point (half-precision).\n"
+#endif
" f32 --Binary 32-bit floating-point (single-precision).\n"
" f64 --Binary 64-bit floating-point (double-precision).\n"
#ifdef EXTFLOAT80
@@ -1191,6 +1488,13 @@ int main( int argc, char *argv[] )
++subjFunctionPtrPtr;
}
return EXIT_SUCCESS;
+ } else if ( ! strcmp( argPtr, "seed" ) ) {
+ if ( argc < 2 ) goto optionError;
+ ui = strtoul( argv[1], (char **) &argPtr, 10 );
+ if ( *argPtr ) goto optionError;
+ srand( ui );
+ --argc;
+ ++argv;
} else if ( ! strcmp( argPtr, "level" ) ) {
if ( argc < 2 ) goto optionError;
i = strtol( argv[1], (char **) &argPtr, 10 );
diff --git a/source/testfloat_gen.c b/source/testfloat_gen.c
index 161834f..82621bb 100644
--- a/source/testfloat_gen.c
+++ b/source/testfloat_gen.c
@@ -1,12 +1,12 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -53,6 +53,9 @@ enum {
TYPE_UI64,
TYPE_I32,
TYPE_I64,
+ TYPE_F16,
+ TYPE_F16_2,
+ TYPE_F16_3,
TYPE_F32,
TYPE_F32_2,
TYPE_F32_3,
@@ -82,8 +85,13 @@ int main( int argc, char *argv[] )
bool exact;
int functionCode;
const char *argPtr;
+ unsigned long ui;
long i;
int functionAttribs;
+#ifdef FLOAT16
+ float16_t (*trueFunction_abz_f16)( float16_t, float16_t );
+ bool (*trueFunction_ab_f16_z_bool)( float16_t, float16_t );
+#endif
float32_t (*trueFunction_abz_f32)( float32_t, float32_t );
bool (*trueFunction_ab_f32_z_bool)( float32_t, float32_t );
float64_t (*trueFunction_abz_f64)( float64_t, float64_t );
@@ -109,7 +117,7 @@ int main( int argc, char *argv[] )
fail_programName = "testfloat_gen";
if ( argc <= 1 ) goto writeHelpMessage;
prefixTextPtr = 0;
- softfloat_detectTininess = softfloat_tininess_beforeRounding;
+ softfloat_detectTininess = softfloat_tininess_afterRounding;
#ifdef EXTFLOAT80
extF80_roundingPrecision = 80;
#endif
@@ -136,6 +144,8 @@ int main( int argc, char *argv[] )
" <option>: (* is default)\n"
" -help --Write this message and exit.\n"
" -prefix <text> --Write <text> as a line of output before any test cases.\n"
+" -seed <num> --Set pseudo-random number generator seed to <num>.\n"
+" * -seed 1\n"
" -level <num> --Testing level <num> (1 or 2).\n"
" * -level 1\n"
" -n <num> --Generate <num> test cases.\n"
@@ -150,8 +160,8 @@ int main( int argc, char *argv[] )
" -rmin --Round to minimum (down).\n"
" -rmax --Round to maximum (up).\n"
" -rnear_maxMag --Round to nearest/maximum magnitude (nearest/away).\n"
-" * -tininessbefore --Detect underflow tininess before rounding.\n"
-" -tininessafter --Detect underflow tininess after rounding.\n"
+" -tininessbefore --Detect underflow tininess before rounding.\n"
+" * -tininessafter --Detect underflow tininess after rounding.\n"
" * -notexact --Rounding to integer is not exact (no inexact\n"
" exceptions).\n"
" -exact --Rounding to integer is exact (raising inexact\n"
@@ -175,6 +185,9 @@ int main( int argc, char *argv[] )
" i32 --Signed 32-bit integer.\n"
" i64 --Signed 64-bit integer.\n"
" <float>:\n"
+#ifdef FLOAT16
+" f16 --Binary 16-bit floating-point (half-precision).\n"
+#endif
" f32 --Binary 32-bit floating-point (single-precision).\n"
" f64 --Binary 64-bit floating-point (double-precision).\n"
#ifdef EXTFLOAT80
@@ -192,6 +205,13 @@ int main( int argc, char *argv[] )
prefixTextPtr = argv[1];
--argc;
++argv;
+ } else if ( ! strcmp( argPtr, "seed" ) ) {
+ if ( argc < 2 ) goto optionError;
+ ui = strtoul( argv[1], (char **) &argPtr, 10 );
+ if ( *argPtr ) goto optionError;
+ srand( ui );
+ --argc;
+ ++argv;
} else if ( ! strcmp( argPtr, "level" ) ) {
if ( argc < 2 ) goto optionError;
i = strtol( argv[1], (char **) &argPtr, 10 );
@@ -274,6 +294,13 @@ int main( int argc, char *argv[] )
) {
functionCode = TYPE_I64;
if ( 2 <= argc ) goto absorbArg1;
+#ifdef FLOAT16
+ } else if (
+ ! strcmp( argPtr, "f16" ) || ! strcmp( argPtr, "float16" )
+ ) {
+ functionCode = TYPE_F16;
+ goto absorbArg;
+#endif
} else if (
! strcmp( argPtr, "f32" ) || ! strcmp( argPtr, "float32" )
) {
@@ -355,6 +382,17 @@ int main( int argc, char *argv[] )
case TYPE_I64:
gen_a_i64();
break;
+#ifdef FLOAT16
+ case TYPE_F16:
+ gen_a_f16();
+ break;
+ case TYPE_F16_2:
+ gen_ab_f16();
+ break;
+ case TYPE_F16_3:
+ gen_abc_f16();
+ break;
+#endif
case TYPE_F32:
gen_a_f32();
break;
@@ -397,6 +435,11 @@ int main( int argc, char *argv[] )
#endif
/*--------------------------------------------------------------------
*--------------------------------------------------------------------*/
+#ifdef FLOAT16
+ case UI32_TO_F16:
+ gen_a_ui32_z_f16( ui32_to_f16 );
+ break;
+#endif
case UI32_TO_F32:
gen_a_ui32_z_f32( ui32_to_f32 );
break;
@@ -413,6 +456,11 @@ int main( int argc, char *argv[] )
gen_a_ui32_z_f128( ui32_to_f128M );
break;
#endif
+#ifdef FLOAT16
+ case UI64_TO_F16:
+ gen_a_ui64_z_f16( ui64_to_f16 );
+ break;
+#endif
case UI64_TO_F32:
gen_a_ui64_z_f32( ui64_to_f32 );
break;
@@ -429,6 +477,11 @@ int main( int argc, char *argv[] )
gen_a_ui64_z_f128( ui64_to_f128M );
break;
#endif
+#ifdef FLOAT16
+ case I32_TO_F16:
+ gen_a_i32_z_f16( i32_to_f16 );
+ break;
+#endif
case I32_TO_F32:
gen_a_i32_z_f32( i32_to_f32 );
break;
@@ -445,6 +498,11 @@ int main( int argc, char *argv[] )
gen_a_i32_z_f128( i32_to_f128M );
break;
#endif
+#ifdef FLOAT16
+ case I64_TO_F16:
+ gen_a_i64_z_f16( i64_to_f16 );
+ break;
+#endif
case I64_TO_F32:
gen_a_i64_z_f32( i64_to_f32 );
break;
@@ -463,6 +521,84 @@ int main( int argc, char *argv[] )
#endif
/*--------------------------------------------------------------------
*--------------------------------------------------------------------*/
+#ifdef FLOAT16
+ case F16_TO_UI32:
+ gen_a_f16_z_ui32_rx( f16_to_ui32, roundingMode, exact );
+ break;
+ case F16_TO_UI64:
+ gen_a_f16_z_ui64_rx( f16_to_ui64, roundingMode, exact );
+ break;
+ case F16_TO_I32:
+ gen_a_f16_z_i32_rx( f16_to_i32, roundingMode, exact );
+ break;
+ case F16_TO_I64:
+ gen_a_f16_z_i64_rx( f16_to_i64, roundingMode, exact );
+ break;
+ case F16_TO_F32:
+ gen_a_f16_z_f32( f16_to_f32 );
+ break;
+ case F16_TO_F64:
+ gen_a_f16_z_f64( f16_to_f64 );
+ break;
+#ifdef EXTFLOAT80
+ case F16_TO_EXTF80:
+ gen_a_f16_z_extF80( f16_to_extF80M );
+ break;
+#endif
+#ifdef FLOAT128
+ case F16_TO_F128:
+ gen_a_f16_z_f128( f16_to_f128M );
+ break;
+#endif
+ case F16_ROUNDTOINT:
+ gen_az_f16_rx( f16_roundToInt, roundingMode, exact );
+ break;
+ case F16_ADD:
+ trueFunction_abz_f16 = f16_add;
+ goto gen_abz_f16;
+ case F16_SUB:
+ trueFunction_abz_f16 = f16_sub;
+ goto gen_abz_f16;
+ case F16_MUL:
+ trueFunction_abz_f16 = f16_mul;
+ goto gen_abz_f16;
+ case F16_DIV:
+ trueFunction_abz_f16 = f16_div;
+ goto gen_abz_f16;
+ case F16_REM:
+ trueFunction_abz_f16 = f16_rem;
+ gen_abz_f16:
+ gen_abz_f16( trueFunction_abz_f16 );
+ break;
+ case F16_MULADD:
+ gen_abcz_f16( f16_mulAdd );
+ break;
+ case F16_SQRT:
+ gen_az_f16( f16_sqrt );
+ break;
+ case F16_EQ:
+ trueFunction_ab_f16_z_bool = f16_eq;
+ goto gen_ab_f16_z_bool;
+ case F16_LE:
+ trueFunction_ab_f16_z_bool = f16_le;
+ goto gen_ab_f16_z_bool;
+ case F16_LT:
+ trueFunction_ab_f16_z_bool = f16_lt;
+ goto gen_ab_f16_z_bool;
+ case F16_EQ_SIGNALING:
+ trueFunction_ab_f16_z_bool = f16_eq_signaling;
+ goto gen_ab_f16_z_bool;
+ case F16_LE_QUIET:
+ trueFunction_ab_f16_z_bool = f16_le_quiet;
+ goto gen_ab_f16_z_bool;
+ case F16_LT_QUIET:
+ trueFunction_ab_f16_z_bool = f16_lt_quiet;
+ gen_ab_f16_z_bool:
+ gen_ab_f16_z_bool( trueFunction_ab_f16_z_bool );
+ break;
+#endif
+ /*--------------------------------------------------------------------
+ *--------------------------------------------------------------------*/
case F32_TO_UI32:
gen_a_f32_z_ui32_rx( f32_to_ui32, roundingMode, exact );
break;
@@ -475,6 +611,11 @@ int main( int argc, char *argv[] )
case F32_TO_I64:
gen_a_f32_z_i64_rx( f32_to_i64, roundingMode, exact );
break;
+#ifdef FLOAT16
+ case F32_TO_F16:
+ gen_a_f32_z_f16( f32_to_f16 );
+ break;
+#endif
case F32_TO_F64:
gen_a_f32_z_f64( f32_to_f64 );
break;
@@ -548,6 +689,11 @@ int main( int argc, char *argv[] )
case F64_TO_I64:
gen_a_f64_z_i64_rx( f64_to_i64, roundingMode, exact );
break;
+#ifdef FLOAT16
+ case F64_TO_F16:
+ gen_a_f64_z_f16( f64_to_f16 );
+ break;
+#endif
case F64_TO_F32:
gen_a_f64_z_f32( f64_to_f32 );
break;
@@ -622,6 +768,11 @@ int main( int argc, char *argv[] )
case EXTF80_TO_I64:
gen_a_extF80_z_i64_rx( extF80M_to_i64, roundingMode, exact );
break;
+#ifdef FLOAT16
+ case EXTF80_TO_F16:
+ gen_a_extF80_z_f16( extF80M_to_f16 );
+ break;
+#endif
case EXTF80_TO_F32:
gen_a_extF80_z_f32( extF80M_to_f32 );
break;
@@ -692,6 +843,11 @@ int main( int argc, char *argv[] )
case F128_TO_I64:
gen_a_f128_z_i64_rx( f128M_to_i64, roundingMode, exact );
break;
+#ifdef FLOAT16
+ case F128_TO_F16:
+ gen_a_f128_z_f16( f128M_to_f16 );
+ break;
+#endif
case F128_TO_F32:
gen_a_f128_z_f32( f128M_to_f32 );
break;
@@ -756,8 +912,6 @@ int main( int argc, char *argv[] )
*------------------------------------------------------------------------*/
optionError:
fail( "`%s' option requires numeric argument", *argv );
- /*------------------------------------------------------------------------
- *------------------------------------------------------------------------*/
invalidArg:
fail( "Invalid argument `%s'", *argv );
diff --git a/source/testfloat_ver.c b/source/testfloat_ver.c
index 9a52c10..e5a74fd 100644
--- a/source/testfloat_ver.c
+++ b/source/testfloat_ver.c
@@ -1,11 +1,11 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
California. All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -65,6 +65,10 @@ int main( int argc, char *argv[] )
long i;
int functionAttribs;
uint_fast8_t roundingMode;
+#ifdef FLOAT16
+ float16_t (*trueFunction_abz_f16)( float16_t, float16_t );
+ bool (*trueFunction_ab_f16_z_bool)( float16_t, float16_t );
+#endif
float32_t (*trueFunction_abz_f32)( float32_t, float32_t );
bool (*trueFunction_ab_f32_z_bool)( float32_t, float32_t );
float64_t (*trueFunction_abz_f64)( float64_t, float64_t );
@@ -89,7 +93,7 @@ int main( int argc, char *argv[] )
*------------------------------------------------------------------------*/
fail_programName = "testfloat_ver";
if ( argc <= 1 ) goto writeHelpMessage;
- softfloat_detectTininess = softfloat_tininess_beforeRounding;
+ softfloat_detectTininess = softfloat_tininess_afterRounding;
#ifdef EXTFLOAT80
extF80_roundingPrecision = 80;
#endif
@@ -99,7 +103,7 @@ int main( int argc, char *argv[] )
verLoops_trueFlagsPtr = &softfloat_exceptionFlags;
functionCode = 0;
roundingCode = ROUND_NEAR_EVEN;
- tininessCode = TININESS_BEFORE_ROUNDING;
+ tininessCode = TININESS_AFTER_ROUNDING;
for (;;) {
--argc;
if ( ! argc ) break;
@@ -128,8 +132,8 @@ int main( int argc, char *argv[] )
" -rmin --Round to minimum (down).\n"
" -rmax --Round to maximum (up).\n"
" -rnear_maxMag --Round to nearest/maximum magnitude (nearest/away).\n"
-" * -tininessbefore --Detect underflow tininess before rounding.\n"
-" -tininessafter --Detect underflow tininess after rounding.\n"
+" -tininessbefore --Detect underflow tininess before rounding.\n"
+" * -tininessafter --Detect underflow tininess after rounding.\n"
" * -notexact --Rounding to integer is not exact (no inexact\n"
" exceptions).\n"
" -exact --Rounding to integer is exact (raising inexact\n"
@@ -148,6 +152,9 @@ int main( int argc, char *argv[] )
" i32 --Signed 32-bit integer.\n"
" i64 --Signed 64-bit integer.\n"
" <float>:\n"
+#ifdef FLOAT16
+" f16 --Binary 16-bit floating-point (half-precision).\n"
+#endif
" f32 --Binary 32-bit floating-point (single-precision).\n"
" f64 --Binary 64-bit floating-point (double-precision).\n"
#ifdef EXTFLOAT80
@@ -262,6 +269,11 @@ int main( int argc, char *argv[] )
switch ( functionCode ) {
/*--------------------------------------------------------------------
*--------------------------------------------------------------------*/
+#ifdef FLOAT16
+ case UI32_TO_F16:
+ ver_a_ui32_z_f16( ui32_to_f16 );
+ break;
+#endif
case UI32_TO_F32:
ver_a_ui32_z_f32( ui32_to_f32 );
break;
@@ -278,6 +290,11 @@ int main( int argc, char *argv[] )
ver_a_ui32_z_f128( ui32_to_f128M );
break;
#endif
+#ifdef FLOAT16
+ case UI64_TO_F16:
+ ver_a_ui64_z_f16( ui64_to_f16 );
+ break;
+#endif
case UI64_TO_F32:
ver_a_ui64_z_f32( ui64_to_f32 );
break;
@@ -294,6 +311,11 @@ int main( int argc, char *argv[] )
ver_a_ui64_z_f128( ui64_to_f128M );
break;
#endif
+#ifdef FLOAT16
+ case I32_TO_F16:
+ ver_a_i32_z_f16( i32_to_f16 );
+ break;
+#endif
case I32_TO_F32:
ver_a_i32_z_f32( i32_to_f32 );
break;
@@ -310,6 +332,11 @@ int main( int argc, char *argv[] )
ver_a_i32_z_f128( i32_to_f128M );
break;
#endif
+#ifdef FLOAT16
+ case I64_TO_F16:
+ ver_a_i64_z_f16( i64_to_f16 );
+ break;
+#endif
case I64_TO_F32:
ver_a_i64_z_f32( i64_to_f32 );
break;
@@ -328,6 +355,84 @@ int main( int argc, char *argv[] )
#endif
/*--------------------------------------------------------------------
*--------------------------------------------------------------------*/
+#ifdef FLOAT16
+ case F16_TO_UI32:
+ ver_a_f16_z_ui32_rx( f16_to_ui32, roundingMode, exact );
+ break;
+ case F16_TO_UI64:
+ ver_a_f16_z_ui64_rx( f16_to_ui64, roundingMode, exact );
+ break;
+ case F16_TO_I32:
+ ver_a_f16_z_i32_rx( f16_to_i32, roundingMode, exact );
+ break;
+ case F16_TO_I64:
+ ver_a_f16_z_i64_rx( f16_to_i64, roundingMode, exact );
+ break;
+ case F16_TO_F32:
+ ver_a_f16_z_f32( f16_to_f32 );
+ break;
+ case F16_TO_F64:
+ ver_a_f16_z_f64( f16_to_f64 );
+ break;
+#ifdef EXTFLOAT80
+ case F16_TO_EXTF80:
+ ver_a_f16_z_extF80( f16_to_extF80M );
+ break;
+#endif
+#ifdef FLOAT128
+ case F16_TO_F128:
+ ver_a_f16_z_f128( f16_to_f128M );
+ break;
+#endif
+ case F16_ROUNDTOINT:
+ ver_az_f16_rx( f16_roundToInt, roundingMode, exact );
+ break;
+ case F16_ADD:
+ trueFunction_abz_f16 = f16_add;
+ goto ver_abz_f16;
+ case F16_SUB:
+ trueFunction_abz_f16 = f16_sub;
+ goto ver_abz_f16;
+ case F16_MUL:
+ trueFunction_abz_f16 = f16_mul;
+ goto ver_abz_f16;
+ case F16_DIV:
+ trueFunction_abz_f16 = f16_div;
+ goto ver_abz_f16;
+ case F16_REM:
+ trueFunction_abz_f16 = f16_rem;
+ ver_abz_f16:
+ ver_abz_f16( trueFunction_abz_f16 );
+ break;
+ case F16_MULADD:
+ ver_abcz_f16( f16_mulAdd );
+ break;
+ case F16_SQRT:
+ ver_az_f16( f16_sqrt );
+ break;
+ case F16_EQ:
+ trueFunction_ab_f16_z_bool = f16_eq;
+ goto ver_ab_f16_z_bool;
+ case F16_LE:
+ trueFunction_ab_f16_z_bool = f16_le;
+ goto ver_ab_f16_z_bool;
+ case F16_LT:
+ trueFunction_ab_f16_z_bool = f16_lt;
+ goto ver_ab_f16_z_bool;
+ case F16_EQ_SIGNALING:
+ trueFunction_ab_f16_z_bool = f16_eq_signaling;
+ goto ver_ab_f16_z_bool;
+ case F16_LE_QUIET:
+ trueFunction_ab_f16_z_bool = f16_le_quiet;
+ goto ver_ab_f16_z_bool;
+ case F16_LT_QUIET:
+ trueFunction_ab_f16_z_bool = f16_lt_quiet;
+ ver_ab_f16_z_bool:
+ ver_ab_f16_z_bool( trueFunction_ab_f16_z_bool );
+ break;
+#endif
+ /*--------------------------------------------------------------------
+ *--------------------------------------------------------------------*/
case F32_TO_UI32:
ver_a_f32_z_ui32_rx( f32_to_ui32, roundingMode, exact );
break;
@@ -340,6 +445,11 @@ int main( int argc, char *argv[] )
case F32_TO_I64:
ver_a_f32_z_i64_rx( f32_to_i64, roundingMode, exact );
break;
+#ifdef FLOAT16
+ case F32_TO_F16:
+ ver_a_f32_z_f16( f32_to_f16 );
+ break;
+#endif
case F32_TO_F64:
ver_a_f32_z_f64( f32_to_f64 );
break;
@@ -413,6 +523,11 @@ int main( int argc, char *argv[] )
case F64_TO_I64:
ver_a_f64_z_i64_rx( f64_to_i64, roundingMode, exact );
break;
+#ifdef FLOAT16
+ case F64_TO_F16:
+ ver_a_f64_z_f16( f64_to_f16 );
+ break;
+#endif
case F64_TO_F32:
ver_a_f64_z_f32( f64_to_f32 );
break;
@@ -487,6 +602,11 @@ int main( int argc, char *argv[] )
case EXTF80_TO_I64:
ver_a_extF80_z_i64_rx( extF80M_to_i64, roundingMode, exact );
break;
+#ifdef FLOAT16
+ case EXTF80_TO_F16:
+ ver_a_extF80_z_f16( extF80M_to_f16 );
+ break;
+#endif
case EXTF80_TO_F32:
ver_a_extF80_z_f32( extF80M_to_f32 );
break;
@@ -557,6 +677,11 @@ int main( int argc, char *argv[] )
case F128_TO_I64:
ver_a_f128_z_i64_rx( f128M_to_i64, roundingMode, exact );
break;
+#ifdef FLOAT16
+ case F128_TO_F16:
+ ver_a_f128_z_f16( f128M_to_f16 );
+ break;
+#endif
case F128_TO_F32:
ver_a_f128_z_f32( f128M_to_f32 );
break;
@@ -621,8 +746,6 @@ int main( int argc, char *argv[] )
*------------------------------------------------------------------------*/
optionError:
fail( "`%s' option requires numeric argument", *argv );
- /*------------------------------------------------------------------------
- *------------------------------------------------------------------------*/
invalidArg:
fail( "Invalid argument `%s'", *argv );
diff --git a/source/testsoftfloat.c b/source/testsoftfloat.c
index a93c39d..85585c1 100644
--- a/source/testsoftfloat.c
+++ b/source/testsoftfloat.c
@@ -1,11 +1,11 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
California. All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -70,10 +70,16 @@ static uint_fast8_t softfloat_clearExceptionFlags( void )
}
static
- void
- testFunctionInstance(
- int functionCode, uint_fast8_t roundingMode, bool exact )
+void
+ testFunctionInstance(
+ int functionCode, uint_fast8_t roundingMode, bool exact )
{
+#ifdef FLOAT16
+ float16_t (*trueFunction_abz_f16)( float16_t, float16_t );
+ float16_t (*subjFunction_abz_f16)( float16_t, float16_t );
+ bool (*trueFunction_ab_f16_z_bool)( float16_t, float16_t );
+ bool (*subjFunction_ab_f16_z_bool)( float16_t, float16_t );
+#endif
float32_t (*trueFunction_abz_f32)( float32_t, float32_t );
float32_t (*subjFunction_abz_f32)( float32_t, float32_t );
bool (*trueFunction_ab_f32_z_bool)( float32_t, float32_t );
@@ -109,6 +115,11 @@ static
switch ( functionCode ) {
/*--------------------------------------------------------------------
*--------------------------------------------------------------------*/
+#ifdef FLOAT16
+ case UI32_TO_F16:
+ test_a_ui32_z_f16( slow_ui32_to_f16, ui32_to_f16 );
+ break;
+#endif
case UI32_TO_F32:
test_a_ui32_z_f32( slow_ui32_to_f32, ui32_to_f32 );
break;
@@ -125,6 +136,11 @@ static
test_a_ui32_z_f128( slow_ui32_to_f128M, ui32_to_f128M );
break;
#endif
+#ifdef FLOAT16
+ case UI64_TO_F16:
+ test_a_ui64_z_f16( slow_ui64_to_f16, ui64_to_f16 );
+ break;
+#endif
case UI64_TO_F32:
test_a_ui64_z_f32( slow_ui64_to_f32, ui64_to_f32 );
break;
@@ -141,6 +157,11 @@ static
test_a_ui64_z_f128( slow_ui64_to_f128M, ui64_to_f128M );
break;
#endif
+#ifdef FLOAT16
+ case I32_TO_F16:
+ test_a_i32_z_f16( slow_i32_to_f16, i32_to_f16 );
+ break;
+#endif
case I32_TO_F32:
test_a_i32_z_f32( slow_i32_to_f32, i32_to_f32 );
break;
@@ -157,6 +178,11 @@ static
test_a_i32_z_f128( slow_i32_to_f128M, i32_to_f128M );
break;
#endif
+#ifdef FLOAT16
+ case I64_TO_F16:
+ test_a_i64_z_f16( slow_i64_to_f16, i64_to_f16 );
+ break;
+#endif
case I64_TO_F32:
test_a_i64_z_f32( slow_i64_to_f32, i64_to_f32 );
break;
@@ -175,6 +201,117 @@ static
#endif
/*--------------------------------------------------------------------
*--------------------------------------------------------------------*/
+#ifdef FLOAT16
+ case F16_TO_UI32:
+ test_a_f16_z_ui32_rx(
+ slow_f16_to_ui32, f16_to_ui32, roundingMode, exact );
+ break;
+ case F16_TO_UI64:
+ test_a_f16_z_ui64_rx(
+ slow_f16_to_ui64, f16_to_ui64, roundingMode, exact );
+ break;
+ case F16_TO_I32:
+ test_a_f16_z_i32_rx(
+ slow_f16_to_i32, f16_to_i32, roundingMode, exact );
+ break;
+ case F16_TO_I64:
+ test_a_f16_z_i64_rx(
+ slow_f16_to_i64, f16_to_i64, roundingMode, exact );
+ break;
+ case F16_TO_UI32_R_MINMAG:
+ test_a_f16_z_ui32_x(
+ slow_f16_to_ui32_r_minMag, f16_to_ui32_r_minMag, exact );
+ break;
+ case F16_TO_UI64_R_MINMAG:
+ test_a_f16_z_ui64_x(
+ slow_f16_to_ui64_r_minMag, f16_to_ui64_r_minMag, exact );
+ break;
+ case F16_TO_I32_R_MINMAG:
+ test_a_f16_z_i32_x(
+ slow_f16_to_i32_r_minMag, f16_to_i32_r_minMag, exact );
+ break;
+ case F16_TO_I64_R_MINMAG:
+ test_a_f16_z_i64_x(
+ slow_f16_to_i64_r_minMag, f16_to_i64_r_minMag, exact );
+ break;
+ case F16_TO_F32:
+ test_a_f16_z_f32( slow_f16_to_f32, f16_to_f32 );
+ break;
+ case F16_TO_F64:
+ test_a_f16_z_f64( slow_f16_to_f64, f16_to_f64 );
+ break;
+#ifdef EXTFLOAT80
+ case F16_TO_EXTF80:
+ test_a_f16_z_extF80( slow_f16_to_extF80M, f16_to_extF80M );
+ break;
+#endif
+#ifdef FLOAT128
+ case F16_TO_F128:
+ test_a_f16_z_f128( slow_f16_to_f128M, f16_to_f128M );
+ break;
+#endif
+ case F16_ROUNDTOINT:
+ test_az_f16_rx(
+ slow_f16_roundToInt, f16_roundToInt, roundingMode, exact );
+ break;
+ case F16_ADD:
+ trueFunction_abz_f16 = slow_f16_add;
+ subjFunction_abz_f16 = f16_add;
+ goto test_abz_f16;
+ case F16_SUB:
+ trueFunction_abz_f16 = slow_f16_sub;
+ subjFunction_abz_f16 = f16_sub;
+ goto test_abz_f16;
+ case F16_MUL:
+ trueFunction_abz_f16 = slow_f16_mul;
+ subjFunction_abz_f16 = f16_mul;
+ goto test_abz_f16;
+ case F16_DIV:
+ trueFunction_abz_f16 = slow_f16_div;
+ subjFunction_abz_f16 = f16_div;
+ goto test_abz_f16;
+ case F16_REM:
+ trueFunction_abz_f16 = slow_f16_rem;
+ subjFunction_abz_f16 = f16_rem;
+ test_abz_f16:
+ test_abz_f16( trueFunction_abz_f16, subjFunction_abz_f16 );
+ break;
+ case F16_MULADD:
+ test_abcz_f16( slow_f16_mulAdd, f16_mulAdd );
+ break;
+ case F16_SQRT:
+ test_az_f16( slow_f16_sqrt, f16_sqrt );
+ break;
+ case F16_EQ:
+ trueFunction_ab_f16_z_bool = slow_f16_eq;
+ subjFunction_ab_f16_z_bool = f16_eq;
+ goto test_ab_f16_z_bool;
+ case F16_LE:
+ trueFunction_ab_f16_z_bool = slow_f16_le;
+ subjFunction_ab_f16_z_bool = f16_le;
+ goto test_ab_f16_z_bool;
+ case F16_LT:
+ trueFunction_ab_f16_z_bool = slow_f16_lt;
+ subjFunction_ab_f16_z_bool = f16_lt;
+ goto test_ab_f16_z_bool;
+ case F16_EQ_SIGNALING:
+ trueFunction_ab_f16_z_bool = slow_f16_eq_signaling;
+ subjFunction_ab_f16_z_bool = f16_eq_signaling;
+ goto test_ab_f16_z_bool;
+ case F16_LE_QUIET:
+ trueFunction_ab_f16_z_bool = slow_f16_le_quiet;
+ subjFunction_ab_f16_z_bool = f16_le_quiet;
+ goto test_ab_f16_z_bool;
+ case F16_LT_QUIET:
+ trueFunction_ab_f16_z_bool = slow_f16_lt_quiet;
+ subjFunction_ab_f16_z_bool = f16_lt_quiet;
+ test_ab_f16_z_bool:
+ test_ab_f16_z_bool(
+ trueFunction_ab_f16_z_bool, subjFunction_ab_f16_z_bool );
+ break;
+#endif
+ /*--------------------------------------------------------------------
+ *--------------------------------------------------------------------*/
case F32_TO_UI32:
test_a_f32_z_ui32_rx(
slow_f32_to_ui32, f32_to_ui32, roundingMode, exact );
@@ -207,6 +344,11 @@ static
test_a_f32_z_i64_x(
slow_f32_to_i64_r_minMag, f32_to_i64_r_minMag, exact );
break;
+#ifdef FLOAT16
+ case F32_TO_F16:
+ test_a_f32_z_f16( slow_f32_to_f16, f32_to_f16 );
+ break;
+#endif
case F32_TO_F64:
test_a_f32_z_f64( slow_f32_to_f64, f32_to_f64 );
break;
@@ -313,6 +455,11 @@ static
test_a_f64_z_i64_x(
slow_f64_to_i64_r_minMag, f64_to_i64_r_minMag, exact );
break;
+#ifdef FLOAT16
+ case F64_TO_F16:
+ test_a_f64_z_f16( slow_f64_to_f16, f64_to_f16 );
+ break;
+#endif
case F64_TO_F32:
test_a_f64_z_f32( slow_f64_to_f32, f64_to_f32 );
break;
@@ -420,6 +567,11 @@ static
test_a_extF80_z_i64_x(
slow_extF80M_to_i64_r_minMag, extF80M_to_i64_r_minMag, exact );
break;
+#ifdef FLOAT16
+ case EXTF80_TO_F16:
+ test_a_extF80_z_f16( slow_extF80M_to_f16, extF80M_to_f16 );
+ break;
+#endif
case EXTF80_TO_F32:
test_a_extF80_z_f32( slow_extF80M_to_f32, extF80M_to_f32 );
break;
@@ -523,6 +675,11 @@ static
test_a_f128_z_i64_x(
slow_f128M_to_i64_r_minMag, f128M_to_i64_r_minMag, exact );
break;
+#ifdef FLOAT16
+ case F128_TO_F16:
+ test_a_f128_z_f16( slow_f128M_to_f16, f128M_to_f16 );
+ break;
+#endif
case F128_TO_F32:
test_a_f128_z_f32( slow_f128M_to_f32, f128M_to_f32 );
break;
@@ -604,14 +761,14 @@ static
enum { EXACT_FALSE = 1, EXACT_TRUE };
static
- void
- testFunction(
- int functionCode,
- uint_fast8_t roundingPrecisionIn,
- int roundingCodeIn,
- int tininessCodeIn,
- int exactCodeIn
- )
+void
+ testFunction(
+ int functionCode,
+ uint_fast8_t roundingPrecisionIn,
+ int roundingCodeIn,
+ int tininessCodeIn,
+ int exactCodeIn
+ )
{
int functionAttribs;
uint_fast8_t roundingPrecision;
@@ -716,6 +873,7 @@ int main( int argc, char *argv[] )
uint_fast8_t roundingPrecision;
int roundingCode, tininessCode, exactCode;
const char *argPtr;
+ unsigned long ui;
long i;
/*------------------------------------------------------------------------
@@ -748,6 +906,8 @@ int main( int argc, char *argv[] )
"testsoftfloat [<option>...] <function>\n"
" <option>: (* is default)\n"
" -help --Write this message and exit.\n"
+" -seed <num> --Set pseudo-random number generator seed to <num>.\n"
+" * -seed 1\n"
" -level <num> --Testing level <num> (1 or 2).\n"
" * -level 1\n"
" -errors <num> --Stop each function test after <num> errors.\n"
@@ -787,6 +947,9 @@ int main( int argc, char *argv[] )
" i32 --Signed 32-bit integer.\n"
" i64 --Signed 64-bit integer.\n"
" <float>:\n"
+#ifdef FLOAT16
+" f16 --Binary 16-bit floating-point (half-precision).\n"
+#endif
" f32 --Binary 32-bit floating-point (single-precision).\n"
" f64 --Binary 64-bit floating-point (double-precision).\n"
#ifdef EXTFLOAT80
@@ -799,6 +962,13 @@ int main( int argc, char *argv[] )
stdout
);
return EXIT_SUCCESS;
+ } else if ( ! strcmp( argPtr, "seed" ) ) {
+ if ( argc < 2 ) goto optionError;
+ ui = strtoul( argv[1], (char **) &argPtr, 10 );
+ if ( *argPtr ) goto optionError;
+ srand( ui );
+ --argc;
+ ++argv;
} else if ( ! strcmp( argPtr, "level" ) ) {
if ( argc < 2 ) goto optionError;
i = strtol( argv[1], (char **) &argPtr, 10 );
diff --git a/source/timesoftfloat.c b/source/timesoftfloat.c
index 57be35b..b7a4d29 100644
--- a/source/timesoftfloat.c
+++ b/source/timesoftfloat.c
@@ -1,11 +1,11 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
California. All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -49,6 +49,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
enum { minIterations = 1000 };
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+
static const char *functionNamePtr;
static uint_fast8_t roundingPrecision;
static int roundingCode;
@@ -56,6 +59,9 @@ static int tininessCode;
static bool usesExact;
static bool exact;
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+
static void reportTime( int_fast64_t count, clock_t clockTicks )
{
static const char *roundingModeNames[NUM_ROUNDINGMODES] = {
@@ -94,9 +100,18 @@ static void reportTime( int_fast64_t count, clock_t clockTicks )
}
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+
+#ifdef FLOAT16
+union ui16_f16 { uint16_t ui; float16_t f; };
+#endif
union ui32_f32 { uint32_t ui; float32_t f; };
union ui64_f64 { uint64_t ui; float64_t f; };
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+
enum { numInputs_ui32 = 32 };
static const uint32_t inputs_ui32[numInputs_ui32] = {
@@ -110,6 +125,39 @@ static const uint32_t inputs_ui32[numInputs_ui32] = {
0x40000008, 0x0001BF56, 0x000017F6, 0x000A908A
};
+#ifdef FLOAT16
+
+static void time_a_ui32_z_f16( float16_t function( uint32_t ) )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ function( inputs_ui32[inputNum] );
+ inputNum = (inputNum + 1) & (numInputs_ui32 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ function( inputs_ui32[inputNum] );
+ inputNum = (inputNum + 1) & (numInputs_ui32 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+#endif
+
static void time_a_ui32_z_f32( float32_t function( uint32_t ) )
{
int_fast64_t count;
@@ -236,6 +284,9 @@ static void time_a_ui32_z_f128( void function( uint32_t, float128_t * ) )
#endif
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+
enum { numInputs_ui64 = 32 };
static const int64_t inputs_ui64[numInputs_ui64] = {
@@ -257,6 +308,39 @@ static const int64_t inputs_ui64[numInputs_ui64] = {
UINT64_C( 0x00000020FBFFFFFE ), UINT64_C( 0x0000099AE6455357 )
};
+#ifdef FLOAT16
+
+static void time_a_ui64_z_f16( float16_t function( uint64_t ) )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ function( inputs_ui64[inputNum] );
+ inputNum = (inputNum + 1) & (numInputs_ui64 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ function( inputs_ui64[inputNum] );
+ inputNum = (inputNum + 1) & (numInputs_ui64 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+#endif
+
static void time_a_ui64_z_f32( float32_t function( uint64_t ) )
{
int_fast64_t count;
@@ -383,6 +467,9 @@ static void time_a_ui64_z_f128( void function( uint64_t, float128_t * ) )
#endif
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+
enum { numInputs_i32 = 32 };
static const int32_t inputs_i32[numInputs_i32] = {
@@ -396,6 +483,39 @@ static const int32_t inputs_i32[numInputs_i32] = {
-0x40000008, 0x0001BF56, 0x000017F6, 0x000A908A
};
+#ifdef FLOAT16
+
+static void time_a_i32_z_f16( float16_t function( int32_t ) )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ function( inputs_i32[inputNum] );
+ inputNum = (inputNum + 1) & (numInputs_i32 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ function( inputs_i32[inputNum] );
+ inputNum = (inputNum + 1) & (numInputs_i32 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+#endif
+
static void time_a_i32_z_f32( float32_t function( int32_t ) )
{
int_fast64_t count;
@@ -522,6 +642,9 @@ static void time_a_i32_z_f128( void function( int32_t, float128_t * ) )
#endif
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+
enum { numInputs_i64 = 32 };
static const int64_t inputs_i64[numInputs_i64] = {
@@ -543,6 +666,39 @@ static const int64_t inputs_i64[numInputs_i64] = {
INT64_C( 0x00000020FBFFFFFE ), INT64_C( 0x0000099AE6455357 )
};
+#ifdef FLOAT16
+
+static void time_a_i64_z_f16( float16_t function( int64_t ) )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ function( inputs_i64[inputNum] );
+ inputNum = (inputNum + 1) & (numInputs_i64 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ function( inputs_i64[inputNum] );
+ inputNum = (inputNum + 1) & (numInputs_i64 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+#endif
+
static void time_a_i64_z_f32( float32_t function( int64_t ) )
{
int_fast64_t count;
@@ -669,6 +825,655 @@ static void time_a_i64_z_f128( void function( int64_t, float128_t * ) )
#endif
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+
+#ifdef FLOAT16
+
+enum { numInputs_f16 = 32 };
+
+static const uint16_t inputs_F16UI[numInputs_f16] = {
+ 0x0BBA, 0x77FE, 0x084F, 0x9C0F, 0x7800, 0x4436, 0xCE67, 0x80F3,
+ 0x87EF, 0xC2FA, 0x7BFF, 0x13FE, 0x7BFE, 0x1C00, 0xAC46, 0xEAFA,
+ 0x3813, 0x4804, 0x385E, 0x8000, 0xB86C, 0x4B7D, 0xC7FD, 0xC97F,
+ 0x260C, 0x78EE, 0xB84F, 0x249E, 0x0D27, 0x37DC, 0x8400, 0xE8EF
+};
+
+static
+void
+ time_a_f16_z_ui32_rx(
+ uint_fast32_t function( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, roundingMode, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, roundingMode, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+static
+void
+ time_a_f16_z_ui64_rx(
+ uint_fast64_t function( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, roundingMode, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, roundingMode, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+static
+void
+ time_a_f16_z_i32_rx(
+ int_fast32_t function( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, roundingMode, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, roundingMode, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+static
+void
+ time_a_f16_z_i64_rx(
+ int_fast64_t function( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, roundingMode, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, roundingMode, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+static
+void
+ time_a_f16_z_ui32_x( uint_fast32_t function( float16_t, bool ), bool exact )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+static
+void
+ time_a_f16_z_ui64_x( uint_fast64_t function( float16_t, bool ), bool exact )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+static
+void time_a_f16_z_i32_x( int_fast32_t function( float16_t, bool ), bool exact )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+static
+void time_a_f16_z_i64_x( int_fast64_t function( float16_t, bool ), bool exact )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+static void time_a_f16_z_f32( float32_t function( float16_t ) )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+static void time_a_f16_z_f64( float64_t function( float16_t ) )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+#ifdef EXTFLOAT80
+
+static void time_a_f16_z_extF80( void function( float16_t, extFloat80_t * ) )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA;
+ extFloat80_t z;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, &z );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, &z );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+#endif
+
+#ifdef FLOAT128
+
+static void time_a_f16_z_f128( void function( float16_t, float128_t * ) )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA;
+ float128_t z;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, &z );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, &z );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+#endif
+
+static
+void
+ time_az_f16_rx(
+ float16_t function( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, roundingMode, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNum];
+ function( uA.f, roundingMode, exact );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+static void time_abz_f16( float16_t function( float16_t, float16_t ) )
+{
+ int_fast64_t count;
+ int inputNumA, inputNumB;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA, uB;
+ clock_t endClock;
+
+ count = 0;
+ inputNumA = 0;
+ inputNumB = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNumA];
+ uB.ui = inputs_F16UI[inputNumB];
+ function( uA.f, uB.f );
+ inputNumA = (inputNumA + 1) & (numInputs_f16 - 1);
+ if ( ! inputNumA ) ++inputNumB;
+ inputNumB = (inputNumB + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNumA = 0;
+ inputNumB = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNumA];
+ uB.ui = inputs_F16UI[inputNumB];
+ function( uA.f, uB.f );
+ inputNumA = (inputNumA + 1) & (numInputs_f16 - 1);
+ if ( ! inputNumA ) ++inputNumB;
+ inputNumB = (inputNumB + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+static
+void time_abcz_f16( float16_t function( float16_t, float16_t, float16_t ) )
+{
+ int_fast64_t count;
+ int inputNumA, inputNumB, inputNumC;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA, uB, uC;
+ clock_t endClock;
+
+ count = 0;
+ inputNumA = 0;
+ inputNumB = 0;
+ inputNumC = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNumA];
+ uB.ui = inputs_F16UI[inputNumB];
+ uC.ui = inputs_F16UI[inputNumC];
+ function( uA.f, uB.f, uC.f );
+ inputNumA = (inputNumA + 1) & (numInputs_f16 - 1);
+ if ( ! inputNumA ) ++inputNumB;
+ inputNumB = (inputNumB + 1) & (numInputs_f16 - 1);
+ if ( ! inputNumB ) ++inputNumC;
+ inputNumC = (inputNumC + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNumA = 0;
+ inputNumB = 0;
+ inputNumC = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNumA];
+ uB.ui = inputs_F16UI[inputNumB];
+ uC.ui = inputs_F16UI[inputNumC];
+ function( uA.f, uB.f, uC.f );
+ inputNumA = (inputNumA + 1) & (numInputs_f16 - 1);
+ if ( ! inputNumA ) ++inputNumB;
+ inputNumB = (inputNumB + 1) & (numInputs_f16 - 1);
+ if ( ! inputNumB ) ++inputNumC;
+ inputNumC = (inputNumC + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+static void time_ab_f16_z_bool( bool function( float16_t, float16_t ) )
+{
+ int_fast64_t count;
+ int inputNumA, inputNumB;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA, uB;
+ clock_t endClock;
+
+ count = 0;
+ inputNumA = 0;
+ inputNumB = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI[inputNumA];
+ uB.ui = inputs_F16UI[inputNumB];
+ function( uA.f, uB.f );
+ inputNumA = (inputNumA + 1) & (numInputs_f16 - 1);
+ if ( ! inputNumA ) ++inputNumB;
+ inputNumB = (inputNumB + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNumA = 0;
+ inputNumB = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI[inputNumA];
+ uB.ui = inputs_F16UI[inputNumB];
+ function( uA.f, uB.f );
+ inputNumA = (inputNumA + 1) & (numInputs_f16 - 1);
+ if ( ! inputNumA ) ++inputNumB;
+ inputNumB = (inputNumB + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+static const uint16_t inputs_F16UI_pos[numInputs_f16] = {
+ 0x0BBA, 0x77FE, 0x084F, 0x1C0F, 0x7800, 0x4436, 0x4E67, 0x00F3,
+ 0x07EF, 0x42FA, 0x7BFF, 0x13FE, 0x7BFE, 0x1C00, 0x2C46, 0x6AFA,
+ 0x3813, 0x4804, 0x385E, 0x0000, 0x386C, 0x4B7D, 0x47FD, 0x497F,
+ 0x260C, 0x78EE, 0x384F, 0x249E, 0x0D27, 0x37DC, 0x0400, 0x68EF
+};
+
+static void time_az_f16_pos( float16_t function( float16_t ) )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui16_f16 uA;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F16UI_pos[inputNum];
+ function( uA.f );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F16UI_pos[inputNum];
+ function( uA.f );
+ inputNum = (inputNum + 1) & (numInputs_f16 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+#endif
+
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+
enum { numInputs_f32 = 32 };
static const uint32_t inputs_F32UI[numInputs_f32] = {
@@ -683,12 +1488,12 @@ static const uint32_t inputs_F32UI[numInputs_f32] = {
};
static
- void
- time_a_f32_z_ui32_rx(
- uint_fast32_t function( float32_t, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_f32_z_ui32_rx(
+ uint_fast32_t function( float32_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -721,12 +1526,12 @@ static
}
static
- void
- time_a_f32_z_ui64_rx(
- uint_fast64_t function( float32_t, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_f32_z_ui64_rx(
+ uint_fast64_t function( float32_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -759,12 +1564,12 @@ static
}
static
- void
- time_a_f32_z_i32_rx(
- int_fast32_t function( float32_t, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_f32_z_i32_rx(
+ int_fast32_t function( float32_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -797,12 +1602,12 @@ static
}
static
- void
- time_a_f32_z_i64_rx(
- int_fast64_t function( float32_t, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_f32_z_i64_rx(
+ int_fast64_t function( float32_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -835,8 +1640,8 @@ static
}
static
- void
- time_a_f32_z_ui32_x( uint_fast32_t function( float32_t, bool ), bool exact )
+void
+ time_a_f32_z_ui32_x( uint_fast32_t function( float32_t, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -869,8 +1674,8 @@ static
}
static
- void
- time_a_f32_z_ui64_x( uint_fast64_t function( float32_t, bool ), bool exact )
+void
+ time_a_f32_z_ui64_x( uint_fast64_t function( float32_t, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -903,8 +1708,7 @@ static
}
static
- void
- time_a_f32_z_i32_x( int_fast32_t function( float32_t, bool ), bool exact )
+void time_a_f32_z_i32_x( int_fast32_t function( float32_t, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -937,8 +1741,7 @@ static
}
static
- void
- time_a_f32_z_i64_x( int_fast64_t function( float32_t, bool ), bool exact )
+void time_a_f32_z_i64_x( int_fast64_t function( float32_t, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -970,6 +1773,42 @@ static
}
+#ifdef FLOAT16
+
+static void time_a_f32_z_f16( float16_t function( float32_t ) )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui32_f32 uA;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F32UI[inputNum];
+ function( uA.f );
+ inputNum = (inputNum + 1) & (numInputs_f32 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F32UI[inputNum];
+ function( uA.f );
+ inputNum = (inputNum + 1) & (numInputs_f32 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+#endif
+
static void time_a_f32_z_f64( float64_t function( float32_t ) )
{
int_fast64_t count;
@@ -1077,12 +1916,12 @@ static void time_a_f32_z_f128( void function( float32_t, float128_t * ) )
#endif
static
- void
- time_az_f32_rx(
- float32_t function( float32_t, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_az_f32_rx(
+ float32_t function( float32_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -1155,7 +1994,7 @@ static void time_abz_f32( float32_t function( float32_t, float32_t ) )
}
static
- void time_abcz_f32( float32_t function( float32_t, float32_t, float32_t ) )
+void time_abcz_f32( float32_t function( float32_t, float32_t, float32_t ) )
{
int_fast64_t count;
int inputNumA, inputNumB, inputNumC;
@@ -1286,6 +2125,9 @@ static void time_az_f32_pos( float32_t function( float32_t ) )
}
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+
enum { numInputs_f64 = 32 };
static const uint64_t inputs_F64UI[numInputs_f64] = {
@@ -1324,12 +2166,12 @@ static const uint64_t inputs_F64UI[numInputs_f64] = {
};
static
- void
- time_a_f64_z_ui32_rx(
- uint_fast32_t function( float64_t, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_f64_z_ui32_rx(
+ uint_fast32_t function( float64_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -1362,12 +2204,12 @@ static
}
static
- void
- time_a_f64_z_ui64_rx(
- uint_fast64_t function( float64_t, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_f64_z_ui64_rx(
+ uint_fast64_t function( float64_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -1400,12 +2242,12 @@ static
}
static
- void
- time_a_f64_z_i32_rx(
- int_fast32_t function( float64_t, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_f64_z_i32_rx(
+ int_fast32_t function( float64_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -1438,12 +2280,12 @@ static
}
static
- void
- time_a_f64_z_i64_rx(
- int_fast64_t function( float64_t, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_f64_z_i64_rx(
+ int_fast64_t function( float64_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -1476,8 +2318,8 @@ static
}
static
- void
- time_a_f64_z_ui32_x( uint_fast32_t function( float64_t, bool ), bool exact )
+void
+ time_a_f64_z_ui32_x( uint_fast32_t function( float64_t, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -1510,8 +2352,8 @@ static
}
static
- void
- time_a_f64_z_ui64_x( uint_fast64_t function( float64_t, bool ), bool exact )
+void
+ time_a_f64_z_ui64_x( uint_fast64_t function( float64_t, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -1544,8 +2386,7 @@ static
}
static
- void
- time_a_f64_z_i32_x( int_fast32_t function( float64_t, bool ), bool exact )
+void time_a_f64_z_i32_x( int_fast32_t function( float64_t, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -1578,8 +2419,7 @@ static
}
static
- void
- time_a_f64_z_i64_x( int_fast64_t function( float64_t, bool ), bool exact )
+void time_a_f64_z_i64_x( int_fast64_t function( float64_t, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -1611,6 +2451,42 @@ static
}
+#ifdef FLOAT16
+
+static void time_a_f64_z_f16( float16_t function( float64_t ) )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ union ui64_f64 uA;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ uA.ui = inputs_F64UI[inputNum];
+ function( uA.f );
+ inputNum = (inputNum + 1) & (numInputs_f64 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ uA.ui = inputs_F64UI[inputNum];
+ function( uA.f );
+ inputNum = (inputNum + 1) & (numInputs_f64 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+#endif
+
static void time_a_f64_z_f32( float32_t function( float64_t ) )
{
int_fast64_t count;
@@ -1718,12 +2594,12 @@ static void time_a_f64_z_f128( void function( float64_t, float128_t * ) )
#endif
static
- void
- time_az_f64_rx(
- float64_t function( float64_t, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_az_f64_rx(
+ float64_t function( float64_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -1796,7 +2672,7 @@ static void time_abz_f64( float64_t function( float64_t, float64_t ) )
}
static
- void time_abcz_f64( float64_t function( float64_t, float64_t, float64_t ) )
+void time_abcz_f64( float64_t function( float64_t, float64_t, float64_t ) )
{
int_fast64_t count;
int inputNumA, inputNumB, inputNumC;
@@ -1951,6 +2827,9 @@ static void time_az_f64_pos( float64_t function( float64_t ) )
}
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+
#ifdef EXTFLOAT80
#ifdef LITTLEENDIAN
@@ -1962,49 +2841,49 @@ static void time_az_f64_pos( float64_t function( float64_t ) )
enum { numInputs_extF80 = 32 };
static
- const union { struct extFloat80M s; extFloat80_t f; }
- inputs_extF80[numInputs_extF80] = {
- extF80Const( 0xC03F, 0xA9BE15A19C1E8B62 ),
- extF80Const( 0x8000, 0x0000000000000000 ),
- extF80Const( 0x75A8, 0xE59591E4788957A5 ),
- extF80Const( 0xBFFF, 0xFFF0000000000040 ),
- extF80Const( 0x0CD8, 0xFC000000000007FE ),
- extF80Const( 0x43BA, 0x99A4000000000000 ),
- extF80Const( 0x3FFF, 0x8000000000000000 ),
- extF80Const( 0x4081, 0x94FBF1BCEB5545F0 ),
- extF80Const( 0x403E, 0xFFF0000000002000 ),
- extF80Const( 0x3FFE, 0xC860E3C75D224F28 ),
- extF80Const( 0x407E, 0xFC00000FFFFFFFFE ),
- extF80Const( 0x737A, 0x800000007FFDFFFE ),
- extF80Const( 0x4044, 0xFFFFFF80000FFFFF ),
- extF80Const( 0xBBFE, 0x8000040000001FFE ),
- extF80Const( 0xC002, 0xFF80000000000020 ),
- extF80Const( 0xDE8D, 0xFFFFFFFFFFE00004 ),
- extF80Const( 0xC004, 0x8000000000003FFB ),
- extF80Const( 0x407F, 0x800000000003FFFE ),
- extF80Const( 0xC000, 0xA459EE6A5C16CA55 ),
- extF80Const( 0x8003, 0xC42CBF7399AEEB94 ),
- extF80Const( 0xBF7F, 0xF800000000000006 ),
- extF80Const( 0xC07F, 0xBF56BE8871F28FEA ),
- extF80Const( 0xC07E, 0xFFFF77FFFFFFFFFE ),
- extF80Const( 0xADC9, 0x8000000FFFFFFFDE ),
- extF80Const( 0xC001, 0xEFF7FFFFFFFFFFFF ),
- extF80Const( 0x4001, 0xBE84F30125C497A6 ),
- extF80Const( 0xC06B, 0xEFFFFFFFFFFFFFFF ),
- extF80Const( 0x4080, 0xFFFFFFFFBFFFFFFF ),
- extF80Const( 0x87E9, 0x81FFFFFFFFFFFBFF ),
- extF80Const( 0xA63F, 0x801FFFFFFEFFFFFE ),
- extF80Const( 0x403C, 0x801FFFFFFFF7FFFF ),
- extF80Const( 0x4018, 0x8000000000080003 )
-};
+const union { struct extFloat80M s; extFloat80_t f; }
+ inputs_extF80[numInputs_extF80] = {
+ extF80Const( 0xC03F, 0xA9BE15A19C1E8B62 ),
+ extF80Const( 0x8000, 0x0000000000000000 ),
+ extF80Const( 0x75A8, 0xE59591E4788957A5 ),
+ extF80Const( 0xBFFF, 0xFFF0000000000040 ),
+ extF80Const( 0x0CD8, 0xFC000000000007FE ),
+ extF80Const( 0x43BA, 0x99A4000000000000 ),
+ extF80Const( 0x3FFF, 0x8000000000000000 ),
+ extF80Const( 0x4081, 0x94FBF1BCEB5545F0 ),
+ extF80Const( 0x403E, 0xFFF0000000002000 ),
+ extF80Const( 0x3FFE, 0xC860E3C75D224F28 ),
+ extF80Const( 0x407E, 0xFC00000FFFFFFFFE ),
+ extF80Const( 0x737A, 0x800000007FFDFFFE ),
+ extF80Const( 0x4044, 0xFFFFFF80000FFFFF ),
+ extF80Const( 0xBBFE, 0x8000040000001FFE ),
+ extF80Const( 0xC002, 0xFF80000000000020 ),
+ extF80Const( 0xDE8D, 0xFFFFFFFFFFE00004 ),
+ extF80Const( 0xC004, 0x8000000000003FFB ),
+ extF80Const( 0x407F, 0x800000000003FFFE ),
+ extF80Const( 0xC000, 0xA459EE6A5C16CA55 ),
+ extF80Const( 0x8003, 0xC42CBF7399AEEB94 ),
+ extF80Const( 0xBF7F, 0xF800000000000006 ),
+ extF80Const( 0xC07F, 0xBF56BE8871F28FEA ),
+ extF80Const( 0xC07E, 0xFFFF77FFFFFFFFFE ),
+ extF80Const( 0xADC9, 0x8000000FFFFFFFDE ),
+ extF80Const( 0xC001, 0xEFF7FFFFFFFFFFFF ),
+ extF80Const( 0x4001, 0xBE84F30125C497A6 ),
+ extF80Const( 0xC06B, 0xEFFFFFFFFFFFFFFF ),
+ extF80Const( 0x4080, 0xFFFFFFFFBFFFFFFF ),
+ extF80Const( 0x87E9, 0x81FFFFFFFFFFFBFF ),
+ extF80Const( 0xA63F, 0x801FFFFFFEFFFFFE ),
+ extF80Const( 0x403C, 0x801FFFFFFFF7FFFF ),
+ extF80Const( 0x4018, 0x8000000000080003 )
+ };
static
- void
- time_a_extF80_z_ui32_rx(
- uint_fast32_t function( const extFloat80_t *, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_extF80_z_ui32_rx(
+ uint_fast32_t function( const extFloat80_t *, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -2034,12 +2913,12 @@ static
}
static
- void
- time_a_extF80_z_ui64_rx(
- uint_fast64_t function( const extFloat80_t *, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_extF80_z_ui64_rx(
+ uint_fast64_t function( const extFloat80_t *, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -2069,12 +2948,12 @@ static
}
static
- void
- time_a_extF80_z_i32_rx(
- int_fast32_t function( const extFloat80_t *, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_extF80_z_i32_rx(
+ int_fast32_t function( const extFloat80_t *, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -2104,12 +2983,12 @@ static
}
static
- void
- time_a_extF80_z_i64_rx(
- int_fast64_t function( const extFloat80_t *, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_extF80_z_i64_rx(
+ int_fast64_t function( const extFloat80_t *, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -2139,9 +3018,9 @@ static
}
static
- void
- time_a_extF80_z_ui32_x(
- uint_fast32_t function( const extFloat80_t *, bool ), bool exact )
+void
+ time_a_extF80_z_ui32_x(
+ uint_fast32_t function( const extFloat80_t *, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -2171,9 +3050,9 @@ static
}
static
- void
- time_a_extF80_z_ui64_x(
- uint_fast64_t function( const extFloat80_t *, bool ), bool exact )
+void
+ time_a_extF80_z_ui64_x(
+ uint_fast64_t function( const extFloat80_t *, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -2203,9 +3082,9 @@ static
}
static
- void
- time_a_extF80_z_i32_x(
- int_fast32_t function( const extFloat80_t *, bool ), bool exact )
+void
+ time_a_extF80_z_i32_x(
+ int_fast32_t function( const extFloat80_t *, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -2235,9 +3114,9 @@ static
}
static
- void
- time_a_extF80_z_i64_x(
- int_fast64_t function( const extFloat80_t *, bool ), bool exact )
+void
+ time_a_extF80_z_i64_x(
+ int_fast64_t function( const extFloat80_t *, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -2266,6 +3145,39 @@ static
}
+#ifdef FLOAT16
+
+static void time_a_extF80_z_f16( float16_t function( const extFloat80_t * ) )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ function( &inputs_extF80[inputNum].f );
+ inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ function( &inputs_extF80[inputNum].f );
+ inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+#endif
+
static void time_a_extF80_z_f32( float32_t function( const extFloat80_t * ) )
{
int_fast64_t count;
@@ -2327,8 +3239,8 @@ static void time_a_extF80_z_f64( float64_t function( const extFloat80_t * ) )
#ifdef FLOAT128
static
- void
- time_a_extF80_z_f128( void function( const extFloat80_t *, float128_t * ) )
+void
+ time_a_extF80_z_f128( void function( const extFloat80_t *, float128_t * ) )
{
int_fast64_t count;
int inputNum;
@@ -2361,13 +3273,12 @@ static
#endif
static
- void
- time_az_extF80_rx(
- void
- function( const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_az_extF80_rx(
+ void function( const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -2398,11 +3309,11 @@ static
}
static
- void
- time_abz_extF80(
- void
- function( const extFloat80_t *, const extFloat80_t *, extFloat80_t * )
- )
+void
+ time_abz_extF80(
+ void
+ function( const extFloat80_t *, const extFloat80_t *, extFloat80_t * )
+ )
{
int_fast64_t count;
int inputNumA, inputNumB;
@@ -2441,16 +3352,16 @@ static
}
static
- void
- time_abcz_extF80(
- void
- function(
- const extFloat80_t *,
- const extFloat80_t *,
- const extFloat80_t *,
- extFloat80_t *
- )
- )
+void
+ time_abcz_extF80(
+ void
+ function(
+ const extFloat80_t *,
+ const extFloat80_t *,
+ const extFloat80_t *,
+ extFloat80_t *
+ )
+ )
{
int_fast64_t count;
int inputNumA, inputNumB, inputNumC;
@@ -2503,9 +3414,9 @@ static
}
static
- void
- time_ab_extF80_z_bool(
- bool function( const extFloat80_t *, const extFloat80_t * ) )
+void
+ time_ab_extF80_z_bool(
+ bool function( const extFloat80_t *, const extFloat80_t * ) )
{
int_fast64_t count;
int inputNumA, inputNumB;
@@ -2542,45 +3453,45 @@ static
}
static
- const union { struct extFloat80M s; extFloat80_t f; }
- inputs_extF80_pos[numInputs_extF80] = {
- extF80Const( 0x403F, 0xA9BE15A19C1E8B62 ),
- extF80Const( 0x0000, 0x0000000000000000 ),
- extF80Const( 0x75A8, 0xE59591E4788957A5 ),
- extF80Const( 0x3FFF, 0xFFF0000000000040 ),
- extF80Const( 0x0CD8, 0xFC000000000007FE ),
- extF80Const( 0x43BA, 0x99A4000000000000 ),
- extF80Const( 0x3FFF, 0x8000000000000000 ),
- extF80Const( 0x4081, 0x94FBF1BCEB5545F0 ),
- extF80Const( 0x403E, 0xFFF0000000002000 ),
- extF80Const( 0x3FFE, 0xC860E3C75D224F28 ),
- extF80Const( 0x407E, 0xFC00000FFFFFFFFE ),
- extF80Const( 0x737A, 0x800000007FFDFFFE ),
- extF80Const( 0x4044, 0xFFFFFF80000FFFFF ),
- extF80Const( 0x3BFE, 0x8000040000001FFE ),
- extF80Const( 0x4002, 0xFF80000000000020 ),
- extF80Const( 0x5E8D, 0xFFFFFFFFFFE00004 ),
- extF80Const( 0x4004, 0x8000000000003FFB ),
- extF80Const( 0x407F, 0x800000000003FFFE ),
- extF80Const( 0x4000, 0xA459EE6A5C16CA55 ),
- extF80Const( 0x0003, 0xC42CBF7399AEEB94 ),
- extF80Const( 0x3F7F, 0xF800000000000006 ),
- extF80Const( 0x407F, 0xBF56BE8871F28FEA ),
- extF80Const( 0x407E, 0xFFFF77FFFFFFFFFE ),
- extF80Const( 0x2DC9, 0x8000000FFFFFFFDE ),
- extF80Const( 0x4001, 0xEFF7FFFFFFFFFFFF ),
- extF80Const( 0x4001, 0xBE84F30125C497A6 ),
- extF80Const( 0x406B, 0xEFFFFFFFFFFFFFFF ),
- extF80Const( 0x4080, 0xFFFFFFFFBFFFFFFF ),
- extF80Const( 0x07E9, 0x81FFFFFFFFFFFBFF ),
- extF80Const( 0x263F, 0x801FFFFFFEFFFFFE ),
- extF80Const( 0x403C, 0x801FFFFFFFF7FFFF ),
- extF80Const( 0x4018, 0x8000000000080003 )
-};
+const union { struct extFloat80M s; extFloat80_t f; }
+ inputs_extF80_pos[numInputs_extF80] = {
+ extF80Const( 0x403F, 0xA9BE15A19C1E8B62 ),
+ extF80Const( 0x0000, 0x0000000000000000 ),
+ extF80Const( 0x75A8, 0xE59591E4788957A5 ),
+ extF80Const( 0x3FFF, 0xFFF0000000000040 ),
+ extF80Const( 0x0CD8, 0xFC000000000007FE ),
+ extF80Const( 0x43BA, 0x99A4000000000000 ),
+ extF80Const( 0x3FFF, 0x8000000000000000 ),
+ extF80Const( 0x4081, 0x94FBF1BCEB5545F0 ),
+ extF80Const( 0x403E, 0xFFF0000000002000 ),
+ extF80Const( 0x3FFE, 0xC860E3C75D224F28 ),
+ extF80Const( 0x407E, 0xFC00000FFFFFFFFE ),
+ extF80Const( 0x737A, 0x800000007FFDFFFE ),
+ extF80Const( 0x4044, 0xFFFFFF80000FFFFF ),
+ extF80Const( 0x3BFE, 0x8000040000001FFE ),
+ extF80Const( 0x4002, 0xFF80000000000020 ),
+ extF80Const( 0x5E8D, 0xFFFFFFFFFFE00004 ),
+ extF80Const( 0x4004, 0x8000000000003FFB ),
+ extF80Const( 0x407F, 0x800000000003FFFE ),
+ extF80Const( 0x4000, 0xA459EE6A5C16CA55 ),
+ extF80Const( 0x0003, 0xC42CBF7399AEEB94 ),
+ extF80Const( 0x3F7F, 0xF800000000000006 ),
+ extF80Const( 0x407F, 0xBF56BE8871F28FEA ),
+ extF80Const( 0x407E, 0xFFFF77FFFFFFFFFE ),
+ extF80Const( 0x2DC9, 0x8000000FFFFFFFDE ),
+ extF80Const( 0x4001, 0xEFF7FFFFFFFFFFFF ),
+ extF80Const( 0x4001, 0xBE84F30125C497A6 ),
+ extF80Const( 0x406B, 0xEFFFFFFFFFFFFFFF ),
+ extF80Const( 0x4080, 0xFFFFFFFFBFFFFFFF ),
+ extF80Const( 0x07E9, 0x81FFFFFFFFFFFBFF ),
+ extF80Const( 0x263F, 0x801FFFFFFEFFFFFE ),
+ extF80Const( 0x403C, 0x801FFFFFFFF7FFFF ),
+ extF80Const( 0x4018, 0x8000000000080003 )
+ };
static
- void
- time_az_extF80_pos( void function( const extFloat80_t *, extFloat80_t * ) )
+void
+ time_az_extF80_pos( void function( const extFloat80_t *, extFloat80_t * ) )
{
int_fast64_t count;
int inputNum;
@@ -2612,6 +3523,9 @@ static
#endif
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+
#ifdef FLOAT128
#ifdef LITTLEENDIAN
@@ -2623,49 +3537,49 @@ static
enum { numInputs_f128 = 32 };
static
- const union { struct uint128 ui; float128_t f; }
- inputs_f128[numInputs_f128] = {
- f128Const( 0x3FDA200000100000, 0x0000000000000000 ),
- f128Const( 0x3FFF000000000000, 0x0000000000000000 ),
- f128Const( 0x85F14776190C8306, 0xD8715F4E3D54BB92 ),
- f128Const( 0xF2B00000007FFFFF, 0xFFFFFFFFFFF7FFFF ),
- f128Const( 0x8000000000000000, 0x0000000000000000 ),
- f128Const( 0xBFFFFFFFFFE00000, 0x0000008000000000 ),
- f128Const( 0x407F1719CE722F3E, 0xDA6B3FE5FF29425B ),
- f128Const( 0x43FFFF8000000000, 0x0000000000400000 ),
- f128Const( 0x401E000000000100, 0x0000000000002000 ),
- f128Const( 0x3FFED71DACDA8E47, 0x4860E3C75D224F28 ),
- f128Const( 0xBF7ECFC1E90647D1, 0x7A124FE55623EE44 ),
- f128Const( 0x0DF7007FFFFFFFFF, 0xFFFFFFFFEFFFFFFF ),
- f128Const( 0x3FE5FFEFFFFFFFFF, 0xFFFFFFFFFFFFEFFF ),
- f128Const( 0x403FFFFFFFFFFFFF, 0xFFFFFFFFFFFFFBFE ),
- f128Const( 0xBFFB2FBF7399AFEB, 0xA459EE6A5C16CA55 ),
- f128Const( 0xBDB8FFFFFFFFFFFC, 0x0000000000000400 ),
- f128Const( 0x3FC8FFDFFFFFFFFF, 0xFFFFFFFFF0000000 ),
- f128Const( 0x3FFBFFFFFFDFFFFF, 0xFFF8000000000000 ),
- f128Const( 0x407043C11737BE84, 0xDDD58212ADC937F4 ),
- f128Const( 0x8001000000000000, 0x0000001000000001 ),
- f128Const( 0xC036FFFFFFFFFFFF, 0xFE40000000000000 ),
- f128Const( 0x4002FFFFFE000002, 0x0000000000000000 ),
- f128Const( 0x4000C3FEDE897773, 0x326AC4FD8EFBE6DC ),
- f128Const( 0xBFFF0000000FFFFF, 0xFFFFFE0000000000 ),
- f128Const( 0x62C3E502146E426D, 0x43F3CAA0DC7DF1A0 ),
- f128Const( 0xB5CBD32E52BB570E, 0xBCC477CB11C6236C ),
- f128Const( 0xE228FFFFFFC00000, 0x0000000000000000 ),
- f128Const( 0x3F80000000000000, 0x0000000080000008 ),
- f128Const( 0xC1AFFFDFFFFFFFFF, 0xFFFC000000000000 ),
- f128Const( 0xC96F000000000000, 0x00000001FFFBFFFF ),
- f128Const( 0x3DE09BFE7923A338, 0xBCC8FBBD7CEC1F4F ),
- f128Const( 0x401CFFFFFFFFFFFF, 0xFFFFFFFEFFFFFF80 )
-};
+const union { struct uint128 ui; float128_t f; }
+ inputs_f128[numInputs_f128] = {
+ f128Const( 0x3FDA200000100000, 0x0000000000000000 ),
+ f128Const( 0x3FFF000000000000, 0x0000000000000000 ),
+ f128Const( 0x85F14776190C8306, 0xD8715F4E3D54BB92 ),
+ f128Const( 0xF2B00000007FFFFF, 0xFFFFFFFFFFF7FFFF ),
+ f128Const( 0x8000000000000000, 0x0000000000000000 ),
+ f128Const( 0xBFFFFFFFFFE00000, 0x0000008000000000 ),
+ f128Const( 0x407F1719CE722F3E, 0xDA6B3FE5FF29425B ),
+ f128Const( 0x43FFFF8000000000, 0x0000000000400000 ),
+ f128Const( 0x401E000000000100, 0x0000000000002000 ),
+ f128Const( 0x3FFED71DACDA8E47, 0x4860E3C75D224F28 ),
+ f128Const( 0xBF7ECFC1E90647D1, 0x7A124FE55623EE44 ),
+ f128Const( 0x0DF7007FFFFFFFFF, 0xFFFFFFFFEFFFFFFF ),
+ f128Const( 0x3FE5FFEFFFFFFFFF, 0xFFFFFFFFFFFFEFFF ),
+ f128Const( 0x403FFFFFFFFFFFFF, 0xFFFFFFFFFFFFFBFE ),
+ f128Const( 0xBFFB2FBF7399AFEB, 0xA459EE6A5C16CA55 ),
+ f128Const( 0xBDB8FFFFFFFFFFFC, 0x0000000000000400 ),
+ f128Const( 0x3FC8FFDFFFFFFFFF, 0xFFFFFFFFF0000000 ),
+ f128Const( 0x3FFBFFFFFFDFFFFF, 0xFFF8000000000000 ),
+ f128Const( 0x407043C11737BE84, 0xDDD58212ADC937F4 ),
+ f128Const( 0x8001000000000000, 0x0000001000000001 ),
+ f128Const( 0xC036FFFFFFFFFFFF, 0xFE40000000000000 ),
+ f128Const( 0x4002FFFFFE000002, 0x0000000000000000 ),
+ f128Const( 0x4000C3FEDE897773, 0x326AC4FD8EFBE6DC ),
+ f128Const( 0xBFFF0000000FFFFF, 0xFFFFFE0000000000 ),
+ f128Const( 0x62C3E502146E426D, 0x43F3CAA0DC7DF1A0 ),
+ f128Const( 0xB5CBD32E52BB570E, 0xBCC477CB11C6236C ),
+ f128Const( 0xE228FFFFFFC00000, 0x0000000000000000 ),
+ f128Const( 0x3F80000000000000, 0x0000000080000008 ),
+ f128Const( 0xC1AFFFDFFFFFFFFF, 0xFFFC000000000000 ),
+ f128Const( 0xC96F000000000000, 0x00000001FFFBFFFF ),
+ f128Const( 0x3DE09BFE7923A338, 0xBCC8FBBD7CEC1F4F ),
+ f128Const( 0x401CFFFFFFFFFFFF, 0xFFFFFFFEFFFFFF80 )
+ };
static
- void
- time_a_f128_z_ui32_rx(
- uint_fast32_t function( const float128_t *, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_f128_z_ui32_rx(
+ uint_fast32_t function( const float128_t *, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -2695,12 +3609,12 @@ static
}
static
- void
- time_a_f128_z_ui64_rx(
- uint_fast64_t function( const float128_t *, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_f128_z_ui64_rx(
+ uint_fast64_t function( const float128_t *, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -2730,12 +3644,12 @@ static
}
static
- void
- time_a_f128_z_i32_rx(
- int_fast32_t function( const float128_t *, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_f128_z_i32_rx(
+ int_fast32_t function( const float128_t *, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -2765,12 +3679,12 @@ static
}
static
- void
- time_a_f128_z_i64_rx(
- int_fast64_t function( const float128_t *, uint_fast8_t, bool ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_a_f128_z_i64_rx(
+ int_fast64_t function( const float128_t *, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -2800,9 +3714,9 @@ static
}
static
- void
- time_a_f128_z_ui32_x(
- uint_fast32_t function( const float128_t *, bool ), bool exact )
+void
+ time_a_f128_z_ui32_x(
+ uint_fast32_t function( const float128_t *, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -2832,9 +3746,9 @@ static
}
static
- void
- time_a_f128_z_ui64_x(
- uint_fast64_t function( const float128_t *, bool ), bool exact )
+void
+ time_a_f128_z_ui64_x(
+ uint_fast64_t function( const float128_t *, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -2864,9 +3778,9 @@ static
}
static
- void
- time_a_f128_z_i32_x(
- int_fast32_t function( const float128_t *, bool ), bool exact )
+void
+ time_a_f128_z_i32_x(
+ int_fast32_t function( const float128_t *, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -2896,9 +3810,9 @@ static
}
static
- void
- time_a_f128_z_i64_x(
- int_fast64_t function( const float128_t *, bool ), bool exact )
+void
+ time_a_f128_z_i64_x(
+ int_fast64_t function( const float128_t *, bool ), bool exact )
{
int_fast64_t count;
int inputNum;
@@ -2927,6 +3841,39 @@ static
}
+#ifdef FLOAT16
+
+static void time_a_f128_z_f16( float16_t function( const float128_t * ) )
+{
+ int_fast64_t count;
+ int inputNum;
+ clock_t startClock;
+ int_fast64_t i;
+ clock_t endClock;
+
+ count = 0;
+ inputNum = 0;
+ startClock = clock();
+ do {
+ for ( i = minIterations; i; --i ) {
+ function( &inputs_f128[inputNum].f );
+ inputNum = (inputNum + 1) & (numInputs_f128 - 1);
+ }
+ count += minIterations;
+ } while ( clock() - startClock < CLOCKS_PER_SEC );
+ inputNum = 0;
+ startClock = clock();
+ for ( i = count; i; --i ) {
+ function( &inputs_f128[inputNum].f );
+ inputNum = (inputNum + 1) & (numInputs_f128 - 1);
+ }
+ endClock = clock();
+ reportTime( count, endClock - startClock );
+
+}
+
+#endif
+
static void time_a_f128_z_f32( float32_t function( const float128_t * ) )
{
int_fast64_t count;
@@ -2988,8 +3935,8 @@ static void time_a_f128_z_f64( float64_t function( const float128_t * ) )
#ifdef EXTFLOAT80
static
- void
- time_a_f128_z_extF80( void function( const float128_t *, extFloat80_t * ) )
+void
+ time_a_f128_z_extF80( void function( const float128_t *, extFloat80_t * ) )
{
int_fast64_t count;
int inputNum;
@@ -3022,12 +3969,12 @@ static
#endif
static
- void
- time_az_f128_rx(
- void function( const float128_t *, uint_fast8_t, bool, float128_t * ),
- uint_fast8_t roundingMode,
- bool exact
- )
+void
+ time_az_f128_rx(
+ void function( const float128_t *, uint_fast8_t, bool, float128_t * ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
{
int_fast64_t count;
int inputNum;
@@ -3058,9 +4005,9 @@ static
}
static
- void
- time_abz_f128(
- void function( const float128_t *, const float128_t *, float128_t * ) )
+void
+ time_abz_f128(
+ void function( const float128_t *, const float128_t *, float128_t * ) )
{
int_fast64_t count;
int inputNumA, inputNumB;
@@ -3098,16 +4045,16 @@ static
}
static
- void
- time_abcz_f128(
- void
- function(
- const float128_t *,
- const float128_t *,
- const float128_t *,
- float128_t *
- )
- )
+void
+ time_abcz_f128(
+ void
+ function(
+ const float128_t *,
+ const float128_t *,
+ const float128_t *,
+ float128_t *
+ )
+ )
{
int_fast64_t count;
int inputNumA, inputNumB, inputNumC;
@@ -3160,9 +4107,8 @@ static
}
static
- void
- time_ab_f128_z_bool(
- bool function( const float128_t *, const float128_t * ) )
+void
+ time_ab_f128_z_bool( bool function( const float128_t *, const float128_t * ) )
{
int_fast64_t count;
int inputNumA, inputNumB;
@@ -3198,44 +4144,44 @@ static
}
static
- const union { struct uint128 ui; float128_t f; }
- inputs_f128_pos[numInputs_f128] = {
- f128Const( 0x3FDA200000100000, 0x0000000000000000 ),
- f128Const( 0x3FFF000000000000, 0x0000000000000000 ),
- f128Const( 0x05F14776190C8306, 0xD8715F4E3D54BB92 ),
- f128Const( 0x72B00000007FFFFF, 0xFFFFFFFFFFF7FFFF ),
- f128Const( 0x0000000000000000, 0x0000000000000000 ),
- f128Const( 0x3FFFFFFFFFE00000, 0x0000008000000000 ),
- f128Const( 0x407F1719CE722F3E, 0xDA6B3FE5FF29425B ),
- f128Const( 0x43FFFF8000000000, 0x0000000000400000 ),
- f128Const( 0x401E000000000100, 0x0000000000002000 ),
- f128Const( 0x3FFED71DACDA8E47, 0x4860E3C75D224F28 ),
- f128Const( 0x3F7ECFC1E90647D1, 0x7A124FE55623EE44 ),
- f128Const( 0x0DF7007FFFFFFFFF, 0xFFFFFFFFEFFFFFFF ),
- f128Const( 0x3FE5FFEFFFFFFFFF, 0xFFFFFFFFFFFFEFFF ),
- f128Const( 0x403FFFFFFFFFFFFF, 0xFFFFFFFFFFFFFBFE ),
- f128Const( 0x3FFB2FBF7399AFEB, 0xA459EE6A5C16CA55 ),
- f128Const( 0x3DB8FFFFFFFFFFFC, 0x0000000000000400 ),
- f128Const( 0x3FC8FFDFFFFFFFFF, 0xFFFFFFFFF0000000 ),
- f128Const( 0x3FFBFFFFFFDFFFFF, 0xFFF8000000000000 ),
- f128Const( 0x407043C11737BE84, 0xDDD58212ADC937F4 ),
- f128Const( 0x0001000000000000, 0x0000001000000001 ),
- f128Const( 0x4036FFFFFFFFFFFF, 0xFE40000000000000 ),
- f128Const( 0x4002FFFFFE000002, 0x0000000000000000 ),
- f128Const( 0x4000C3FEDE897773, 0x326AC4FD8EFBE6DC ),
- f128Const( 0x3FFF0000000FFFFF, 0xFFFFFE0000000000 ),
- f128Const( 0x62C3E502146E426D, 0x43F3CAA0DC7DF1A0 ),
- f128Const( 0x35CBD32E52BB570E, 0xBCC477CB11C6236C ),
- f128Const( 0x6228FFFFFFC00000, 0x0000000000000000 ),
- f128Const( 0x3F80000000000000, 0x0000000080000008 ),
- f128Const( 0x41AFFFDFFFFFFFFF, 0xFFFC000000000000 ),
- f128Const( 0x496F000000000000, 0x00000001FFFBFFFF ),
- f128Const( 0x3DE09BFE7923A338, 0xBCC8FBBD7CEC1F4F ),
- f128Const( 0x401CFFFFFFFFFFFF, 0xFFFFFFFEFFFFFF80 )
-};
+const union { struct uint128 ui; float128_t f; }
+ inputs_f128_pos[numInputs_f128] = {
+ f128Const( 0x3FDA200000100000, 0x0000000000000000 ),
+ f128Const( 0x3FFF000000000000, 0x0000000000000000 ),
+ f128Const( 0x05F14776190C8306, 0xD8715F4E3D54BB92 ),
+ f128Const( 0x72B00000007FFFFF, 0xFFFFFFFFFFF7FFFF ),
+ f128Const( 0x0000000000000000, 0x0000000000000000 ),
+ f128Const( 0x3FFFFFFFFFE00000, 0x0000008000000000 ),
+ f128Const( 0x407F1719CE722F3E, 0xDA6B3FE5FF29425B ),
+ f128Const( 0x43FFFF8000000000, 0x0000000000400000 ),
+ f128Const( 0x401E000000000100, 0x0000000000002000 ),
+ f128Const( 0x3FFED71DACDA8E47, 0x4860E3C75D224F28 ),
+ f128Const( 0x3F7ECFC1E90647D1, 0x7A124FE55623EE44 ),
+ f128Const( 0x0DF7007FFFFFFFFF, 0xFFFFFFFFEFFFFFFF ),
+ f128Const( 0x3FE5FFEFFFFFFFFF, 0xFFFFFFFFFFFFEFFF ),
+ f128Const( 0x403FFFFFFFFFFFFF, 0xFFFFFFFFFFFFFBFE ),
+ f128Const( 0x3FFB2FBF7399AFEB, 0xA459EE6A5C16CA55 ),
+ f128Const( 0x3DB8FFFFFFFFFFFC, 0x0000000000000400 ),
+ f128Const( 0x3FC8FFDFFFFFFFFF, 0xFFFFFFFFF0000000 ),
+ f128Const( 0x3FFBFFFFFFDFFFFF, 0xFFF8000000000000 ),
+ f128Const( 0x407043C11737BE84, 0xDDD58212ADC937F4 ),
+ f128Const( 0x0001000000000000, 0x0000001000000001 ),
+ f128Const( 0x4036FFFFFFFFFFFF, 0xFE40000000000000 ),
+ f128Const( 0x4002FFFFFE000002, 0x0000000000000000 ),
+ f128Const( 0x4000C3FEDE897773, 0x326AC4FD8EFBE6DC ),
+ f128Const( 0x3FFF0000000FFFFF, 0xFFFFFE0000000000 ),
+ f128Const( 0x62C3E502146E426D, 0x43F3CAA0DC7DF1A0 ),
+ f128Const( 0x35CBD32E52BB570E, 0xBCC477CB11C6236C ),
+ f128Const( 0x6228FFFFFFC00000, 0x0000000000000000 ),
+ f128Const( 0x3F80000000000000, 0x0000000080000008 ),
+ f128Const( 0x41AFFFDFFFFFFFFF, 0xFFFC000000000000 ),
+ f128Const( 0x496F000000000000, 0x00000001FFFBFFFF ),
+ f128Const( 0x3DE09BFE7923A338, 0xBCC8FBBD7CEC1F4F ),
+ f128Const( 0x401CFFFFFFFFFFFF, 0xFFFFFFFEFFFFFF80 )
+ };
static
- void time_az_f128_pos( void function( const float128_t *, float128_t * ) )
+void time_az_f128_pos( void function( const float128_t *, float128_t * ) )
{
int_fast64_t count;
int inputNum;
@@ -3267,11 +4213,18 @@ static
#endif
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+
static
- void
- timeFunctionInstance(
- int functionCode, uint_fast8_t roundingMode, bool exact )
+void
+ timeFunctionInstance(
+ int functionCode, uint_fast8_t roundingMode, bool exact )
{
+#ifdef FLOAT16
+ float16_t (*function_abz_f16)( float16_t, float16_t );
+ bool (*function_ab_f16_z_bool)( float16_t, float16_t );
+#endif
float32_t (*function_abz_f32)( float32_t, float32_t );
bool (*function_ab_f32_z_bool)( float32_t, float32_t );
float64_t (*function_abz_f64)( float64_t, float64_t );
@@ -3294,6 +4247,11 @@ static
switch ( functionCode ) {
/*--------------------------------------------------------------------
*--------------------------------------------------------------------*/
+#ifdef FLOAT16
+ case UI32_TO_F16:
+ time_a_ui32_z_f16( ui32_to_f16 );
+ break;
+#endif
case UI32_TO_F32:
time_a_ui32_z_f32( ui32_to_f32 );
break;
@@ -3310,6 +4268,11 @@ static
time_a_ui32_z_f128( ui32_to_f128M );
break;
#endif
+#ifdef FLOAT16
+ case UI64_TO_F16:
+ time_a_ui64_z_f16( ui64_to_f16 );
+ break;
+#endif
case UI64_TO_F32:
time_a_ui64_z_f32( ui64_to_f32 );
break;
@@ -3326,6 +4289,11 @@ static
time_a_ui64_z_f128( ui64_to_f128M );
break;
#endif
+#ifdef FLOAT16
+ case I32_TO_F16:
+ time_a_i32_z_f16( i32_to_f16 );
+ break;
+#endif
case I32_TO_F32:
time_a_i32_z_f32( i32_to_f32 );
break;
@@ -3342,6 +4310,11 @@ static
time_a_i32_z_f128( i32_to_f128M );
break;
#endif
+#ifdef FLOAT16
+ case I64_TO_F16:
+ time_a_i64_z_f16( i64_to_f16 );
+ break;
+#endif
case I64_TO_F32:
time_a_i64_z_f32( i64_to_f32 );
break;
@@ -3360,6 +4333,96 @@ static
#endif
/*--------------------------------------------------------------------
*--------------------------------------------------------------------*/
+#ifdef FLOAT16
+ case F16_TO_UI32:
+ time_a_f16_z_ui32_rx( f16_to_ui32, roundingMode, exact );
+ break;
+ case F16_TO_UI64:
+ time_a_f16_z_ui64_rx( f16_to_ui64, roundingMode, exact );
+ break;
+ case F16_TO_I32:
+ time_a_f16_z_i32_rx( f16_to_i32, roundingMode, exact );
+ break;
+ case F16_TO_I64:
+ time_a_f16_z_i64_rx( f16_to_i64, roundingMode, exact );
+ break;
+ case F16_TO_UI32_R_MINMAG:
+ time_a_f16_z_ui32_x( f16_to_ui32_r_minMag, exact );
+ break;
+ case F16_TO_UI64_R_MINMAG:
+ time_a_f16_z_ui64_x( f16_to_ui64_r_minMag, exact );
+ break;
+ case F16_TO_I32_R_MINMAG:
+ time_a_f16_z_i32_x( f16_to_i32_r_minMag, exact );
+ break;
+ case F16_TO_I64_R_MINMAG:
+ time_a_f16_z_i64_x( f16_to_i64_r_minMag, exact );
+ break;
+ case F16_TO_F32:
+ time_a_f16_z_f32( f16_to_f32 );
+ break;
+ case F16_TO_F64:
+ time_a_f16_z_f64( f16_to_f64 );
+ break;
+#ifdef EXTFLOAT80
+ case F16_TO_EXTF80:
+ time_a_f16_z_extF80( f16_to_extF80M );
+ break;
+#endif
+#ifdef FLOAT128
+ case F16_TO_F128:
+ time_a_f16_z_f128( f16_to_f128M );
+ break;
+#endif
+ case F16_ROUNDTOINT:
+ time_az_f16_rx( f16_roundToInt, roundingMode, exact );
+ break;
+ case F16_ADD:
+ function_abz_f16 = f16_add;
+ goto time_abz_f16;
+ case F16_SUB:
+ function_abz_f16 = f16_sub;
+ goto time_abz_f16;
+ case F16_MUL:
+ function_abz_f16 = f16_mul;
+ goto time_abz_f16;
+ case F16_DIV:
+ function_abz_f16 = f16_div;
+ goto time_abz_f16;
+ case F16_REM:
+ function_abz_f16 = f16_rem;
+ time_abz_f16:
+ time_abz_f16( function_abz_f16 );
+ break;
+ case F16_MULADD:
+ time_abcz_f16( f16_mulAdd );
+ break;
+ case F16_SQRT:
+ time_az_f16_pos( f16_sqrt );
+ break;
+ case F16_EQ:
+ function_ab_f16_z_bool = f16_eq;
+ goto time_ab_f16_z_bool;
+ case F16_LE:
+ function_ab_f16_z_bool = f16_le;
+ goto time_ab_f16_z_bool;
+ case F16_LT:
+ function_ab_f16_z_bool = f16_lt;
+ goto time_ab_f16_z_bool;
+ case F16_EQ_SIGNALING:
+ function_ab_f16_z_bool = f16_eq_signaling;
+ goto time_ab_f16_z_bool;
+ case F16_LE_QUIET:
+ function_ab_f16_z_bool = f16_le_quiet;
+ goto time_ab_f16_z_bool;
+ case F16_LT_QUIET:
+ function_ab_f16_z_bool = f16_lt_quiet;
+ time_ab_f16_z_bool:
+ time_ab_f16_z_bool( function_ab_f16_z_bool );
+ break;
+#endif
+ /*--------------------------------------------------------------------
+ *--------------------------------------------------------------------*/
case F32_TO_UI32:
time_a_f32_z_ui32_rx( f32_to_ui32, roundingMode, exact );
break;
@@ -3384,6 +4447,11 @@ static
case F32_TO_I64_R_MINMAG:
time_a_f32_z_i64_x( f32_to_i64_r_minMag, exact );
break;
+#ifdef FLOAT16
+ case F32_TO_F16:
+ time_a_f32_z_f16( f32_to_f16 );
+ break;
+#endif
case F32_TO_F64:
time_a_f32_z_f64( f32_to_f64 );
break;
@@ -3469,6 +4537,11 @@ static
case F64_TO_I64_R_MINMAG:
time_a_f64_z_i64_x( f64_to_i64_r_minMag, exact );
break;
+#ifdef FLOAT16
+ case F64_TO_F16:
+ time_a_f64_z_f16( f64_to_f16 );
+ break;
+#endif
case F64_TO_F32:
time_a_f64_z_f32( f64_to_f32 );
break;
@@ -3555,6 +4628,11 @@ static
case EXTF80_TO_I64_R_MINMAG:
time_a_extF80_z_i64_x( extF80M_to_i64_r_minMag, exact );
break;
+#ifdef FLOAT16
+ case EXTF80_TO_F16:
+ time_a_extF80_z_f16( extF80M_to_f16 );
+ break;
+#endif
case EXTF80_TO_F32:
time_a_extF80_z_f32( extF80M_to_f32 );
break;
@@ -3637,6 +4715,11 @@ static
case F128_TO_I64_R_MINMAG:
time_a_f128_z_i64_x( f128M_to_i64_r_minMag, exact );
break;
+#ifdef FLOAT16
+ case F128_TO_F16:
+ time_a_f128_z_f16( f128M_to_f16 );
+ break;
+#endif
case F128_TO_F32:
time_a_f128_z_f32( f128M_to_f32 );
break;
@@ -3702,14 +4785,14 @@ static
enum { EXACT_FALSE = 1, EXACT_TRUE };
static
- void
- timeFunction(
- int functionCode,
- uint_fast8_t roundingPrecisionIn,
- int roundingCodeIn,
- int tininessCodeIn,
- int exactCodeIn
- )
+void
+ timeFunction(
+ int functionCode,
+ uint_fast8_t roundingPrecisionIn,
+ int roundingCodeIn,
+ int tininessCodeIn,
+ int exactCodeIn
+ )
{
int functionAttribs, exactCode;
uint_fast8_t roundingMode, tininessMode;
@@ -3858,6 +4941,9 @@ int main( int argc, char *argv[] )
" i32 --Signed 32-bit integer.\n"
" i64 --Signed 64-bit integer.\n"
" <float>:\n"
+#ifdef FLOAT16
+" f16 --Binary 16-bit floating-point (half-precision).\n"
+#endif
" f32 --Binary 32-bit floating-point (single-precision).\n"
" f64 --Binary 64-bit floating-point (double-precision).\n"
#ifdef EXTFLOAT80
@@ -3947,8 +5033,8 @@ int main( int argc, char *argv[] )
if (
! numOperands
|| (functionInfos[functionCode].attribs
- & (numOperands == 1) ? FUNC_ARG_UNARY
- : FUNC_ARG_BINARY)
+ & ((numOperands == 1) ? FUNC_ARG_UNARY
+ : FUNC_ARG_BINARY))
) {
timeFunction(
functionCode,
diff --git a/source/uint128.c b/source/uint128.c
index 779427f..e9b24e5 100644
--- a/source/uint128.c
+++ b/source/uint128.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/uint128.h b/source/uint128.h
index fefadbd..0f433bb 100644
--- a/source/uint128.h
+++ b/source/uint128.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -47,6 +47,8 @@ struct uint128 { uint64_t v0, v64; };
struct uint128 { uint64_t v64, v0; };
#endif
+#ifdef INLINE
+
INLINE bool eq128( struct uint128 a, struct uint128 b )
{ return (a.v64 == b.v64) && (a.v0 == b.v0); }
@@ -56,6 +58,14 @@ INLINE bool le128( struct uint128 a, struct uint128 b )
INLINE bool lt128( struct uint128 a, struct uint128 b )
{ return (a.v64 < b.v64) || ((a.v64 == b.v64) && (a.v0 < b.v0)); }
+#else
+
+bool eq128( struct uint128, struct uint128 );
+bool le128( struct uint128, struct uint128 );
+bool lt128( struct uint128, struct uint128 );
+
+#endif
+
struct uint128 shortShiftLeft128( struct uint128, int );
struct uint128 shortShiftRight128( struct uint128, int );
struct uint128 shortShiftRightJam128( struct uint128, int );
diff --git a/source/uint128_inline.c b/source/uint128_inline.c
new file mode 100644
index 0000000..4f5f60f
--- /dev/null
+++ b/source/uint128_inline.c
@@ -0,0 +1,56 @@
+
+/*============================================================================
+
+This C header file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "platform.h"
+
+#ifdef LITTLEENDIAN
+struct uint128 { uint64_t v0, v64; };
+#else
+struct uint128 { uint64_t v64, v0; };
+#endif
+
+bool eq128( struct uint128 a, struct uint128 b )
+ { return (a.v64 == b.v64) && (a.v0 == b.v0); }
+
+bool le128( struct uint128 a, struct uint128 b )
+ { return (a.v64 < b.v64) || ((a.v64 == b.v64) && (a.v0 <= b.v0)); }
+
+bool lt128( struct uint128 a, struct uint128 b )
+ { return (a.v64 < b.v64) || ((a.v64 == b.v64) && (a.v0 < b.v0)); }
+
diff --git a/source/verCases.h b/source/verCases.h
index ad7fd9a..941a0e5 100644
--- a/source/verCases.h
+++ b/source/verCases.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -64,6 +64,27 @@ void verCases_exitWithStatus( void );
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+#ifdef INLINE
+
+#ifdef FLOAT16
+
+INLINE bool f16_same( float16_t a, float16_t b )
+{
+ union { uint16_t ui; float16_t f; } uA, uB;
+ uA.f = a;
+ uB.f = b;
+ return (uA.ui == uB.ui);
+}
+
+INLINE bool f16_isNaN( float16_t a )
+{
+ union { uint16_t ui; float16_t f; } uA;
+ uA.f = a;
+ return 0x7C00 < (uA.ui & 0x7FFF);
+}
+
+#endif
+
INLINE bool f32_same( float32_t a, float32_t b )
{
union { uint32_t ui; float32_t f; } uA, uB;
@@ -136,6 +157,27 @@ INLINE bool f128M_isNaN( const float128_t *aPtr )
#endif
+#else
+
+#ifdef FLOAT16
+bool f16_same( float16_t, float16_t );
+bool f16_isNaN( float16_t );
+#endif
+bool f32_same( float32_t, float32_t );
+bool f32_isNaN( float32_t );
+bool f64_same( float64_t, float64_t );
+bool f64_isNaN( float64_t );
+#ifdef EXTFLOAT80
+bool extF80M_same( const extFloat80_t *, const extFloat80_t * );
+bool extF80M_isNaN( const extFloat80_t * );
+#endif
+#ifdef FLOAT128
+bool f128M_same( const float128_t *, const float128_t * );
+bool f128M_isNaN( const float128_t * );
+#endif
+
+#endif
+
extern uint_fast32_t verCases_tenThousandsCount, verCases_errorCount;
void verCases_writeTestsPerformed( int );
diff --git a/source/verCases_common.c b/source/verCases_common.c
index 6a18b40..db8e588 100644
--- a/source/verCases_common.c
+++ b/source/verCases_common.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/verCases_inline.c b/source/verCases_inline.c
new file mode 100644
index 0000000..0cdc479
--- /dev/null
+++ b/source/verCases_inline.c
@@ -0,0 +1,134 @@
+
+/*============================================================================
+
+This C header file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "platform.h"
+#include "uint128.h"
+#include "softfloat.h"
+
+#ifdef FLOAT16
+
+bool f16_same( float16_t a, float16_t b )
+{
+ union { uint16_t ui; float16_t f; } uA, uB;
+ uA.f = a;
+ uB.f = b;
+ return (uA.ui == uB.ui);
+}
+
+bool f16_isNaN( float16_t a )
+{
+ union { uint16_t ui; float16_t f; } uA;
+ uA.f = a;
+ return 0x7C00 < (uA.ui & 0x7FFF);
+}
+
+#endif
+
+bool f32_same( float32_t a, float32_t b )
+{
+ union { uint32_t ui; float32_t f; } uA, uB;
+ uA.f = a;
+ uB.f = b;
+ return (uA.ui == uB.ui);
+}
+
+bool f32_isNaN( float32_t a )
+{
+ union { uint32_t ui; float32_t f; } uA;
+ uA.f = a;
+ return 0x7F800000 < (uA.ui & 0x7FFFFFFF);
+}
+
+bool f64_same( float64_t a, float64_t b )
+{
+ union { uint64_t ui; float64_t f; } uA, uB;
+ uA.f = a;
+ uB.f = b;
+ return (uA.ui == uB.ui);
+}
+
+bool f64_isNaN( float64_t a )
+{
+ union { uint64_t ui; float64_t f; } uA;
+ uA.f = a;
+ return
+ UINT64_C( 0x7FF0000000000000 )
+ < (uA.ui & UINT64_C( 0x7FFFFFFFFFFFFFFF ));
+}
+
+#ifdef EXTFLOAT80
+
+bool extF80M_same( const extFloat80_t *aPtr, const extFloat80_t *bPtr )
+{
+ const struct extFloat80M *aSPtr = (const struct extFloat80M *) aPtr;
+ const struct extFloat80M *bSPtr = (const struct extFloat80M *) bPtr;
+ return
+ (aSPtr->signExp == bSPtr->signExp) && (aSPtr->signif == bSPtr->signif);
+}
+
+bool extF80M_isNaN( const extFloat80_t *aPtr )
+{
+ const struct extFloat80M *aSPtr = (const struct extFloat80M *) aPtr;
+ return
+ ((aSPtr->signExp & 0x7FFF) == 0x7FFF)
+ && (aSPtr->signif & UINT64_C( 0x7FFFFFFFFFFFFFFF ));
+}
+
+#endif
+
+#ifdef FLOAT128
+
+bool f128M_same( const float128_t *aPtr, const float128_t *bPtr )
+{
+ const struct uint128 *uiAPtr = (const struct uint128 *) aPtr;
+ const struct uint128 *uiBPtr = (const struct uint128 *) bPtr;
+ return (uiAPtr->v64 == uiBPtr->v64) && (uiAPtr->v0 == uiBPtr->v0);
+}
+
+bool f128M_isNaN( const float128_t *aPtr )
+{
+ const struct uint128 *uiAPtr = (const struct uint128 *) aPtr;
+ uint_fast64_t absA64 = uiAPtr->v64 & UINT64_C( 0x7FFFFFFFFFFFFFFF );
+ return
+ (UINT64_C( 0x7FFF000000000000 ) < absA64)
+ || ((absA64 == UINT64_C( 0x7FFF000000000000 )) && uiAPtr->v0);
+}
+
+#endif
+
diff --git a/source/verCases_writeFunctionName.c b/source/verCases_writeFunctionName.c
index 4c225d0..93c91ac 100644
--- a/source/verCases_writeFunctionName.c
+++ b/source/verCases_writeFunctionName.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/verLoops.c b/source/verLoops.c
index d5b78d6..ff61436 100644
--- a/source/verLoops.c
+++ b/source/verLoops.c
@@ -1,12 +1,12 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -114,6 +114,19 @@ static void readVerInput_i64( int_fast64_t *aPtr )
}
+#ifdef FLOAT16
+
+static void readVerInput_f16( float16_t *aPtr )
+{
+ union { uint16_t ui; float16_t f; } uA;
+
+ if ( ! readHex_ui16( &uA.ui, ' ' ) ) failFromBadInput();
+ *aPtr = uA.f;
+
+}
+
+#endif
+
static void readVerInput_f32( float32_t *aPtr )
{
union { uint32_t ui; float32_t f; } uA;
@@ -187,6 +200,55 @@ static void readVerInput_flags( uint_fast8_t *flagsPtr )
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+
+#ifdef FLOAT16
+
+void ver_a_ui32_z_f16( float16_t trueFunction( uint32_t ) )
+{
+ int count;
+ uint_fast32_t a;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_ui32( &a );
+ readVerInput_f16( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_ui32( a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
void ver_a_ui32_z_f32( float32_t trueFunction( uint32_t ) )
{
int count;
@@ -373,6 +435,55 @@ void ver_a_ui32_z_f128( void trueFunction( uint32_t, float128_t * ) )
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+
+#ifdef FLOAT16
+
+void ver_a_ui64_z_f16( float16_t trueFunction( uint64_t ) )
+{
+ int count;
+ uint_fast64_t a;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_ui64( &a );
+ readVerInput_f16( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_ui64( a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
void ver_a_ui64_z_f32( float32_t trueFunction( uint64_t ) )
{
int count;
@@ -559,6 +670,55 @@ void ver_a_ui64_z_f128( void trueFunction( uint64_t, float128_t * ) )
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+
+#ifdef FLOAT16
+
+void ver_a_i32_z_f16( float16_t trueFunction( int32_t ) )
+{
+ int count;
+ int_fast32_t a;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_i32( &a );
+ readVerInput_f16( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_i32( a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
void ver_a_i32_z_f32( float32_t trueFunction( int32_t ) )
{
int count;
@@ -745,6 +905,55 @@ void ver_a_i32_z_f128( void trueFunction( int32_t, float128_t * ) )
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+
+#ifdef FLOAT16
+
+void ver_a_i64_z_f16( float16_t trueFunction( int64_t ) )
+{
+ int count;
+ int_fast64_t a;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_i64( &a );
+ readVerInput_f16( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_i64( a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
void ver_a_i64_z_f32( float32_t trueFunction( int64_t ) )
{
int count;
@@ -931,6 +1140,852 @@ void ver_a_i64_z_f128( void trueFunction( int64_t, float128_t * ) )
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+
+#ifdef FLOAT16
+
+void
+ ver_a_f16_z_ui32_rx(
+ uint_fast32_t trueFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int count;
+ float16_t a;
+ uint_fast32_t subjZ;
+ uint_fast8_t subjFlags;
+ uint_fast32_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_ui32( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a, roundingMode, exact );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != 0xFFFFFFFF)
+ || (subjZ != 0xFFFFFFFF)
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( a, " " );
+ writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+void
+ ver_a_f16_z_ui64_rx(
+ uint_fast64_t trueFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int count;
+ float16_t a;
+ uint_fast64_t subjZ;
+ uint_fast8_t subjFlags;
+ uint_fast64_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_ui64( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a, roundingMode, exact );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != UINT64_C( 0xFFFFFFFFFFFFFFFF ))
+ || (subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF ))
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( a, " " );
+ writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+void
+ ver_a_f16_z_i32_rx(
+ int_fast32_t trueFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int count;
+ float16_t a;
+ int_fast32_t subjZ;
+ uint_fast8_t subjFlags;
+ int_fast32_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_i32( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a, roundingMode, exact );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != 0x7FFFFFFF)
+ || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1))
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( a, " " );
+ writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+void
+ ver_a_f16_z_i64_rx(
+ int_fast64_t trueFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int count;
+ float16_t a;
+ int_fast64_t subjZ;
+ uint_fast8_t subjFlags;
+ int_fast64_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_i64( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a, roundingMode, exact );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != INT64_C( 0x7FFFFFFFFFFFFFFF ))
+ || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF ))
+ && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1))
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( a, " " );
+ writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+void
+ ver_a_f16_z_ui32_x(
+ uint_fast32_t trueFunction( float16_t, bool ), bool exact )
+{
+ int count;
+ float16_t a;
+ uint_fast32_t subjZ;
+ uint_fast8_t subjFlags;
+ uint_fast32_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_ui32( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a, exact );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != 0xFFFFFFFF)
+ || (subjZ != 0xFFFFFFFF)
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( a, " " );
+ writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+void
+ ver_a_f16_z_ui64_x(
+ uint_fast64_t trueFunction( float16_t, bool ), bool exact )
+{
+ int count;
+ float16_t a;
+ uint_fast64_t subjZ;
+ uint_fast8_t subjFlags;
+ uint_fast64_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_ui64( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a, exact );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != UINT64_C( 0xFFFFFFFFFFFFFFFF ))
+ || (subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF ))
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( a, " " );
+ writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+void
+ ver_a_f16_z_i32_x(
+ int_fast32_t trueFunction( float16_t, bool ), bool exact )
+{
+ int count;
+ float16_t a;
+ int_fast32_t subjZ;
+ uint_fast8_t subjFlags;
+ int_fast32_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_i32( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a, exact );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != 0x7FFFFFFF)
+ || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1))
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( a, " " );
+ writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+void
+ ver_a_f16_z_i64_x(
+ int_fast64_t trueFunction( float16_t, bool ), bool exact )
+{
+ int count;
+ float16_t a;
+ int_fast64_t subjZ;
+ uint_fast8_t subjFlags;
+ int_fast64_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_i64( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a, exact );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ (trueZ != INT64_C( 0x7FFFFFFFFFFFFFFF ))
+ || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF ))
+ && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1))
+ || (trueFlags != softfloat_flag_invalid)
+ || (subjFlags != softfloat_flag_invalid)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( a, " " );
+ writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+void ver_a_f16_z_f32( float32_t trueFunction( float16_t ) )
+{
+ int count;
+ float16_t a;
+ float32_t subjZ;
+ uint_fast8_t subjFlags;
+ float32_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_f32( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f32_isNaN( trueZ )
+ || ! f32_isNaN( subjZ )
+ || f32_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( a, " " );
+ writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+void ver_a_f16_z_f64( float64_t trueFunction( float16_t ) )
+{
+ int count;
+ float16_t a;
+ float64_t subjZ;
+ uint_fast8_t subjFlags;
+ float64_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_f64( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f64_isNaN( trueZ )
+ || ! f64_isNaN( subjZ )
+ || f64_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( a, " " );
+ writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#ifdef EXTFLOAT80
+
+void ver_a_f16_z_extF80( void trueFunction( float16_t, extFloat80_t * ) )
+{
+ int count;
+ float16_t a;
+ extFloat80_t subjZ;
+ uint_fast8_t subjFlags;
+ extFloat80_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_extF80( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueFunction( a, &trueZ );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! extF80M_isNaN( &trueZ )
+ || ! extF80M_isNaN( &subjZ )
+ || extF80M_isSignalingNaN( &subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( a, " " );
+ writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
+#ifdef FLOAT128
+
+void ver_a_f16_z_f128( void trueFunction( float16_t, float128_t * ) )
+{
+ int count;
+ float16_t a;
+ float128_t subjZ;
+ uint_fast8_t subjFlags;
+ float128_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_f128( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueFunction( a, &trueZ );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f128M_isNaN( &trueZ )
+ || ! f128M_isNaN( &subjZ )
+ || f128M_isSignalingNaN( &subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( a, " " );
+ writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
+void ver_az_f16( float16_t trueFunction( float16_t ) )
+{
+ int count;
+ float16_t a, subjZ;
+ uint_fast8_t subjFlags;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_f16( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+void
+ ver_az_f16_rx(
+ float16_t trueFunction( float16_t, uint_fast8_t, bool ),
+ uint_fast8_t roundingMode,
+ bool exact
+ )
+{
+ int count;
+ float16_t a, subjZ;
+ uint_fast8_t subjFlags;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_f16( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a, roundingMode, exact );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f16( a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+void ver_abz_f16( float16_t trueFunction( float16_t, float16_t ) )
+{
+ int count;
+ float16_t a, b, subjZ;
+ uint_fast8_t subjFlags;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_f16( &b );
+ readVerInput_f16( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a, b );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs
+ && (f16_isSignalingNaN( a ) || f16_isSignalingNaN( b ))
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_ab_f16( a, b, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+void ver_abcz_f16( float16_t trueFunction( float16_t, float16_t, float16_t ) )
+{
+ int count;
+ float16_t a, b, c, subjZ;
+ uint_fast8_t subjFlags;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_f16( &b );
+ readVerInput_f16( &c );
+ readVerInput_f16( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a, b, c );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs
+ && (f16_isSignalingNaN( a ) || f16_isSignalingNaN( b )
+ || f16_isSignalingNaN( c ))
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_abc_f16( a, b, c, "\n\t" );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+void ver_ab_f16_z_bool( bool trueFunction( float16_t, float16_t ) )
+{
+ int count;
+ float16_t a, b;
+ bool subjZ;
+ uint_fast8_t subjFlags;
+ bool trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f16( &a );
+ readVerInput_f16( &b );
+ readVerInput_bool( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a, b );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ if (
+ ! verCases_checkNaNs
+ && (f16_isSignalingNaN( a ) || f16_isSignalingNaN( b ))
+ ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_ab_f16( a, b, " " );
+ writeCase_z_bool( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
+/*----------------------------------------------------------------------------
+*----------------------------------------------------------------------------*/
+
void
ver_a_f32_z_ui32_rx(
uint_fast32_t trueFunction( float32_t, uint_fast8_t, bool ),
@@ -1329,6 +2384,57 @@ void
}
+#ifdef FLOAT16
+
+void ver_a_f32_z_f16( float16_t trueFunction( float32_t ) )
+{
+ int count;
+ float32_t a;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f32( &a );
+ readVerInput_f16( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f32_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f32( a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
void ver_a_f32_z_f64( float64_t trueFunction( float32_t ) )
{
int count;
@@ -1724,6 +2830,7 @@ void ver_ab_f32_z_bool( bool trueFunction( float32_t, float32_t ) )
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+
void
ver_a_f64_z_ui32_rx(
uint_fast32_t trueFunction( float64_t, uint_fast8_t, bool ),
@@ -2122,6 +3229,57 @@ void
}
+#ifdef FLOAT16
+
+void ver_a_f64_z_f16( float16_t trueFunction( float64_t ) )
+{
+ int count;
+ float64_t a;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f64( &a );
+ readVerInput_f16( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( a );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f64_isSignalingNaN( a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f64( a, " " );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
void ver_a_f64_z_f32( float32_t trueFunction( float64_t ) )
{
int count;
@@ -2517,6 +3675,7 @@ void ver_ab_f64_z_bool( bool trueFunction( float64_t, float64_t ) )
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+
#ifdef EXTFLOAT80
void
@@ -2917,6 +4076,57 @@ void
}
+#ifdef FLOAT16
+
+void ver_a_extF80_z_f16( float16_t trueFunction( const extFloat80_t * ) )
+{
+ int count;
+ extFloat80_t a;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_extF80( &a );
+ readVerInput_f16( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( &a );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && extF80M_isSignalingNaN( &a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_extF80M( &a, "\n\t" );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
void ver_a_extF80_z_f32( float32_t trueFunction( const extFloat80_t * ) )
{
int count;
@@ -3207,7 +4417,7 @@ void
) {
++verCases_errorCount;
verCases_writeErrorFound( 10000 - count );
- writeCase_ab_extF80M( &a, &b, "\n\t" );
+ writeCase_ab_extF80M( &a, &b, " " );
writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags );
if ( verCases_errorCount == verCases_maxErrorCount ) break;
}
@@ -3332,6 +4542,7 @@ void
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
+
#ifdef FLOAT128
void
@@ -3732,6 +4943,57 @@ void
}
+#ifdef FLOAT16
+
+void ver_a_f128_z_f16( float16_t trueFunction( const float128_t * ) )
+{
+ int count;
+ float128_t a;
+ float16_t subjZ;
+ uint_fast8_t subjFlags;
+ float16_t trueZ;
+ uint_fast8_t trueFlags;
+
+ verCases_errorCount = 0;
+ verCases_tenThousandsCount = 0;
+ count = 10000;
+ while ( ! atEndOfInput() ) {
+ readVerInput_f128( &a );
+ readVerInput_f16( &subjZ );
+ readVerInput_flags( &subjFlags );
+ *verLoops_trueFlagsPtr = 0;
+ trueZ = trueFunction( &a );
+ trueFlags = *verLoops_trueFlagsPtr;
+ --count;
+ if ( ! count ) {
+ verCases_perTenThousand();
+ count = 10000;
+ }
+ if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) {
+ if ( ! verCases_checkNaNs && f128M_isSignalingNaN( &a ) ) {
+ trueFlags |= softfloat_flag_invalid;
+ }
+ if (
+ verCases_checkNaNs
+ || ! f16_isNaN( trueZ )
+ || ! f16_isNaN( subjZ )
+ || f16_isSignalingNaN( subjZ )
+ || (trueFlags != subjFlags)
+ ) {
+ ++verCases_errorCount;
+ verCases_writeErrorFound( 10000 - count );
+ writeCase_a_f128M( &a, "\n\t" );
+ writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags );
+ if ( verCases_errorCount == verCases_maxErrorCount ) break;
+ }
+ }
+ }
+ verCases_writeTestsPerformed( 10000 - count );
+
+}
+
+#endif
+
void ver_a_f128_z_f32( float32_t trueFunction( const float128_t * ) )
{
int count;
diff --git a/source/verLoops.h b/source/verLoops.h
index 324a250..347bda3 100644
--- a/source/verLoops.h
+++ b/source/verLoops.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -41,6 +41,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
extern uint_fast8_t *verLoops_trueFlagsPtr;
+#ifdef FLOAT16
+void ver_a_ui32_z_f16( float16_t ( uint32_t ) );
+#endif
void ver_a_ui32_z_f32( float32_t ( uint32_t ) );
void ver_a_ui32_z_f64( float64_t ( uint32_t ) );
#ifdef EXTFLOAT80
@@ -49,6 +52,9 @@ void ver_a_ui32_z_extF80( void ( uint32_t, extFloat80_t * ) );
#ifdef FLOAT128
void ver_a_ui32_z_f128( void ( uint32_t, float128_t * ) );
#endif
+#ifdef FLOAT16
+void ver_a_ui64_z_f16( float16_t ( uint64_t ) );
+#endif
void ver_a_ui64_z_f32( float32_t ( uint64_t ) );
void ver_a_ui64_z_f64( float64_t ( uint64_t ) );
#ifdef EXTFLOAT80
@@ -57,6 +63,9 @@ void ver_a_ui64_z_extF80( void ( uint64_t, extFloat80_t * ) );
#ifdef FLOAT128
void ver_a_ui64_z_f128( void ( uint64_t, float128_t * ) );
#endif
+#ifdef FLOAT16
+void ver_a_i32_z_f16( float16_t ( int32_t ) );
+#endif
void ver_a_i32_z_f32( float32_t ( int32_t ) );
void ver_a_i32_z_f64( float64_t ( int32_t ) );
#ifdef EXTFLOAT80
@@ -65,6 +74,9 @@ void ver_a_i32_z_extF80( void ( int32_t, extFloat80_t * ) );
#ifdef FLOAT128
void ver_a_i32_z_f128( void ( int32_t, float128_t * ) );
#endif
+#ifdef FLOAT16
+void ver_a_i64_z_f16( float16_t ( int64_t ) );
+#endif
void ver_a_i64_z_f32( float32_t ( int64_t ) );
void ver_a_i64_z_f64( float64_t ( int64_t ) );
#ifdef EXTFLOAT80
@@ -74,6 +86,40 @@ void ver_a_i64_z_extF80( void ( int64_t, extFloat80_t * ) );
void ver_a_i64_z_f128( void ( int64_t, float128_t * ) );
#endif
+#ifdef FLOAT16
+void
+ ver_a_f16_z_ui32_rx(
+ uint_fast32_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool );
+void
+ ver_a_f16_z_ui64_rx(
+ uint_fast64_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool );
+void
+ ver_a_f16_z_i32_rx(
+ int_fast32_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool );
+void
+ ver_a_f16_z_i64_rx(
+ int_fast64_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool );
+void ver_a_f16_z_ui32_x( uint_fast32_t ( float16_t, bool ), bool );
+void ver_a_f16_z_ui64_x( uint_fast64_t ( float16_t, bool ), bool );
+void ver_a_f16_z_i32_x( int_fast32_t ( float16_t, bool ), bool );
+void ver_a_f16_z_i64_x( int_fast64_t ( float16_t, bool ), bool );
+void ver_a_f16_z_f32( float32_t ( float16_t ) );
+void ver_a_f16_z_f64( float64_t ( float16_t ) );
+#ifdef EXTFLOAT80
+void ver_a_f16_z_extF80( void ( float16_t, extFloat80_t * ) );
+#endif
+#ifdef FLOAT128
+void ver_a_f16_z_f128( void ( float16_t, float128_t * ) );
+#endif
+void ver_az_f16( float16_t ( float16_t ) );
+void
+ ver_az_f16_rx(
+ float16_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool );
+void ver_abz_f16( float16_t ( float16_t, float16_t ) );
+void ver_abcz_f16( float16_t ( float16_t, float16_t, float16_t ) );
+void ver_ab_f16_z_bool( bool ( float16_t, float16_t ) );
+#endif
+
void
ver_a_f32_z_ui32_rx(
uint_fast32_t ( float32_t, uint_fast8_t, bool ), uint_fast8_t, bool );
@@ -90,6 +136,9 @@ void ver_a_f32_z_ui32_x( uint_fast32_t ( float32_t, bool ), bool );
void ver_a_f32_z_ui64_x( uint_fast64_t ( float32_t, bool ), bool );
void ver_a_f32_z_i32_x( int_fast32_t ( float32_t, bool ), bool );
void ver_a_f32_z_i64_x( int_fast64_t ( float32_t, bool ), bool );
+#ifdef FLOAT16
+void ver_a_f32_z_f16( float16_t ( float32_t ) );
+#endif
void ver_a_f32_z_f64( float64_t ( float32_t ) );
#ifdef EXTFLOAT80
void ver_a_f32_z_extF80( void ( float32_t, extFloat80_t * ) );
@@ -121,6 +170,9 @@ void ver_a_f64_z_ui32_x( uint_fast32_t ( float64_t, bool ), bool );
void ver_a_f64_z_ui64_x( uint_fast64_t ( float64_t, bool ), bool );
void ver_a_f64_z_i32_x( int_fast32_t ( float64_t, bool ), bool );
void ver_a_f64_z_i64_x( int_fast64_t ( float64_t, bool ), bool );
+#ifdef FLOAT16
+void ver_a_f64_z_f16( float16_t ( float64_t ) );
+#endif
void ver_a_f64_z_f32( float32_t ( float64_t ) );
#ifdef EXTFLOAT80
void ver_a_f64_z_extF80( void ( float64_t, extFloat80_t * ) );
@@ -167,6 +219,9 @@ void
ver_a_extF80_z_ui64_x( uint_fast64_t ( const extFloat80_t *, bool ), bool );
void ver_a_extF80_z_i32_x( int_fast32_t ( const extFloat80_t *, bool ), bool );
void ver_a_extF80_z_i64_x( int_fast64_t ( const extFloat80_t *, bool ), bool );
+#ifdef FLOAT16
+void ver_a_extF80_z_f16( float16_t ( const extFloat80_t * ) );
+#endif
void ver_a_extF80_z_f32( float32_t ( const extFloat80_t * ) );
void ver_a_extF80_z_f64( float64_t ( const extFloat80_t * ) );
#ifdef FLOAT128
@@ -225,6 +280,9 @@ void ver_a_f128_z_ui32_x( uint_fast32_t ( const float128_t *, bool ), bool );
void ver_a_f128_z_ui64_x( uint_fast64_t ( const float128_t *, bool ), bool );
void ver_a_f128_z_i32_x( int_fast32_t ( const float128_t *, bool ), bool );
void ver_a_f128_z_i64_x( int_fast64_t ( const float128_t *, bool ), bool );
+#ifdef FLOAT16
+void ver_a_f128_z_f16( float16_t ( const float128_t * ) );
+#endif
void ver_a_f128_z_f32( float32_t ( const float128_t * ) );
void ver_a_f128_z_f64( float64_t ( const float128_t * ) );
#ifdef EXTFLOAT80
diff --git a/source/writeCase.h b/source/writeCase.h
index de9005c..f8eb025 100644
--- a/source/writeCase.h
+++ b/source/writeCase.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -43,6 +43,11 @@ void writeCase_a_ui32( uint_fast32_t, const char * );
void writeCase_a_ui64( uint_fast64_t, const char * );
#define writeCase_a_i32 writeCase_a_ui32
#define writeCase_a_i64 writeCase_a_ui64
+#ifdef FLOAT16
+void writeCase_a_f16( float16_t, const char * );
+void writeCase_ab_f16( float16_t, float16_t, const char * );
+void writeCase_abc_f16( float16_t, float16_t, float16_t, const char * );
+#endif
void writeCase_a_f32( float32_t, const char * );
void writeCase_ab_f32( float32_t, float32_t, const char * );
void writeCase_abc_f32( float32_t, float32_t, float32_t, const char * );
@@ -79,6 +84,9 @@ void
writeCase_z_ui64( uint_fast64_t, uint_fast8_t, uint_fast64_t, uint_fast8_t );
#define writeCase_z_i32 writeCase_z_ui32
#define writeCase_z_i64 writeCase_z_ui64
+#ifdef FLOAT16
+void writeCase_z_f16( float16_t, uint_fast8_t, float16_t, uint_fast8_t );
+#endif
void writeCase_z_f32( float32_t, uint_fast8_t, float32_t, uint_fast8_t );
void writeCase_z_f64( float64_t, uint_fast8_t, float64_t, uint_fast8_t );
#ifdef EXTFLOAT80
diff --git a/source/writeCase_a_extF80M.c b/source/writeCase_a_extF80M.c
index 119338f..ada36fc 100644
--- a/source/writeCase_a_extF80M.c
+++ b/source/writeCase_a_extF80M.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_a_f128M.c b/source/writeCase_a_f128M.c
index bb162c3..67315fd 100644
--- a/source/writeCase_a_f128M.c
+++ b/source/writeCase_a_f128M.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_a_f16.c b/source/writeCase_a_f16.c
new file mode 100644
index 0000000..4354dd9
--- /dev/null
+++ b/source/writeCase_a_f16.c
@@ -0,0 +1,55 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include <stdio.h>
+#include "platform.h"
+#include "writeHex.h"
+#include "writeCase.h"
+
+#ifdef FLOAT16
+
+void writeCase_a_f16( float16_t a, const char *sepStringPtr )
+{
+
+ writeHex_f16( a, 0 );
+ fputs( sepStringPtr, stdout );
+
+}
+
+#endif
+
diff --git a/source/writeCase_a_f32.c b/source/writeCase_a_f32.c
index 3487c53..3ce35a9 100644
--- a/source/writeCase_a_f32.c
+++ b/source/writeCase_a_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_a_f64.c b/source/writeCase_a_f64.c
index 2646859..41e5852 100644
--- a/source/writeCase_a_f64.c
+++ b/source/writeCase_a_f64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_a_ui32.c b/source/writeCase_a_ui32.c
index ae69526..20856a2 100644
--- a/source/writeCase_a_ui32.c
+++ b/source/writeCase_a_ui32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_a_ui64.c b/source/writeCase_a_ui64.c
index 3bb1202..133628f 100644
--- a/source/writeCase_a_ui64.c
+++ b/source/writeCase_a_ui64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_ab_extF80M.c b/source/writeCase_ab_extF80M.c
index f861080..009401a 100644
--- a/source/writeCase_ab_extF80M.c
+++ b/source/writeCase_ab_extF80M.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_ab_f128M.c b/source/writeCase_ab_f128M.c
index a1946f3..a4c5dda 100644
--- a/source/writeCase_ab_f128M.c
+++ b/source/writeCase_ab_f128M.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_ab_f16.c b/source/writeCase_ab_f16.c
new file mode 100644
index 0000000..23dc7ee
--- /dev/null
+++ b/source/writeCase_ab_f16.c
@@ -0,0 +1,57 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include <stdio.h>
+#include "platform.h"
+#include "writeHex.h"
+#include "writeCase.h"
+
+#ifdef FLOAT16
+
+void writeCase_ab_f16( float16_t a, float16_t b, const char *sepStringPtr )
+{
+
+ writeHex_f16( a, 0 );
+ fputs( " ", stdout );
+ writeHex_f16( b, 0 );
+ fputs( sepStringPtr, stdout );
+
+}
+
+#endif
+
diff --git a/source/writeCase_ab_f32.c b/source/writeCase_ab_f32.c
index b109ce9..f5d8385 100644
--- a/source/writeCase_ab_f32.c
+++ b/source/writeCase_ab_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_ab_f64.c b/source/writeCase_ab_f64.c
index a117696..349b99d 100644
--- a/source/writeCase_ab_f64.c
+++ b/source/writeCase_ab_f64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_abc_extF80M.c b/source/writeCase_abc_extF80M.c
index e53cf88..5620d48 100644
--- a/source/writeCase_abc_extF80M.c
+++ b/source/writeCase_abc_extF80M.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_abc_f128M.c b/source/writeCase_abc_f128M.c
index fe279b2..5ddcac2 100644
--- a/source/writeCase_abc_f128M.c
+++ b/source/writeCase_abc_f128M.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_abc_f16.c b/source/writeCase_abc_f16.c
new file mode 100644
index 0000000..1f0471d
--- /dev/null
+++ b/source/writeCase_abc_f16.c
@@ -0,0 +1,57 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include <stdio.h>
+#include "platform.h"
+#include "writeHex.h"
+#include "writeCase.h"
+
+void
+ writeCase_abc_f16(
+ float16_t a, float16_t b, float16_t c, const char *sepStringPtr )
+{
+
+ writeHex_f16( a, 0 );
+ fputs( " ", stdout );
+ writeHex_f16( b, 0 );
+ fputs( " ", stdout );
+ writeHex_f16( c, 0 );
+ fputs( sepStringPtr, stdout );
+
+}
+
diff --git a/source/writeCase_abc_f32.c b/source/writeCase_abc_f32.c
index c088ddc..53067ee 100644
--- a/source/writeCase_abc_f32.c
+++ b/source/writeCase_abc_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_abc_f64.c b/source/writeCase_abc_f64.c
index b14a6fd..891c0e1 100644
--- a/source/writeCase_abc_f64.c
+++ b/source/writeCase_abc_f64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_z_bool.c b/source/writeCase_z_bool.c
index 589916e..6c1cc7d 100644
--- a/source/writeCase_z_bool.c
+++ b/source/writeCase_z_bool.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_z_extF80M.c b/source/writeCase_z_extF80M.c
index a878edf..70c9c77 100644
--- a/source/writeCase_z_extF80M.c
+++ b/source/writeCase_z_extF80M.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_z_f128M.c b/source/writeCase_z_f128M.c
index 31c611c..00d96f8 100644
--- a/source/writeCase_z_f128M.c
+++ b/source/writeCase_z_f128M.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_z_f16.c b/source/writeCase_z_f16.c
new file mode 100644
index 0000000..6168c5f
--- /dev/null
+++ b/source/writeCase_z_f16.c
@@ -0,0 +1,63 @@
+
+/*============================================================================
+
+This C source file is part of TestFloat, Release 3b, a package of programs for
+testing the correctness of floating-point arithmetic complying with the IEEE
+Standard for Floating-Point, by John R. Hauser.
+
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions, and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============================================================================*/
+
+#include <stdint.h>
+#include <stdio.h>
+#include "platform.h"
+#include "softfloat.h"
+#include "writeHex.h"
+#include "writeCase.h"
+
+void
+ writeCase_z_f16(
+ float16_t trueZ,
+ uint_fast8_t trueFlags,
+ float16_t subjZ,
+ uint_fast8_t subjFlags
+ )
+{
+
+ fputs( "=> ", stdout );
+ writeHex_f16( subjZ, ' ' );
+ writeHex_softfloat_flags( subjFlags, 0 );
+ fputs( " expected ", stdout );
+ writeHex_f16( trueZ, ' ' );
+ writeHex_softfloat_flags( trueFlags, '\n' );
+ fflush( stdout );
+
+}
+
diff --git a/source/writeCase_z_f32.c b/source/writeCase_z_f32.c
index c779d11..04d7d16 100644
--- a/source/writeCase_z_f32.c
+++ b/source/writeCase_z_f32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_z_f64.c b/source/writeCase_z_f64.c
index d8b2c7a..b448555 100644
--- a/source/writeCase_z_f64.c
+++ b/source/writeCase_z_f64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_z_ui32.c b/source/writeCase_z_ui32.c
index 3d99845..9553cf9 100644
--- a/source/writeCase_z_ui32.c
+++ b/source/writeCase_z_ui32.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeCase_z_ui64.c b/source/writeCase_z_ui64.c
index 0a82933..f4c7e46 100644
--- a/source/writeCase_z_ui64.c
+++ b/source/writeCase_z_ui64.c
@@ -1,7 +1,7 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
diff --git a/source/writeHex.c b/source/writeHex.c
index 2271fcc..0a3109c 100644
--- a/source/writeHex.c
+++ b/source/writeHex.c
@@ -1,12 +1,12 @@
/*============================================================================
-This C source file is part of TestFloat, Release 3a, a package of programs for
+This C source file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -118,6 +118,25 @@ void writeHex_ui64( uint_fast64_t a, char sepChar )
}
+#ifdef FLOAT16
+
+void writeHex_f16( float16_t a, char sepChar )
+{
+ union { uint16_t ui; float16_t f; } uA;
+ uint_fast16_t uiA;
+
+ uA.f = a;
+ uiA = uA.ui;
+ fputc( uiA & 0x8000 ? '-' : '+', stdout );
+ writeHex_ui8( uiA>>10 & 0x1F, 0 );
+ fputc( '.', stdout );
+ fputc( '0' + (uiA>>8 & 3), stdout );
+ writeHex_ui8( uiA, sepChar );
+
+}
+
+#endif
+
void writeHex_f32( float32_t a, char sepChar )
{
union { uint32_t ui; float32_t f; } uA;
@@ -125,7 +144,7 @@ void writeHex_f32( float32_t a, char sepChar )
uA.f = a;
uiA = uA.ui;
- fputc( (0x80000000 <= uiA) ? '8' : '0', stdout );
+ fputc( uiA & 0x80000000 ? '-' : '+', stdout );
writeHex_ui8( uiA>>23, 0 );
fputc( '.', stdout );
writeHex_ui8( uiA>>16 & 0x7F, 0 );
@@ -140,7 +159,8 @@ void writeHex_f64( float64_t a, char sepChar )
uA.f = a;
uiA = uA.ui;
- writeHex_ui12( uiA>>52, 0 );
+ fputc( uiA & UINT64_C( 0x8000000000000000 ) ? '-' : '+', stdout );
+ writeHex_ui12( uiA>>52 & 0x7FF, 0 );
fputc( '.', stdout );
writeHex_ui12( uiA>>40, 0 );
writeHex_ui8( uiA>>32, 0 );
@@ -153,9 +173,12 @@ void writeHex_f64( float64_t a, char sepChar )
void writeHex_extF80M( const extFloat80_t *aPtr, char sepChar )
{
const struct extFloat80M *aSPtr;
+ uint_fast16_t uiA64;
aSPtr = (const struct extFloat80M *) aPtr;
- writeHex_ui16( aSPtr->signExp, 0 );
+ uiA64 = aSPtr->signExp;
+ fputc( uiA64 & 0x8000 ? '-' : '+', stdout );
+ writeHex_ui16( uiA64 & 0x7FFF, 0 );
fputc( '.', stdout );
writeHex_ui64( aSPtr->signif, sepChar );
@@ -172,7 +195,8 @@ void writeHex_f128M( const float128_t *aPtr, char sepChar )
uiAPtr = (const struct uint128 *) aPtr;
uiA64 = uiAPtr->v64;
- writeHex_ui16( uiA64>>48, 0 );
+ fputc( uiA64 & UINT64_C( 0x8000000000000000 ) ? '-' : '+', stdout );
+ writeHex_ui16( uiA64>>48 & 0x7FFF, 0 );
fputc( '.', stdout );
writeHex_ui16( uiA64>>32, 0 );
writeHex_ui32( uiA64, 0 );
diff --git a/source/writeHex.h b/source/writeHex.h
index 6fc0ce6..84d2a2f 100644
--- a/source/writeHex.h
+++ b/source/writeHex.h
@@ -1,12 +1,12 @@
/*============================================================================
-This C header file is part of TestFloat, Release 3a, a package of programs for
+This C header file is part of TestFloat, Release 3b, a package of programs for
testing the correctness of floating-point arithmetic complying with the IEEE
Standard for Floating-Point, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -44,6 +44,9 @@ void writeHex_ui8( uint_fast8_t, char );
void writeHex_ui16( uint_fast16_t, char );
void writeHex_ui32( uint_fast32_t, char );
void writeHex_ui64( uint_fast64_t, char );
+#ifdef FLOAT16
+void writeHex_f16( float16_t, char );
+#endif
void writeHex_f32( float32_t, char );
void writeHex_f64( float64_t, char );
#ifdef EXTFLOAT80