Warning, /testsuites/ada/support/fp.inc is written in an unsupported language. File is not indexed.
0001 -- SPDX-License-Identifier: BSD-2-Clause
0002
0003 --
0004 -- fp.inc
0005 --
0006 -- Macros to produce a large number of LOCAL floating point variables. This
0007 -- preprocessing is necessary to insure that the variables are
0008 -- scoped properly and to avoid duplicating hundreds of lines
0009 -- of code.
0010 --
0011 --
0012 -- DEFICIENCIES:
0013 --
0014 -- 1. This currently does not address whether or not the CPU
0015 -- actually has hardware floating point. It just does the work.
0016 --
0017 -- COPYRIGHT (c) 1989-1997.
0018 -- On-Line Applications Research Corporation (OAR).
0019 --
0020 -- Redistribution and use in source and binary forms, with or without
0021 -- modification, are permitted provided that the following conditions
0022 -- are met:
0023 -- 1. Redistributions of source code must retain the above copyright
0024 -- notice, this list of conditions and the following disclaimer.
0025 -- 2. Redistributions in binary form must reproduce the above copyright
0026 -- notice, this list of conditions and the following disclaimer in the
0027 -- documentation and/or other materials provided with the distribution.
0028 --
0029 -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0030 -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0031 -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0032 -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0033 -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0034 -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0035 -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0036 -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0037 -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0038 -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0039 -- POSSIBILITY OF SUCH DAMAGE.
0040
0041 --
0042 -- private definitions for macro use
0043 --
0044
0045 -- macro usage EPSILON()
0046 define(`EPSILON',`0.0005')
0047
0048 -- macro usage FP_CHECK_ONE( value, base, factor )
0049 define(`FP_CHECK_ONE',`
0050 if ( $1 - ( $2 + $3 ) ) > EPSILON or else ( $1 - ( $2 + $3 ) ) < - EPSILON then
0051 UNSIGNED32_IO.PUT( TASK_INDEX );
0052 TEXT_IO.PUT( ": $1 wrong -- (" );
0053 FLOAT_IO.PUT( $1 );
0054 TEXT_IO.PUT( " not " );
0055 FLOAT_IO.PUT( $2 + $3 );
0056 TEXT_IO.PUT_LINE( ")" );
0057 end if
0058 '
0059 )
0060
0061 -- macro usage FP_DECLARE
0062 define(`FP_DECLARE', `
0063 FP01 : FLOAT := 1.0;
0064 FP02 : FLOAT := 2.0;
0065 FP03 : FLOAT := 3.0;
0066 FP04 : FLOAT := 4.0;
0067 FP05 : FLOAT := 5.0;
0068 FP06 : FLOAT := 6.0;
0069 FP07 : FLOAT := 7.0;
0070 FP08 : FLOAT := 8.0;
0071 FP09 : FLOAT := 9.0;
0072 FP10 : FLOAT := 10.0;
0073 FP11 : FLOAT := 11.0;
0074 FP12 : FLOAT := 12.0;
0075 FP13 : FLOAT := 13.0;
0076 FP14 : FLOAT := 14.0;
0077 FP15 : FLOAT := 15.0;
0078 FP16 : FLOAT := 16.0;
0079 FP17 : FLOAT := 17.0;
0080 FP18 : FLOAT := 18.0;
0081 FP19 : FLOAT := 19.0;
0082 FP20 : FLOAT := 20.0;
0083 FP21 : FLOAT := 21.0;
0084 FP22 : FLOAT := 22.0;
0085 FP23 : FLOAT := 23.0;
0086 FP24 : FLOAT := 24.0;
0087 FP25 : FLOAT := 25.0;
0088 FP26 : FLOAT := 26.0;
0089 FP27 : FLOAT := 27.0;
0090 FP28 : FLOAT := 28.0;
0091 FP29 : FLOAT := 29.0;
0092 FP30 : FLOAT := 30.0;
0093 FP31 : FLOAT := 31.0;
0094 FP32 : FLOAT := 32.0
0095 '
0096 )
0097
0098
0099 -- macro usage FP_LOAD( factor )
0100 define(`FP_LOAD',`
0101 FP01 := FP01 + $1;
0102 FP02 := FP02 + $1;
0103 FP03 := FP03 + $1;
0104 FP04 := FP04 + $1;
0105 FP05 := FP05 + $1;
0106 FP06 := FP06 + $1;
0107 FP07 := FP07 + $1;
0108 FP08 := FP08 + $1;
0109 FP09 := FP09 + $1;
0110 FP10 := FP10 + $1;
0111 FP11 := FP11 + $1;
0112 FP12 := FP12 + $1;
0113 FP13 := FP13 + $1;
0114 FP14 := FP14 + $1;
0115 FP15 := FP15 + $1;
0116 FP16 := FP16 + $1;
0117 FP17 := FP17 + $1;
0118 FP18 := FP18 + $1;
0119 FP19 := FP19 + $1;
0120 FP20 := FP20 + $1;
0121 FP21 := FP21 + $1;
0122 FP22 := FP22 + $1;
0123 FP23 := FP23 + $1;
0124 FP24 := FP24 + $1;
0125 FP25 := FP25 + $1;
0126 FP26 := FP26 + $1;
0127 FP27 := FP27 + $1;
0128 FP28 := FP28 + $1;
0129 FP29 := FP29 + $1;
0130 FP30 := FP30 + $1;
0131 FP31 := FP31 + $1;
0132 FP32 := FP32 + $1
0133 ')
0134
0135 -- macro usage FP_CHECK( factor )
0136 define(`FP_CHECK',`
0137 FP_CHECK_ONE( FP01, 1.0, $1 );
0138 FP_CHECK_ONE( FP02, 2.0, $1 );
0139 FP_CHECK_ONE( FP03, 3.0, $1 );
0140 FP_CHECK_ONE( FP04, 4.0, $1 );
0141 FP_CHECK_ONE( FP05, 5.0, $1 );
0142 FP_CHECK_ONE( FP06, 6.0, $1 );
0143 FP_CHECK_ONE( FP07, 7.0, $1 );
0144 FP_CHECK_ONE( FP08, 8.0, $1 );
0145 FP_CHECK_ONE( FP09, 9.0, $1 );
0146 FP_CHECK_ONE( FP10, 10.0, $1 );
0147 FP_CHECK_ONE( FP11, 11.0, $1 );
0148 FP_CHECK_ONE( FP12, 12.0, $1 );
0149 FP_CHECK_ONE( FP13, 13.0, $1 );
0150 FP_CHECK_ONE( FP14, 14.0, $1 );
0151 FP_CHECK_ONE( FP15, 15.0, $1 );
0152 FP_CHECK_ONE( FP16, 16.0, $1 );
0153 FP_CHECK_ONE( FP17, 17.0, $1 );
0154 FP_CHECK_ONE( FP18, 18.0, $1 );
0155 FP_CHECK_ONE( FP19, 19.0, $1 );
0156 FP_CHECK_ONE( FP20, 20.0, $1 );
0157 FP_CHECK_ONE( FP21, 21.0, $1 );
0158 FP_CHECK_ONE( FP22, 22.0, $1 );
0159 FP_CHECK_ONE( FP23, 23.0, $1 );
0160 FP_CHECK_ONE( FP24, 24.0, $1 );
0161 FP_CHECK_ONE( FP25, 25.0, $1 );
0162 FP_CHECK_ONE( FP26, 26.0, $1 );
0163 FP_CHECK_ONE( FP27, 27.0, $1 );
0164 FP_CHECK_ONE( FP28, 28.0, $1 );
0165 FP_CHECK_ONE( FP29, 29.0, $1 );
0166 FP_CHECK_ONE( FP30, 30.0, $1 );
0167 FP_CHECK_ONE( FP31, 31.0, $1 );
0168 FP_CHECK_ONE( FP32, 32.0, $1 )
0169 '
0170 )