--- a/ArithmeticValue.st Fri May 04 12:07:19 2018 +0200
+++ b/ArithmeticValue.st Sat May 05 22:23:31 2018 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
@@ -563,6 +565,24 @@
^ self
!
+copySignTo:aNumber
+ "Return a number with same magnitude as aNumber and same sign as self"
+
+ (self negative == aNumber negative) ifTrue:[^ aNumber].
+ ^ aNumber negated
+
+ "
+ -15 copySignTo:1234 -> -1234
+ -15 copySignTo:-1234 -> -1234
+ 15 copySignTo:1234 -> 1234
+ 15 copySignTo:-1234 -> 1234
+ 1.0 copySignTo:0.0 -> 0.0
+ -1.0 copySignTo:0.0 -> -0.0
+ 1 copySignTo:(1/3) -> (1/3)
+ -1 copySignTo:(1/3) -> (-1/3)
+ "
+!
+
dist:arg
"return the distance between the arg and the receiver."