Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,38 @@
/* NetRexx */
options replace format comments java crossref symbols nobinary
import java.util.Formatter
loop i_ = 1 to 3
loop n_ = 20 to 20000 by 2131
select case i_
when 1 then say useBif(n_)
when 2 then say useJavaFormat(n_)
when 3 then say useJavaNumber(n_)
otherwise nop
end
end n_
say
end i_
return
-- NetRexx doesn't have a decimal to octal conversion
method useBif(n_) public static
d_ = '_'
return '[Base 16='n_.d2x().right(8)',Base 10='n_.right(8)',Base 8='d_.right(8)',Base 2='n_.d2x().x2b().right(20)']'
-- Some of Java's java.lang.Number classes have conversion methods
method useJavaNumber(n_) public static
nx = Long.toHexString(n_)
nd = Long.toString(n_)
no = Long.toOctalString(n_)
nb = Long.toBinaryString(n_)
return '[Base 16='Rexx(nx).right(8)',Base 10='Rexx(nd).right(8)',Base 8='Rexx(no).right(8)',Base 2='Rexx(nb).right(20)']'
-- Java Formatter doesn't have a decimal to binary conversion
method useJavaFormat(n_) public static
fb = StringBuilder()
fm = Formatter(fb)
fm.format("[Base 16=%1$8x,Base 10=%1$8d,Base 8=%1$8o,Base 2=%2$20s]", [Object Long(n_), String('_')])
return fb.toString()