Skip to content

Commit 5b39858

Browse files
committed
not needed
2 parents 0f64edd + b501fc5 commit 5b39858

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/monkstone/MathToolModule.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static void createMathToolModule(Ruby runtime) {
4545
*/
4646
@JRubyMethod(name = "map1d", rest = true, module = true)
4747
public static IRubyObject mapOneD(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
48-
double value = (args[0] instanceof RubyFloat)
48+
double value = (args[0] instanceof RubyFloat)
4949
? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
5050
RubyRange r1 = (RubyRange) args[1];
5151
RubyRange r2 = (RubyRange) args[2];
@@ -83,10 +83,10 @@ public static IRubyObject constrainedMap(ThreadContext context, IRubyObject recv
8383
double max = Math.max(first1, last1);
8484
double min = Math.min(first1, last1);
8585
if (value < min) {
86-
value = min;
86+
return mapMt(context, min, first1, last1, first2, last2);
8787
}
8888
if (value > max) {
89-
value = max;
89+
return mapMt(context, max, first1, last1, first2, last2);
9090
}
9191
return mapMt(context, value, first1, last1, first2, last2);
9292
}
@@ -167,10 +167,17 @@ public static IRubyObject norm_strict(ThreadContext context, IRubyObject recv, I
167167
double max = Math.max(start, stop);
168168
double min = Math.min(start, stop);
169169
if (value < min) {
170+
<<<<<<< HEAD
170171
value = min;
171172
}
172173
if (value > max) {
173174
value = max;
175+
=======
176+
return mapMt(context, min, start, stop, 0, 1.0);
177+
}
178+
if (value > max) {
179+
return mapMt(context, max, start, stop, 0, 1.0);
180+
>>>>>>> b501fc57c07166463e8cab84e4ca69a325f6508e
174181
}
175182
return mapMt(context, value, start, stop, 0, 1.0);
176183
}

0 commit comments

Comments
 (0)