Skip to content

Commit d4ee37e

Browse files
hansonrhansonr
authored andcommitted
adds Math.IEEEremainder
1 parent 22743fe commit d4ee37e

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2018-07-22_0207 PM
1+
2018_07_22__14_28_50
162 Bytes
Binary file not shown.

sources/net.sf.j2s.java.core/srcjs/js/j2sClazz.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// TODO: CharacterSequence does not implement Java 8 default methods chars() or codePoints()
1111
// It is possible that these might be loaded dynamically.
1212

13+
// BH 7/22/2018 adds Math.IEEEremainder
1314
// BH 7/20/2018 removes def of Closeable, DataInput, DataOutput, Iterable, Comparator
1415
// BH 7/19/2018 removes Constructor, Method, and Field code here -- now in their .js files
1516
// BH 7/18/2018 adds Java 8 default interface method support
@@ -2808,7 +2809,18 @@ Math.nextAfter||(Math.nextAfter=function(start,direction){return 0});
28082809
Math.nextUp||(Math.nextUp=function(d){return 0});
28092810
Math.ulp||(Math.ulp=function(d){return 0});
28102811
Math.getExponent||(Math.getExponent=function(d){return 0});
2811-
Math.getIEEEremainder||(Math.getIEEEremainder=function(f1,f2){return 0});
2812+
Math.IEEEremainder||(Math.IEEEremainder=function (x, y) {
2813+
if (y == 0 || Double.isNaN(x) || Double.isInfinite(y) && !Double.isInfinite(x) ) return NaN;
2814+
var modxy = x % y;
2815+
if (modxy == 0 ) return modxy;
2816+
var rem = modxy - (Math.abs(y) * Math.signum(x));
2817+
if (Math.abs(rem) == Math.abs(modxy) ) {
2818+
var div = x / y;
2819+
return (Math.abs(Math.round(div)) > Math.abs(div) ? rem : modxy);
2820+
}
2821+
return (Math.abs(rem) < Math.abs(modxy) ? rem : modxy);
2822+
});
2823+
28122824
//end datatype reliant math declarations
28132825

28142826
Clazz._setDeclared("java.lang.Number", java.lang.Number=Number);

sources/net.sf.j2s.java.core/srcjs/swingjs2.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13440,6 +13440,7 @@ if (!J2S._version)
1344013440
// TODO: CharacterSequence does not implement Java 8 default methods chars() or codePoints()
1344113441
// It is possible that these might be loaded dynamically.
1344213442

13443+
// BH 7/22/2018 adds Math.IEEEremainder
1344313444
// BH 7/20/2018 removes def of Closeable, DataInput, DataOutput, Iterable, Comparator
1344413445
// BH 7/19/2018 removes Constructor, Method, and Field code here -- now in their .js files
1344513446
// BH 7/18/2018 adds Java 8 default interface method support
@@ -16238,7 +16239,18 @@ Math.nextAfter||(Math.nextAfter=function(start,direction){return 0});
1623816239
Math.nextUp||(Math.nextUp=function(d){return 0});
1623916240
Math.ulp||(Math.ulp=function(d){return 0});
1624016241
Math.getExponent||(Math.getExponent=function(d){return 0});
16241-
Math.getIEEEremainder||(Math.getIEEEremainder=function(f1,f2){return 0});
16242+
Math.IEEEremainder||(Math.IEEEremainder=function (x, y) {
16243+
if (y == 0 || Double.isNaN(x) || Double.isInfinite(y) && !Double.isInfinite(x) ) return NaN;
16244+
var modxy = x % y;
16245+
if (modxy == 0 ) return modxy;
16246+
var rem = modxy - (Math.abs(y) * Math.signum(x));
16247+
if (Math.abs(rem) == Math.abs(modxy) ) {
16248+
var div = x / y;
16249+
return (Math.abs(Math.round(div)) > Math.abs(div) ? rem : modxy);
16250+
}
16251+
return (Math.abs(rem) < Math.abs(modxy) ? rem : modxy);
16252+
});
16253+
1624216254
//end datatype reliant math declarations
1624316255

1624416256
Clazz._setDeclared("java.lang.Number", java.lang.Number=Number);

0 commit comments

Comments
 (0)