File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -81,16 +81,24 @@ my module sprintf {
81
81
return $ handler . int ($ number_representation );
82
82
}
83
83
}
84
-
85
- my $ result ;
86
- if $ number_representation > 0 {
87
- $ result := nqp ::floor_n($ number_representation );
88
- }
89
- else {
90
- $ result := nqp ::ceil_n($ number_representation );
91
- }
84
+
92
85
my $ knowhow := nqp ::knowhow(). new_type(: repr(" P6bigint" ));
93
- nqp ::box_i($ result , $ knowhow );
86
+
87
+ if nqp ::eqaddr($ number_representation . WHAT , 1 . WHAT ) {
88
+ nqp ::box_i($ number_representation , $ knowhow );
89
+ } else {
90
+ if nqp ::eqaddr($ number_representation . WHAT , 1.01 . WHAT )
91
+ || nqp ::eqaddr($ number_representation . WHAT , " 1.01" . WHAT ) {
92
+ if $ number_representation > 0 {
93
+ nqp ::fromnum_I(nqp ::floor_n($ number_representation ), $ knowhow );
94
+ }
95
+ else {
96
+ nqp ::fromnum_I(nqp ::ceil_n($ number_representation ), $ knowhow );
97
+ }
98
+ } else {
99
+ $ number_representation ;
100
+ }
101
+ }
94
102
}
95
103
96
104
sub padding_char ($ st ) {
You can’t perform that action at this time.
0 commit comments