133965Sjdp/* flonum_const.c - Useful Flonum constants
2104834Sobrien   Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000, 2002
333965Sjdp   Free Software Foundation, Inc.
433965Sjdp
533965Sjdp   This file is part of GAS, the GNU Assembler.
633965Sjdp
733965Sjdp   GAS is free software; you can redistribute it and/or modify
833965Sjdp   it under the terms of the GNU General Public License as published by
933965Sjdp   the Free Software Foundation; either version 2, or (at your option)
1033965Sjdp   any later version.
1133965Sjdp
1233965Sjdp   GAS is distributed in the hope that it will be useful,
1333965Sjdp   but WITHOUT ANY WARRANTY; without even the implied warranty of
1433965Sjdp   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1533965Sjdp   GNU General Public License for more details.
1633965Sjdp
1733965Sjdp   You should have received a copy of the GNU General Public License
1833965Sjdp   along with GAS; see the file COPYING.  If not, write to the Free
19218822Sdim   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20218822Sdim   02110-1301, USA.  */
2133965Sjdp
22104834Sobrien#include "ansidecl.h"
2333965Sjdp#include "flonum.h"
2433965Sjdp/* JF:  I added the last entry to this table, and I'm not
2533965Sjdp   sure if its right or not.  Could go either way.  I wish
2677298Sobrien   I really understood this stuff.  */
2733965Sjdp
2833965Sjdpconst int table_size_of_flonum_powers_of_ten = 13;
2933965Sjdp
3077298Sobrienstatic const LITTLENUM_TYPE zero[] = {
3177298Sobrien  1
3277298Sobrien};
3333965Sjdp
3433965Sjdp/***********************************************************************\
3533965Sjdp *									*
3633965Sjdp *	Warning: the low order bits may be WRONG here.			*
3733965Sjdp *	I took this from a suspect bc(1) script.			*
3833965Sjdp *	"minus_X"[] is supposed to be 10^(2^-X) expressed in base 2^16.	*
3933965Sjdp *	The radix point is just AFTER the highest element of the []	*
4033965Sjdp *									*
4133965Sjdp *	Because bc rounds DOWN for printing (I think), the lowest	*
4233965Sjdp *	significance littlenums should probably have 1 added to them.	*
4333965Sjdp *									*
4433965Sjdp \***********************************************************************/
4533965Sjdp
4633965Sjdp/* JF:  If this equals 6553/(2^16)+39321/(2^32)+...  it approaches .1 */
4777298Sobrienstatic const LITTLENUM_TYPE minus_1[] = {
4833965Sjdp  39322, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321,
4977298Sobrien  39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 6553
5077298Sobrien};
5133965Sjdp
5277298Sobrienstatic const LITTLENUM_TYPE plus_1[] = {
5377298Sobrien  10
5477298Sobrien};
5577298Sobrien
5633965Sjdp/* JF:  If this equals 655/(2^16) + 23592/(2^32) + ... it approaches .01 */
5777298Sobrienstatic const LITTLENUM_TYPE minus_2[] = {
5833965Sjdp  10486, 36700, 62914, 23592, 49807, 10485, 36700, 62914, 23592, 49807,
5977298Sobrien  10485, 36700, 62914, 23592, 49807, 10485, 36700, 62914, 23592, 655
6077298Sobrien};
6133965Sjdp
6277298Sobrienstatic const LITTLENUM_TYPE plus_2[] = {
6377298Sobrien  100
6477298Sobrien};
6577298Sobrien
6633965Sjdp/* This approaches .0001 */
6777298Sobrienstatic const LITTLENUM_TYPE minus_3[] = {
6833965Sjdp  52534, 20027, 37329, 65116, 64067, 60397, 14784, 18979, 33659, 19503,
6977298Sobrien  2726, 9542, 629, 2202, 40475, 10590, 4299, 47815, 36280, 6
7077298Sobrien};
7133965Sjdp
7277298Sobrienstatic const LITTLENUM_TYPE plus_3[] = {
7377298Sobrien  10000
7477298Sobrien};
7577298Sobrien
7633965Sjdp/* JF: this approaches 1e-8 */
7777298Sobrienstatic const LITTLENUM_TYPE minus_4[] = {
7833965Sjdp  22517, 49501, 54293, 19424, 60699, 6716, 24348, 22618, 23904, 21327,
7977298Sobrien  3919, 44703, 19149, 28803, 48959, 6259, 50273, 62237, 42
8077298Sobrien};
8177298Sobrien
8233965Sjdp/* This equals 1525 * 2^16 + 57600 */
8377298Sobrienstatic const LITTLENUM_TYPE plus_4[] = {
8477298Sobrien  57600, 1525
8577298Sobrien};
8633965Sjdp
8733965Sjdp/* This approaches 1e-16 */
8877298Sobrienstatic const LITTLENUM_TYPE minus_5[] = {
8933965Sjdp  22199, 45957, 17005, 26266, 10526, 16260, 55017, 35680, 40443, 19789,
9077298Sobrien  17356, 30195, 55905, 28426, 63010, 44197, 1844
9177298Sobrien};
9233965Sjdp
9377298Sobrienstatic const LITTLENUM_TYPE plus_5[] = {
9477298Sobrien  28609, 34546, 35
9577298Sobrien};
9677298Sobrien
9777298Sobrienstatic const LITTLENUM_TYPE minus_6[] = {
9833965Sjdp  30926, 26518, 13110, 43018, 54982, 48258, 24658, 15209, 63366, 11929,
9977298Sobrien  20069, 43857, 60487, 51
10077298Sobrien};
10133965Sjdp
10277298Sobrienstatic const LITTLENUM_TYPE plus_6[] = {
10377298Sobrien  61313, 34220, 16731, 11629, 1262
10477298Sobrien};
10533965Sjdp
10677298Sobrienstatic const LITTLENUM_TYPE minus_7[] = {
10777298Sobrien  29819, 14733, 21490, 40602, 31315, 65186, 2695
10877298Sobrien};
10977298Sobrien
11077298Sobrienstatic const LITTLENUM_TYPE plus_7[] = {
11177298Sobrien  7937, 49002, 60772, 28216, 38893, 55975, 63988, 59711, 20227, 24
11277298Sobrien};
11377298Sobrien
11477298Sobrienstatic const LITTLENUM_TYPE minus_8[] = {
11533965Sjdp  27579, 64807, 12543, 794, 13907, 61297, 12013, 64360, 15961, 20566,
11677298Sobrien  24178, 15922, 59427, 110
11777298Sobrien};
11877298Sobrien
11977298Sobrienstatic const LITTLENUM_TYPE plus_8[] = {
12033965Sjdp  15873, 11925, 39177, 991, 14589, 3861, 58415, 9076, 62956, 54223,
12177298Sobrien  56328, 50180, 45274, 48333, 32537, 42547, 9731, 59679, 590
12277298Sobrien};
12333965Sjdp
12477298Sobrienstatic const LITTLENUM_TYPE minus_9[] = {
12533965Sjdp  11042, 8464, 58971, 63429, 6022, 63485, 5500, 53464, 47545, 50068,
12633965Sjdp  56988, 22819, 49708, 54493, 9920, 47667, 40409, 35764, 10383, 54466,
12777298Sobrien  32702, 17493, 32420, 34382, 22750, 20681, 12300
12877298Sobrien};
12977298Sobrien
13077298Sobrienstatic const LITTLENUM_TYPE plus_9[] = {
13133965Sjdp  20678, 27614, 28272, 53066, 55311, 54677, 29038, 9906, 26288, 44486,
13233965Sjdp  13860, 7445, 54106, 15426, 21518, 25599, 29632, 52309, 61207, 26105,
13377298Sobrien  10482, 21948, 51191, 32988, 60892, 62574, 61390, 24540, 21495, 5
13477298Sobrien};
13533965Sjdp
13677298Sobrienstatic const LITTLENUM_TYPE minus_10[] = {
13733965Sjdp  6214, 48771, 23471, 30163, 31763, 38013, 57001, 11770, 18263, 36366,
13833965Sjdp  20742, 45086, 56969, 53231, 37856, 55814, 38057, 15692, 46761, 8713,
13977298Sobrien  6102, 20083, 8269, 11839, 11571, 50963, 15649, 11698, 40675, 2308
14077298Sobrien};
14177298Sobrien
14277298Sobrienstatic const LITTLENUM_TYPE plus_10[] = {
14333965Sjdp  63839, 36576, 45712, 44516, 37803, 29482, 4966, 30556, 37961, 23310,
14433965Sjdp  27070, 44972, 29507, 48257, 45209, 7494, 17831, 38728, 41577, 29443,
14577298Sobrien  36016, 7955, 35339, 35479, 36011, 14553, 49618, 5588, 25396, 28
14677298Sobrien};
14733965Sjdp
14877298Sobrienstatic const LITTLENUM_TYPE minus_11[] = {
14933965Sjdp  16663, 56882, 61983, 7804, 36555, 32060, 34502, 1000, 14356, 21681,
15033965Sjdp  6605, 34767, 51411, 59048, 53614, 39850, 30079, 6496, 6846, 26841,
15177298Sobrien  40778, 19578, 59899, 44085, 54016, 24259, 11232, 21229, 21313, 81
15277298Sobrien};
15377298Sobrien
15477298Sobrienstatic const LITTLENUM_TYPE plus_11[] = {
15533965Sjdp  92, 9054, 62707, 17993, 7821, 56838, 13992, 21321, 29637, 48426,
15633965Sjdp  42982, 38668, 49574, 28820, 18200, 18927, 53979, 16219, 37484, 2516,
15777298Sobrien  44642, 14665, 11587, 41926, 13556, 23956, 54320, 6661, 55766, 805
15877298Sobrien};
15933965Sjdp
16077298Sobrienstatic const LITTLENUM_TYPE minus_12[] = {
16133965Sjdp  33202, 45969, 58804, 56734, 16482, 26007, 44984, 49334, 31007, 32944,
16233965Sjdp  44517, 63329, 47131, 15291, 59465, 2264, 23218, 11829, 59771, 38798,
16377298Sobrien  31051, 28748, 23129, 40541, 41562, 35108, 50620, 59014, 51817, 6613
16477298Sobrien};
16577298Sobrien
16677298Sobrienstatic const LITTLENUM_TYPE plus_12[] = {
16733965Sjdp  10098, 37922, 58070, 7432, 10470, 63465, 23718, 62190, 47420, 7009,
16833965Sjdp  38443, 4587, 45596, 38472, 52129, 52779, 29012, 13559, 48688, 31678,
16977298Sobrien  41753, 58662, 10668, 36067, 29906, 56906, 21461, 46556, 59571, 9
17077298Sobrien};
17133965Sjdp
17277298Sobrienstatic const LITTLENUM_TYPE minus_13[] = {
17333965Sjdp  45309, 27592, 37144, 34637, 34328, 41671, 34620, 24135, 53401, 22112,
17433965Sjdp  21576, 45147, 39310, 44051, 48572, 3676, 46544, 59768, 33350, 2323,
17577298Sobrien  49524, 61568, 3903, 36487, 36356, 30903, 14975, 9035, 29715, 667
17677298Sobrien};
17777298Sobrien
17877298Sobrienstatic const LITTLENUM_TYPE plus_13[] = {
17933965Sjdp  18788, 16960, 6318, 45685, 55400, 46230, 35794, 25588, 7253, 55541,
18033965Sjdp  49716, 59760, 63592, 8191, 63765, 58530, 44667, 13294, 10001, 55586,
18177298Sobrien  47887, 18738, 9509, 40896, 42506, 52580, 4171, 325, 12329, 98
18277298Sobrien};
18333965Sjdp
18433965Sjdp/* Shut up complaints about differing pointer types.  They only differ
18533965Sjdp   in the const attribute, but there isn't any easy way to do this
18633965Sjdp   */
18733965Sjdp#define X (LITTLENUM_TYPE *)
18833965Sjdp
18977298Sobrienconst FLONUM_TYPE flonum_negative_powers_of_ten[] = {
19033965Sjdp  {X zero, X zero, X zero, 0, '+'},
19133965Sjdp  {X minus_1, X minus_1 + 19, X minus_1 + 19, -20, '+'},
19233965Sjdp  {X minus_2, X minus_2 + 19, X minus_2 + 19, -20, '+'},
19333965Sjdp  {X minus_3, X minus_3 + 19, X minus_3 + 19, -20, '+'},
19433965Sjdp  {X minus_4, X minus_4 + 18, X minus_4 + 18, -20, '+'},
19533965Sjdp  {X minus_5, X minus_5 + 16, X minus_5 + 16, -20, '+'},
19633965Sjdp  {X minus_6, X minus_6 + 13, X minus_6 + 13, -20, '+'},
19733965Sjdp  {X minus_7, X minus_7 + 6, X minus_7 + 6, -20, '+'},
19833965Sjdp  {X minus_8, X minus_8 + 13, X minus_8 + 13, -40, '+'},
19933965Sjdp  {X minus_9, X minus_9 + 26, X minus_9 + 26, -80, '+'},
20033965Sjdp  {X minus_10, X minus_10 + 29, X minus_10 + 29, -136, '+'},
20133965Sjdp  {X minus_11, X minus_11 + 29, X minus_11 + 29, -242, '+'},
20233965Sjdp  {X minus_12, X minus_12 + 29, X minus_12 + 29, -455, '+'},
20333965Sjdp  {X minus_13, X minus_13 + 29, X minus_13 + 29, -880, '+'},
20433965Sjdp};
20533965Sjdp
20677298Sobrienconst FLONUM_TYPE flonum_positive_powers_of_ten[] = {
20733965Sjdp  {X zero, X zero, X zero, 0, '+'},
20833965Sjdp  {X plus_1, X plus_1 + 0, X plus_1 + 0, 0, '+'},
20933965Sjdp  {X plus_2, X plus_2 + 0, X plus_2 + 0, 0, '+'},
21033965Sjdp  {X plus_3, X plus_3 + 0, X plus_3 + 0, 0, '+'},
21133965Sjdp  {X plus_4, X plus_4 + 1, X plus_4 + 1, 0, '+'},
21233965Sjdp  {X plus_5, X plus_5 + 2, X plus_5 + 2, 1, '+'},
21333965Sjdp  {X plus_6, X plus_6 + 4, X plus_6 + 4, 2, '+'},
21433965Sjdp  {X plus_7, X plus_7 + 9, X plus_7 + 9, 4, '+'},
21533965Sjdp  {X plus_8, X plus_8 + 18, X plus_8 + 18, 8, '+'},
21633965Sjdp  {X plus_9, X plus_9 + 29, X plus_9 + 29, 24, '+'},
21733965Sjdp  {X plus_10, X plus_10 + 29, X plus_10 + 29, 77, '+'},
21833965Sjdp  {X plus_11, X plus_11 + 29, X plus_11 + 29, 183, '+'},
21933965Sjdp  {X plus_12, X plus_12 + 29, X plus_12 + 29, 396, '+'},
22033965Sjdp  {X plus_13, X plus_13 + 29, X plus_13 + 29, 821, '+'},
22133965Sjdp};
22233965Sjdp
22333965Sjdp#ifdef VMS
22477298Sobrienvoid
22577298Sobriendummy1 ()
22677298Sobrien{
22777298Sobrien}
22833965Sjdp#endif
229