diff options
author | Gary Martin <gary@garycmartin.com> | 2010-07-26 04:52:58 (GMT) |
---|---|---|
committer | Gary Martin <gary@garycmartin.com> | 2010-07-26 04:52:58 (GMT) |
commit | b8e516507526b27051964c68efa51994b3099072 (patch) | |
tree | cf23b346bc3a56c05584175b6f14e064da1eac24 /functions.py | |
parent | 870aafc46e3bdcff6840dd8a7806d9c55e41423c (diff) |
Patch from Reinier to fix #1111 (deg/rad function broken), and separate sci/eng toolbar glitch.
Diffstat (limited to 'functions.py')
-rw-r--r-- | functions.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/functions.py b/functions.py index ddc1088..c777af3 100644 --- a/functions.py +++ b/functions.py @@ -86,12 +86,22 @@ def _d(val): else: return None -_angle_scaling = 1 +class ClassValue(): + """ + Class to share a value with the outside world. + This is required because plain floats / integers are not asigned by + reference, and can therefore not easily be changed in a different place. + """ + def __init__(self, val): + self.value = val + +angle_scaling = ClassValue(1.0) + def _scale_angle(x): - return x * _angle_scaling + return x * angle_scaling.value def _inv_scale_angle(x): - return x / _angle_scaling + return x / angle_scaling.value def abs(x): return math.fabs(x) @@ -289,6 +299,9 @@ def mod(x, y): return x % y else: raise ValueError(_('Can only calculate x modulo <integer>')) +mod.__doc__ = _( +'mod(x, y), return the modulus of x with respect to y. This is the remainder \ +after dividing x by y.') def mul(x, y): if isinstance(x, _Decimal) or isinstance(y, _Decimal): |