Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
|
|
@ -0,0 +1,3 @@
|
|||
put edit (X) (p'999999.V999'); /* Western format. */
|
||||
|
||||
put edit (X) (p'999999,V999'); /* In European format. */
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
lz: Proc Options(main);
|
||||
/*********************************************************************
|
||||
* 10.09.2013 Walter Pachl one way to treat negative numbers
|
||||
* another would be using a Picture of 'S(9)9.V(3)9' or '-(9)9.V(3)9'
|
||||
*********************************************************************/
|
||||
Call z2lz(1.2);
|
||||
Call z2lz(-1.32);
|
||||
Call z2lz(123456789.012);
|
||||
Call z2lz(-23456789.012);
|
||||
Call z2lz(-123456789.012);
|
||||
|
||||
z2lz: Proc(z);
|
||||
Dcl z Dec Fixed(15,3); ;
|
||||
Dcl s Char(13) Based(addr(p));
|
||||
Dcl p Pic'(9)9.V(3)9';
|
||||
p=z;
|
||||
If z<0 Then
|
||||
If left(s,1)='0' Then substr(s,1,1)='-';
|
||||
Else Do;
|
||||
Put Skip List(z,'can''t be formatted that way');
|
||||
Return;
|
||||
End;
|
||||
Put Skip List(z,s);
|
||||
End;
|
||||
End;
|
||||
|
|
@ -1 +1,10 @@
|
|||
println("%09.3f".format(7.125)) //-> 00007.125
|
||||
object FormattedNumeric {
|
||||
val r = 7.125 //> r : Double = 7.125
|
||||
println(f" ${-r}%9.3f"); //> -7,125
|
||||
println(f" $r%9.3f"); //> 7,125
|
||||
println(f" $r%-9.3f"); //> 7,125
|
||||
println(f" ${-r}%09.3f"); //> -0007,125
|
||||
println(f" $r%09.3f"); //> 00007,125
|
||||
println(f" $r%-9.3f"); //> 7,125
|
||||
println(f" $r%+09.3f"); //> +0007,125
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue