@@ -45,7 +45,7 @@ public static void createMathToolModule(Ruby runtime) {
45
45
*/
46
46
@ JRubyMethod (name = "map1d" , rest = true , module = true )
47
47
public static IRubyObject mapOneD (ThreadContext context , IRubyObject recv , IRubyObject [] args ) {
48
- double value = (args [0 ] instanceof RubyFloat )
48
+ double value = (args [0 ] instanceof RubyFloat )
49
49
? ((RubyFloat ) args [0 ]).getValue () : ((RubyFixnum ) args [0 ]).getDoubleValue ();
50
50
RubyRange r1 = (RubyRange ) args [1 ];
51
51
RubyRange r2 = (RubyRange ) args [2 ];
@@ -83,10 +83,10 @@ public static IRubyObject constrainedMap(ThreadContext context, IRubyObject recv
83
83
double max = Math .max (first1 , last1 );
84
84
double min = Math .min (first1 , last1 );
85
85
if (value < min ) {
86
- value = min ;
86
+ return mapMt ( context , min , first1 , last1 , first2 , last2 ) ;
87
87
}
88
88
if (value > max ) {
89
- value = max ;
89
+ return mapMt ( context , max , first1 , last1 , first2 , last2 ) ;
90
90
}
91
91
return mapMt (context , value , first1 , last1 , first2 , last2 );
92
92
}
@@ -167,10 +167,17 @@ public static IRubyObject norm_strict(ThreadContext context, IRubyObject recv, I
167
167
double max = Math .max (start , stop );
168
168
double min = Math .min (start , stop );
169
169
if (value < min ) {
170
+ <<<<<<< HEAD
170
171
value = min ;
171
172
}
172
173
if (value > max ) {
173
174
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
174
181
}
175
182
return mapMt (context , value , start , stop , 0 , 1.0 );
176
183
}
0 commit comments