Skip to content

Commit 8931770

Browse files
committed
Fixed style and copyright
1 parent ceb18e1 commit 8931770

3 files changed

Lines changed: 18 additions & 53 deletions

File tree

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/CmathModuleBuiltins.java

Lines changed: 16 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,7 @@
1-
/*
2-
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3-
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1+
/* Copyright (c) 2020, Oracle and/or its affiliates.
2+
* Copyright (C) 1996-2020 Python Software Foundation
43
*
5-
* The Universal Permissive License (UPL), Version 1.0
6-
*
7-
* Subject to the condition set forth below, permission is hereby granted to any
8-
* person obtaining a copy of this software, associated documentation and/or
9-
* data (collectively the "Software"), free of charge and under any and all
10-
* copyright rights in the Software, and any and all patent rights owned or
11-
* freely licensable by each licensor hereunder covering either (i) the
12-
* unmodified Software as contributed to or provided by such licensor, or (ii)
13-
* the Larger Works (as defined below), to deal in both
14-
*
15-
* (a) the Software, and
16-
*
17-
* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
18-
* one is included with the Software each a "Larger Work" to which the Software
19-
* is contributed by such licensors),
20-
*
21-
* without restriction, including without limitation the rights to copy, create
22-
* derivative works of, display, perform, and distribute the Software and make,
23-
* use, sell, offer for sale, import, export, have made, and have sold the
24-
* Software and the Larger Work(s), and to sublicense the foregoing rights on
25-
* either these or other terms.
26-
*
27-
* This license is subject to the following condition:
28-
*
29-
* The above copyright notice and either this complete permission notice or at a
30-
* minimum a reference to the UPL must be included in all copies or substantial
31-
* portions of the Software.
32-
*
33-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39-
* SOFTWARE.
4+
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
405
*/
416
package com.oracle.graal.python.builtins.modules;
427

@@ -306,7 +271,7 @@ PTuple doC(PComplex value) {
306271
throw raise(OverflowError, "absolute value too large");
307272
}
308273
}
309-
return factory().createTuple(new Object[]{ r, Math.atan2(value.getImag(), value.getReal()) });
274+
return factory().createTuple(new Object[]{r, Math.atan2(value.getImag(), value.getReal())});
310275
}
311276

312277
@Specialization
@@ -321,13 +286,13 @@ abstract static class SqrtNode extends CmathComplexUnaryBuiltinNode {
321286

322287
@CompilerDirectives.CompilationFinal(dimensions = 2)
323288
private static final ComplexConstant[][] SPECIAL_VALUES = {
324-
{ C(INF, -INF), C(0.0, -INF), C(0.0, -INF), C(0.0, INF), C(0.0, INF), C(INF, INF), C(NAN, INF) },
325-
{ C(INF, -INF), null, null, null, null, C(INF, INF), C(NAN, NAN) },
326-
{ C(INF, -INF), null, C(0.0, -0.0), C(0.0, 0.0), null, C(INF, INF), C(NAN, NAN) },
327-
{ C(INF, -INF), null, C(0.0, -0.0), C(0.0, 0.0), null, C(INF, INF), C(NAN, NAN) },
328-
{ C(INF, -INF), null, null, null, null, C(INF, INF), C(NAN, NAN) },
329-
{ C(INF, -INF), C(INF, -0.0), C(INF, -0.0), C(INF, 0.0), C(INF, 0.0), C(INF, INF), C(INF, NAN) },
330-
{ C(INF, -INF), C(NAN, NAN), C(NAN, NAN), C(NAN, NAN), C(NAN, NAN), C(INF, INF), C(NAN, NAN) },
289+
{C(INF, -INF), C(0.0, -INF), C(0.0, -INF), C(0.0, INF), C(0.0, INF), C(INF, INF), C(NAN, INF)},
290+
{C(INF, -INF), null, null, null, null, C(INF, INF), C(NAN, NAN)},
291+
{C(INF, -INF), null, C(0.0, -0.0), C(0.0, 0.0), null, C(INF, INF), C(NAN, NAN)},
292+
{C(INF, -INF), null, C(0.0, -0.0), C(0.0, 0.0), null, C(INF, INF), C(NAN, NAN)},
293+
{C(INF, -INF), null, null, null, null, C(INF, INF), C(NAN, NAN)},
294+
{C(INF, -INF), C(INF, -0.0), C(INF, -0.0), C(INF, 0.0), C(INF, 0.0), C(INF, INF), C(INF, NAN)},
295+
{C(INF, -INF), C(NAN, NAN), C(NAN, NAN), C(NAN, NAN), C(NAN, NAN), C(INF, INF), C(NAN, NAN)},
331296
};
332297

333298
@Override
@@ -345,18 +310,17 @@ PComplex compute(double real, double imag) {
345310

346311
double s;
347312
if (ax < Double.MIN_NORMAL && ay < Double.MIN_NORMAL && (ax > 0.0 || ay > 0.0)) {
348-
final double SCALE_UP = 0x1.0p53;
349-
final double SCALE_DOWN = 0x1.0p-27;
350-
ax *= SCALE_UP;
351-
s = Math.sqrt(ax + Math.hypot(ax, ay * SCALE_UP)) * SCALE_DOWN;
313+
final double scaleUp = 0x1.0p53;
314+
final double scaleDown = 0x1.0p-27;
315+
ax *= scaleUp;
316+
s = Math.sqrt(ax + Math.hypot(ax, ay * scaleUp)) * scaleDown;
352317
} else {
353318
ax /= 8.0;
354319
s = 2.0 * Math.sqrt(ax + Math.hypot(ax, ay / 8.0));
355320
}
356321
double d = ay / (2.0 * s);
357322

358-
if (real >= 0.0)
359-
{
323+
if (real >= 0.0) {
360324
return factory().createComplex(s, Math.copySign(d, imag));
361325
}
362326
return factory().createComplex(d, Math.copySign(s, imag));

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/MathGuards.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0

mx.graalpython/copyrights/overrides

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/PythonB
286286
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ArrayModuleBuiltins.java,zippy.copyright
287287
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinConstructors.java,zippy.copyright
288288
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinFunctions.java,zippy.copyright
289+
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/CmathModuleBuiltins.java,python.copyright
289290
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/GcModuleBuiltins.java,zippy.copyright
290291
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ItertoolsModuleBuiltins.java,zippy.copyright
291292
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/MarshalModuleBuiltins.java,zippy.copyright

0 commit comments

Comments
 (0)