2
2
* OpenPBS (Portable Batch System) v2.3 Software License
4
4
* Copyright (c) 1999-2000 Veridian Information Solutions, Inc.
5
5
* All rights reserved.
7
7
* ---------------------------------------------------------------------------
8
8
* For a license to use or redistribute the OpenPBS software under conditions
9
9
* other than those described below, or to purchase support for this software,
10
10
* please contact Veridian Systems, PBS Products Department ("Licensor") at:
12
12
* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org
13
13
* 877 902-4PBS (US toll-free)
14
14
* ---------------------------------------------------------------------------
16
16
* This license covers use of the OpenPBS v2.3 software (the "Software") at
17
17
* your site or location, and, for certain users, redistribution of the
18
18
* Software to other sites and locations. Use and redistribution of
19
19
* OpenPBS v2.3 in source and binary forms, with or without modification,
20
20
* are permitted provided that all of the following conditions are met.
21
21
* After December 31, 2001, only conditions 3-6 must be met:
23
23
* 1. Commercial and/or non-commercial use of the Software is permitted
24
24
* provided a current software registration is on file at www.OpenPBS.org.
25
25
* If use of this software contributes to a publication, product, or
26
26
* service, proper attribution must be given; see www.OpenPBS.org/credit.html
28
28
* 2. Redistribution in any form is only permitted for non-commercial,
29
29
* non-profit purposes. There can be no charge for the Software or any
30
30
* software incorporating the Software. Further, there can be no
31
31
* expectation of revenue generated as a consequence of redistributing
34
34
* 3. Any Redistribution of source code must retain the above copyright notice
35
35
* and the acknowledgment contained in paragraph 6, this list of conditions
36
36
* and the disclaimer contained in paragraph 7.
38
38
* 4. Any Redistribution in binary form must reproduce the above copyright
39
39
* notice and the acknowledgment contained in paragraph 6, this list of
40
40
* conditions and the disclaimer contained in paragraph 7 in the
41
41
* documentation and/or other materials provided with the distribution.
43
43
* 5. Redistributions in any form must be accompanied by information on how to
44
44
* obtain complete source code for the OpenPBS software and any
45
45
* modifications and/or additions to the OpenPBS software. The source code
47
47
* than the cost of distribution plus a nominal fee, and all modifications
48
48
* and additions to the Software must be freely redistributable by any party
49
49
* (including Licensor) without restriction.
51
51
* 6. All advertising materials mentioning features or use of the Software must
52
52
* display the following acknowledgment:
54
54
* "This product includes software developed by NASA Ames Research Center,
55
* Lawrence Livermore National Laboratory, and Veridian Information
55
* Lawrence Livermore National Laboratory, and Veridian Information
57
57
* Visit www.OpenPBS.org for OpenPBS software support,
58
58
* products, and information."
60
60
* 7. DISCLAIMER OF WARRANTY
62
62
* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS
63
63
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
64
64
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT
65
65
* ARE EXPRESSLY DISCLAIMED.
67
67
* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE
68
68
* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT,
69
69
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
72
72
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
73
73
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
74
74
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
76
76
* This license will be governed by the laws of the Commonwealth of Virginia,
77
77
* without reference to its choice of law rules.
81
* long double disrl(int stream, int *retval)
83
* Gets a Data-is-Strings floating point number from <stream> and converts
84
* it into a long double and returns it. The number from <stream> consists
85
* of two consecutive signed integers. The first is the coefficient, with
86
* its implied decimal point at the low-order end. The second is the
87
* exponent as a power of 10.
89
* *<retval> gets DIS_SUCCESS if everything works well. It gets an error
90
* code otherwise. In case of an error, the <stream> character pointer is
91
* reset, making it possible to retry with some other conversion strategy.
93
* By fiat of the author, neither loss of significance nor underflow are
81
* long double disrl(int stream, int *retval)
83
* Gets a Data-is-Strings floating point number from <stream> and converts
84
* it into a long double and returns it. The number from <stream> consists
85
* of two consecutive signed integers. The first is the coefficient, with
86
* its implied decimal point at the low-order end. The second is the
87
* exponent as a power of 10.
89
* *<retval> gets DIS_SUCCESS if everything works well. It gets an error
90
* code otherwise. In case of an error, the <stream> character pointer is
91
* reset, making it possible to retry with some other conversion strategy.
93
* By fiat of the author, neither loss of significance nor underflow are
97
97
#include <pbs_config.h> /* the master config generated by configure */
112
112
#endif /* LDBL_MAX */
114
114
#define LDBL_MAX DBL_MAX
115
116
#endif /* SIZEOF_LONG_DOUBLE == SIZEOF_DOUBLE */
118
#if defined(__GNUC__) && defined(__DBL_MAX__)
122
#endif /* LDBL_MAX */
124
#define LDBL_MAX __DBL_MAX__
130
#define HUGE_VAL LDBL_MAX
117
136
dis_long_double_t disrl(
129
dis_long_double_t ldval;
148
dis_long_double_t ldval;
131
150
assert(retval != NULL);
132
151
assert(disr_commit != NULL);
135
locret = disrl_(stream, &ldval, &ndigs, &nskips, LDBL_DIG, 1);
136
if (locret == DIS_SUCCESS) {
137
locret = disrsi_(stream, &negate, &uexpon, 1);
138
if (locret == DIS_SUCCESS) {
139
expon = negate ? nskips - uexpon : nskips + uexpon;
140
if (expon + (int)ndigs > LDBL_MAX_10_EXP) {
141
if (expon + (int)ndigs > LDBL_MAX_10_EXP + 1) {
142
ldval = ldval < 0.0L ?
143
-HUGE_VAL : HUGE_VAL;
144
locret = DIS_OVERFLOW;
146
ldval *= disp10l_(expon - 1);
147
if (ldval > LDBL_MAX / 10.0L) {
148
ldval = ldval < 0.0L ?
149
-HUGE_VAL : HUGE_VAL;
150
locret = DIS_OVERFLOW;
155
if (expon < LDBL_MIN_10_EXP) {
156
ldval *= disp10l_(expon + (int)ndigs);
157
ldval /= disp10l_((int)ndigs);
159
ldval *= disp10l_(expon);
154
locret = disrl_(stream, &ldval, &ndigs, &nskips, LDBL_DIG, 1);
156
if (locret == DIS_SUCCESS)
158
locret = disrsi_(stream, &negate, &uexpon, 1);
160
if (locret == DIS_SUCCESS)
162
expon = negate ? nskips - uexpon : nskips + uexpon;
164
if (expon + (int)ndigs > LDBL_MAX_10_EXP)
166
if (expon + (int)ndigs > LDBL_MAX_10_EXP + 1)
168
ldval = ldval < 0.0L ?
169
-HUGE_VAL : HUGE_VAL;
170
locret = DIS_OVERFLOW;
174
ldval *= disp10l_(expon - 1);
176
if (ldval > LDBL_MAX / 10.0L)
178
ldval = ldval < 0.0L ?
179
-HUGE_VAL : HUGE_VAL;
180
locret = DIS_OVERFLOW;
188
if (expon < LDBL_MIN_10_EXP)
190
ldval *= disp10l_(expon + (int)ndigs);
191
ldval /= disp10l_((int)ndigs);
194
ldval *= disp10l_(expon);
164
199
if ((*disr_commit)(stream, locret == DIS_SUCCESS) < 0)
165
200
locret = DIS_NOCOMMIT;