Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,14 +0,0 @@
|
|||
with Ada.Text_Io.Editing; use Ada.Text_Io.Editing;
|
||||
with Ada.Text_Io; use Ada.Text_Io;
|
||||
|
||||
procedure Zero_Fill is
|
||||
Pic_String: String := "<999999.99>";
|
||||
Pic : Picture := To_Picture(Pic_String);
|
||||
type Money is delta 0.01 digits 8;
|
||||
package Money_Output is new Decimal_Output(Money);
|
||||
use Money_Output;
|
||||
|
||||
Value : Money := 37.25;
|
||||
begin
|
||||
Put(Item => Value, Pic => Pic);
|
||||
end Zero_Fill;
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. NUMERIC-OUTPUT-PROGRAM.
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 WS-EXAMPLE.
|
||||
05 X PIC 9(5)V9(3).
|
||||
PROCEDURE DIVISION.
|
||||
MOVE 7.125 TO X.
|
||||
DISPLAY X UPON CONSOLE.
|
||||
STOP RUN.
|
||||
|
|
@ -1 +0,0 @@
|
|||
(format "%09.3f" 7.125) ;=> "00007.125"
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
constant r = 7.125
|
||||
printf(1,"%9.3f\n",-r)
|
||||
printf(1,"%9.3f\n",r)
|
||||
printf(1,"%-9.3f\n",r)
|
||||
printf(1,"%09.3f\n",-r)
|
||||
printf(1,"%09.3f\n",r)
|
||||
printf(1,"%-09.3f\n",r)
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
to zpad :num :width :precision
|
||||
output map [ifelse ? = "| | ["0] [?]] form :num :width :precision
|
||||
end
|
||||
print zpad 7.125 9 3 ; 00007.125
|
||||
|
|
@ -1 +0,0 @@
|
|||
print form 7.125 -1 "|%09.3f| ; 00007.125
|
||||
|
|
@ -1 +0,0 @@
|
|||
'{0:00000.000}' -f 7.125
|
||||
|
|
@ -1 +0,0 @@
|
|||
7.125.ToString('00000.000')
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
REBOL [
|
||||
Title: "Formatted Numeric Output"
|
||||
URL: http://rosettacode.org/wiki/Formatted_Numeric_Output
|
||||
]
|
||||
|
||||
; REBOL has no built-in facilities for printing pictured output.
|
||||
; However, it's not too hard to cook something up using the
|
||||
; string manipulation facilities.
|
||||
|
||||
zeropad: func [
|
||||
"Pad number with zeros or spaces. Works on entire number."
|
||||
pad "Number of characters to pad to."
|
||||
n "Number to pad."
|
||||
/space "Pad with spaces instead."
|
||||
/local nn c s
|
||||
][
|
||||
n: to-string n c: " " s: ""
|
||||
|
||||
if not space [
|
||||
c: "0"
|
||||
if #"-" = n/1 [pad: pad - 1 n: copy skip n 1 s: "-"]
|
||||
]
|
||||
|
||||
insert/dup n c (pad - length? n)
|
||||
insert n s
|
||||
n
|
||||
]
|
||||
|
||||
; These tests replicate the C example output.
|
||||
|
||||
print [zeropad/space 9 negate 7.125]
|
||||
print [zeropad/space 9 7.125]
|
||||
print 7.125
|
||||
print [zeropad 9 negate 7.125]
|
||||
print [zeropad 9 7.125]
|
||||
print 7.125
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
a = 1234.5678
|
||||
|
||||
' Round to three decimal places. Groups by default. Output = "1,234.568".
|
||||
WScript.Echo FormatNumber(a, 3)
|
||||
|
||||
' Truncate to three decimal places. Output = "1234.567".
|
||||
WScript.Echo Left(a, InStr(a, ".") + 3)
|
||||
|
||||
' Round to a whole number. Grouping disabled. Output = "1235".
|
||||
WScript.Echo FormatNumber(a, 0, , , False)
|
||||
|
||||
' Use integer portion only and pad with zeroes to fill 8 chars. Output = "00001234".
|
||||
WScript.Echo Right("00000000" & Int(a), 8)
|
||||
Loading…
Add table
Add a link
Reference in a new issue