LSSTApplications
12.1-5-gbdcc3ab+2,15.0+13,15.0+26,15.0-1-g19261fa+17,15.0-1-g60afb23+26,15.0-1-g615e0bb+18,15.0-1-g788a293+26,15.0-1-ga91101e+26,15.0-1-gae1598d+12,15.0-1-gd076f1f+24,15.0-1-gdf18595+5,15.0-1-gf4f1c34+12,15.0-11-g7db6e543+4,15.0-12-g3681e7a+4,15.0-15-gc15de322,15.0-16-g83b84f4,15.0-2-g100d730+19,15.0-2-g1f9c9cf+4,15.0-2-g8aea5f4+1,15.0-2-gf38729e+21,15.0-29-ga12a2b06e,15.0-3-g11fe1a0+14,15.0-3-g707930d+3,15.0-3-g9103c06+12,15.0-3-gd3cbb57+3,15.0-4-g2d82b59,15.0-4-g535e784+10,15.0-4-g92ca6c3+4,15.0-4-gf906033+2,15.0-5-g23e394c+14,15.0-5-g4be42a9,15.0-6-g69628aa,15.0-6-g86e3f3d+1,15.0-6-gfa9b38f+4,15.0-7-g949993c+3,15.0-8-g67a62d3+1,15.0-8-gcf05001+1,15.0-9-g1e7c341+1,w.2018.21
LSSTDataManagementBasePackage
|
The Point and Extent classes support many mathematical operators, but the set of available operators (and their expected behavior) isn't quite as obvious as one might think.
The table below lists all supported operators, with notes below on special cases. For the rationale behind these operations, see RFC-41.
LHS | RHS | Operator | Result | Notes |
---|---|---|---|---|
PointD | PointD | +, += | Not supported | (1) |
PointD | PointI | +, += | Not supported | (1) |
PointD | PointD | - | ExtentD | |
PointD | PointD | -= | Not supported | (2) |
PointD | PointI | - | ExtentD | |
PointD | PointI | -= | Not supported | (2) |
PointD | ExtentD | +, +=, -, -= | PointD | |
PointD | ExtentI | +, +=, -, -= | PointD | |
PointI | PointD | +, += | Not supported | (1) |
PointI | PointI | +, += | Not supported | (1) |
PointI | ExtentD | + | PointD | |
PointI | ExtentD | += | Not supported | (2) |
PointI | ExtentI | +, += | PointI | |
PointI | PointD | - | ExtentD | |
PointI | PointD | -= | Not supported | (2) |
PointI | PointI | - | ExtentI | |
PointI | PointI | -= | Not supported | (2) |
PointI | ExtentD | - | PointD | |
PointI | ExtentD | -= | Not supported | (2) |
PointI | ExtentI | -, -= | PointI | |
ExtentD | PointD | + | PointD | |
ExtentD | PointD | += | Not supported | (2) |
ExtentD | PointD | -, -= | Not supported | (1) |
ExtentD | PointI | + | PointD | |
ExtentD | PointI | += | Not supported | (2) |
ExtentD | PointI | -, -= | Not supported | (1) |
ExtentD | ExtentD | +, +=, -, -= | ExtentD | |
ExtentD | ExtentI | +, +=, -, -= | ExtentD | |
ExtentI | PointD | + | PointD | |
ExtentI | PointD | += | Not supported | (2) |
ExtentI | PointD | -, -= | Not supported | (1) |
ExtentI | PointI | + | PointI | |
ExtentI | PointI | += | Not supported | (2) |
ExtentI | PointI | -, -= | Not supported | (1) |
ExtentI | ExtentD | +, - | ExtentD | |
ExtentI | ExtentD | +=, -= | Not supported | (2) |
ExtentI | ExtentI | +, -, +=, -= | ExtentI | |
ExtentD | double | *, *=, /, /= | ExtentD | |
ExtentD | double | //, //= | Not supported | (5) |
ExtentD | int | *, *=, /, /= | ExtentD | (3) |
ExtentD | int | //, //= | Not supported | (5) |
ExtentI | double | * | ExtentD | |
ExtentI | double | *= | Not supported | (2) |
ExtentI | double | / | ExtentD | (4) |
ExtentI | double | /= | Not supported | (2), (4) |
ExtentI | double | //, //= | Not supported | (5) |
ExtentI | int | *, *= | ExtentI | |
ExtentI | int | / | ExtentD | (4) |
ExtentI | int | /= | Not supported (Python), ExtentI (C++) | (2), (4) |
ExtentI | int | //, //= | ExtentI | (6) |
double | ExtentD | * | ExtentD | |
double | ExtentI | * | ExtentD | |
int | ExtentD | * | ExtentD | (3) |
int | ExtentI | * | ExtentI |
double
will also accept int
(but may yield different answers for extremely large integers that cannot be represented exactly as double
s).from __future__ import division
. If this is not enabled, the behavior of the "/" operator will be that of "//", and likewise for "/=" and "//=", for all operations with ExtentI
on the LHS.//
operator applies only to integer types.a//b
is equivalent to floor(a/b)
, while C++ specifies that it should be equivalent to int(a/b)
. Note that floor
rounds negative numbers down and int
rounds them up.