1. text.e bugs?

I'd appreciate anyone trying the program below and letting us know whether you have the same results. I've looked into text.e - where the problem lies, I think, but that is a huge amount of code to wade thru.

include std/console.e 
 
sequence numbers = {32, 1.2, 1.23, -1.23, -45.60, -45.61, 1499.459, -267.456, 1234567.893 ,-1234567.894} 
 
for i = 1 to length(numbers) do 
	printf(1,"%2d Printf: %12.2f  ",{i,numbers[i]}) 
	display("Fmt A: [(,,:12.2] Fmt B: [,,:12.2]  Raw: [] ",{numbers[i],numbers[i],numbers[i]}) 
end for 
 
 
/*  

 1 Printf:        32.00  Fmt A:        32.00 Fmt B:        32.00  Raw: 32  
 2 Printf:         1.20  Fmt A:         1.20 Fmt B:         1.20  Raw: 1.2  
 3 Printf:         1.23  Fmt A:         1.23 Fmt B:         1.23  Raw: 1.23  
 4 Printf:        -1.23  Fmt A:        (1.2) Fmt B:        -1.23  Raw: -1.23  
 5 Printf:       -45.60  Fmt A:       (45.6) Fmt B:       -45.60  Raw: -45.6  
 6 Printf:       -45.61  Fmt A:       (45.6) Fmt B:       -45.61  Raw: -45.61  
 7 Printf:      1499.46  Fmt A:     1,499.45 Fmt B:     1,499.45  Raw: 1499.459  
 8 Printf:      -267.46  Fmt A:      (267.4) Fmt B:     -,267.45  Raw: -267.456  
 9 Printf:   1234567.89  Fmt A: 1,234,567.89 Fmt B: 1,234,567.89  Raw: 1234567.893  
10 Printf:  -1234567.89  Fmt A: 1,234,567.8) Fmt B: 1,234,567.89  Raw: -1234567.894  
*/ 
 
new topic     » topic index » view message » categorize

2. Re: text.e bugs?

I get identical results on 32bit Mint17, o[4.1

_tom

new topic     » goto parent     » topic index » view message » categorize

3. Re: text.e bugs?

Eu4.1 on Archlinux64

field size = 12

[$]: eui prutext.ex  
 1 Printf:        32.00  Fmt A:        32.00 Fmt B:        32.00  Raw: 32  
 2 Printf:         1.20  Fmt A:         1.20 Fmt B:         1.20  Raw: 1.2  
 3 Printf:         1.23  Fmt A:         1.23 Fmt B:         1.23  Raw: 1.23  
 4 Printf:        -1.23  Fmt A:       (1.23) Fmt B:        -1.23  Raw: -1.23  
 5 Printf:       -45.60  Fmt A:      (45.60) Fmt B:       -45.60  Raw: -45.6  
 6 Printf:       -45.61  Fmt A:      (45.61) Fmt B:       -45.61  Raw: -45.61  
 7 Printf:      1499.46  Fmt A:     1,499.45 Fmt B:     1,499.45  Raw: 1499.459  
 8 Printf:      -267.46  Fmt A:     (267.45) Fmt B:     -,267.45  Raw: -267.456  
 9 Printf:   1234567.89  Fmt A: 1,234,567.89 Fmt B: 1,234,567.89  Raw: 1234567.893  
10 Printf:  -1234567.89  Fmt A: ,234,567.89) Fmt B: 1,234,567.89  Raw: -1234567.894  

field size = 14

[$]: eui prutext.ex  
 1 Printf:          32.00  Fmt A:          32.00 Fmt B:          32.00  Raw: 32  
 2 Printf:           1.20  Fmt A:           1.20 Fmt B:           1.20  Raw: 1.2  
 3 Printf:           1.23  Fmt A:           1.23 Fmt B:           1.23  Raw: 1.23  
 4 Printf:          -1.23  Fmt A:         (1.23) Fmt B:          -1.23  Raw: -1.23  
 5 Printf:         -45.60  Fmt A:        (45.60) Fmt B:         -45.60  Raw: -45.6  
 6 Printf:         -45.61  Fmt A:        (45.61) Fmt B:         -45.61  Raw: -45.61  
 7 Printf:        1499.46  Fmt A:       1,499.45 Fmt B:       1,499.45  Raw: 1499.459  
 8 Printf:        -267.46  Fmt A:       (267.45) Fmt B:       -,267.45  Raw: -267.456  
 9 Printf:     1234567.89  Fmt A:   1,234,567.89 Fmt B:   1,234,567.89  Raw: 1234567.893  
10 Printf:    -1234567.89  Fmt A: (1,234,567.89) Fmt B:  -1,234,567.89  Raw: -1234567.894 
in format function (std/text.e, line approx. 1870)

 
      if atom(currargv) then 
         if find('e', argtext) = 0 then 
            -- Only applies to non-scientific notation. 
            if decs != -1 then 
               pos = find('.', argtext) 
               if pos then 
                  if decs = 0 then 
                     argtext = argtext [1 .. pos-1 ] 
                  else 
 
-- added -------------------------------------------------------------------------------- 
                     integer pflag = 0              -- parenthesis flag 
                     if msign and currargv < 0 then 
                        pflag = 1                   -- argtext = "(dd...d.dd...)" 
                     end if                               
-- -------------------------------------------------------------------------------------- 
 
--                   -- pos = length(argtext) - pos 
                     pos = length(argtext) - pos - pflag  -- without closing parenthesis 
 
                     if pos > decs then 
                        argtext = argtext[ 1 .. $ - pos + decs ] 
                     elsif pos < decs then 
 
--                      -- argtext = argtext & repeat('0', decs - pos) 
                        argtext = argtext[ 1 .. $ - pflag ] & repeat('0', decs - pos) 
                        -- except closing parenthesis 
-- added -------------------------------------------------------------------------------- 
                        if pflag then 
                           argtext &= ')'                  -- add closing parenthesis 
                        end if 
-- -------------------------------------------------------------------------------------- 
  
                     end if 
                  end if 
               elsif decs > 0 then 
                  argtext = argtext & '.' & repeat('0', decs) 
              end if 
           end if 
 
         end if 
      end if 
new topic     » goto parent     » topic index » view message » categorize

4. Re: text.e bugs?

Thanks!

new topic     » goto parent     » topic index » view message » categorize

5. Re: text.e bugs?

No need to give them. Please.

new topic     » goto parent     » topic index » view message » categorize

6. Re: text.e bugs?

Had to add one more patch to eliminate the -,267.45 shown in line 8b

Around line 1956 of text.e:

	    						dpos -= dist 
	    						if dpos > 1 then 
	    							argtext = argtext[1.. dpos - 1] & tsep & argtext[dpos .. $] 
	    						end if 
	    					end while 
	    					if bracketed then 
	    						argtext = '(' & argtext & ')' 
	    					end if 
	    				end if 
					end if 
-- patch by irv ---------------------------- 
			if match("-,",argtext) = 1 then 
				argtext = '-'&argtext[3..$] 
			end if 
-------------------------------------------- 
    				if width <= 0 then 
    					width = length(argtext) 
    				end if 
 
 
    				if width < length(argtext) then 
    					if align = '>' then 
    						argtext = argtext[ $ - width + 1 .. $] 
    					elsif align = 'c' then 
    						pos = length(argtext) - width 
 
new topic     » goto parent     » topic index » view message » categorize

7. Re: text.e bugs?

Ok.

new topic     » goto parent     » topic index » view message » categorize

8. Re: text.e bugs?

I found this:

                      while dpos > dist do 
                         dpos -= dist 
  
--                          if dpos > 1 then 
                         -- take account sign character '+' and '-', '(' removed above 
                         if dpos > 1 + (currargv < 0) * not msign + (currargv > 0) * psign then 
 
                            argtext = argtext[1.. dpos - 1] & tsep & argtext[dpos .. $] 
                         end if 
                      end while 
                      if bracketed then 
                         argtext = '(' & argtext & ')' 
                      end if 
                   end if 
               end if 
-- patch by irv ---------------------------- don't works if argtext = "+,..." 
--         if match("-,",argtext) = 1 then  
--            argtext = '-'&argtext[3..$]  
--         end if  
--------------------------------------------  
 
 
new topic     » goto parent     » topic index » view message » categorize

9. Re: text.e bugs?

I posted a pastey with my proposal for format function with some modifications.

http://openeuphoria.org/pastey/262.wc

new topic     » goto parent     » topic index » view message » categorize

10. Re: text.e bugs?

Created patch.

http://openeuphoria.org/pastey/263.wc

new topic     » goto parent     » topic index » view message » categorize

11. Re: text.e bugs?

cargoan said...

I was going to commit this, but there's a bug with this patch according to tests/t_text.e

Can you look into this?

<pre> failed: format 'F', expected: "The answer is 1.234500" but got: "The answer is 1.234500.00" 178 tests run, 177 passed, 1 failed, 99% success </pre>

new topic     » goto parent     » topic index » view message » categorize

12. Re: text.e bugs?

jimcbrown said...
cargoan said...

I was going to commit this, but there's a bug with this patch according to tests/t_text.e

Can you look into this?

<pre> failed: format 'F', expected: "The answer is 1.234500" but got: "The answer is 1.234500.00" 178 tests run, 177 passed, 1 failed, 99% success </pre>

I've commited a version of the patch that doesn't have this issue.

new topic     » goto parent     » topic index » view message » categorize

13. Re: text.e bugs?

Thanks! I am very grateful.

new topic     » goto parent     » topic index » view message » categorize

14. Re: text.e bugs?

But.

 
 
include std/console.e  
include std/text.e 
 
display("Fmt A: [,,:14.2] Fmt B: [,,:14.2]  Raw: []",     {-123456.789, -123456.789, -123456.789})  
display("Fmt A: [+,,:14.2] Fmt B: [+,,:14.2]  Raw: []\n", { 123456.789, 123456.789, 123456.789})  
display("Fmt A: [,,:14.2] Fmt B: [,,:14.2]  Raw: []",     {-267.4, -267.4, -267.4})  
display("Fmt A: [+,,:14.2] Fmt B: [+,,:14.2]  Raw: []\n", { 267.4, 267.4, 267.4})  
display("Fmt A: [(,,:14.2] Fmt B: [,,:14.2]  Raw: []",     {-267.4, -267.4, -267.4})  
display("Fmt A: [+(,,:14.2] Fmt B: [+,,:14.2]  Raw: []\n", { 267.4, 267.4, 267.4})  
 
/*   output 

 
Fmt A:   -,123,456.78 Fmt B:   -,123,456.78  Raw: -123456.789 
Fmt A:   +,123,456.78 Fmt B:   +,123,456.78  Raw: 123456.789 
 
Fmt A:       -,267.40 Fmt B:       -,267.40  Raw: -267.4 
Fmt A:       +,267.40 Fmt B:       +,267.40  Raw: 267.4 
 
Fmt A:        (267.4) Fmt B:       -,267.40  Raw: -267.4 
Fmt A:       +,267.40 Fmt B:       +,267.40  Raw: 267.4 
 
*/ 
 
 
new topic     » goto parent     » topic index » view message » categorize

15. Re: text.e bugs?

patch

 
--- text.e	2015-01-12 08:14:42.156966000 +0100 
+++ text.e.new	2015-01-12 08:13:40.122966000 +0100 
@@ -1923,6 +1923,7 @@ 
  
 	    					if binout or hexout then 
 	    						dist = 4 
+	    						psign = 0 
 	    					else 
 	    						dist = 3 
 	    					end if 
@@ -1940,7 +1941,7 @@ 
 	    					end if 
 	    					while dpos > dist do 
 	    						dpos -= dist 
-	    						if dpos > 1 then  
+	    						if dpos > 1 + (currargv < 0) * not msign + (currargv > 0) * psign then  
 	    							argtext = argtext[1.. dpos - 1] & tsep & argtext[dpos .. $] 
 	    						end if 
 	    					end while 
 
 

Sorry, inexplicably forgotten.

new topic     » goto parent     » topic index » view message » categorize

16. Re: text.e bugs?

cargoan said...

patch

--- text.e	2015-01-12 08:14:42.156966000 +0100 
+++ text.e.new	2015-01-12 08:13:40.122966000 +0100 

I have applied this patch as well.

BTW, for easeof use the patch really should read like this:

--- text.e	2015-01-12 08:14:42.156966000 +0100 
+++ text.e	2015-01-12 08:13:40.122966000 +0100 

new topic     » goto parent     » topic index » view message » categorize

17. Re: text.e bugs?

another:

 
--- text.e	2015-01-12 08:48:35.229966000 +0100 
+++ text.e	2015-01-12 08:13:40.122966000 +0100 
@@ -1892,12 +1892,11 @@ 
 										if pos > decs then 
 											argtext = argtext[ 1 .. $ - pos + decs ] 
 										elsif pos < decs then 
-											argtext = argtext[ 1 .. $ - pflag ] & repeat('0', decs - pos) 
-											--if pflag then 
-												--argtext = argtext[ 1 .. $ - 1 ] & repeat('0', decs - pos) & ')' 
-											--else 
-												--argtext = argtext & repeat('0', decs - pos) 
-											--end if 
+											if pflag then 
+												argtext = argtext[ 1 .. $ - 1 ] & repeat('0', decs - pos) & ')' 
+											else 
+												argtext = argtext & repeat('0', decs - pos) 
+											end if 
 										end if 
 									end if 
 								elsif decs > 0 then 
 
 
 

new topic     » goto parent     » topic index » view message » categorize

18. Re: text.e bugs?

sorry

new topic     » goto parent     » topic index » view message » categorize

19. Re: text.e bugs?

cargoan said...

another:

This one causes a test in t_text.e to fail. I'm not committing this until that issue is corrected.

new topic     » goto parent     » topic index » view message » categorize

20. Re: text.e bugs?

Sorry, I changed commented lines so patch not applied.

 
--- text.e	2015-01-12 09:22:20.992966000 +0100 
+++ text.e	2015-01-12 09:26:31.060966000 +0100 
@@ -1892,12 +1892,11 @@ 
 										if pos > decs then 
 											argtext = argtext[ 1 .. $ - pos + decs ] 
 										elsif pos < decs then 
-											argtext = argtext[ 1 .. $ - pflag ] & repeat('0', decs - pos) 
-											--if pflag then 
-												--argtext = argtext[ 1 .. $ - 1 ] & '.' & repeat('0', decs - pos) & ')' 
-											--else 
-												--argtext = argtext & '.' & repeat('0', decs - pos) 
-											--end if 
+											if pflag then 
+												argtext = argtext[ 1 .. $ - 1 ] & repeat('0', decs - pos) & ')' 
+											else 
+												argtext = argtext & repeat('0', decs - pos) 
+											end if 
 										end if 
 									end if 
 								elsif decs > 0 then 
 

 
[$]: eutest t_text.e  
 
interpreting t_text.e: 
 
Test results summary: 
Files (run: 1) (failed: 0) (100% success) 
new topic     » goto parent     » topic index » view message » categorize

21. Re: text.e bugs?

cargoan said...

Sorry, I changed commented lines so patch not applied.

 
--- text.e	2015-01-12 09:22:20.992966000 +0100 
+++ text.e	2015-01-12 09:26:31.060966000 +0100 
 

 
[$]: eutest t_text.e  
 
interpreting t_text.e: 
 
Test results summary: 
Files (run: 1) (failed: 0) (100% success) 

Now I'm getting this:

  failed: format 'F', expected: "The answer is 1.234500" but got: "The answer is 1.23450000" 
  178 tests run, 177 passed, 1 failed, 99% success 

new topic     » goto parent     » topic index » view message » categorize

22. Re: text.e bugs?

Check passes for me.??? (Arch Linux 64)

[cargoan@HP-s3733es ~]$ eui -v 
Euphoria Interpreter  v4.1.0 development 
   64-bit Linux, Using System Memory 
   Revision Date: 2014-10-01 13:26:40, Id: 6258:f0054b3a8f8b 
 
[cargoan@HP-s3733es ~]$ cd Fuentes/mercurial/euphoria/ 
[cargoan@HP-s3733es euphoria]$ hg pull 
pulling from http://scm.openeuphoria.org/hg/euphoria 
searching for changes 
no changes found 
[cargoan@HP-s3733es euphoria]$ hg id 
f0054b3a8f8b (struct) 
[cargoan@HP-s3733es euphoria]$ hg update default 
48 files updated, 0 files merged, 7 files removed, 0 files unresolved 
[cargoan@HP-s3733es euphoria]$ cp include/std/text.e  "$EUINC/std/text.e" 
[cargoan@HP-s3733es euphoria]$ cd "$EUINC/std/" 
[cargoan@HP-s3733es std]$ diff -u text.e  text.e.new  > changes 
[cargoan@HP-s3733es std]$ patch < changes 
patching file text.e 
[cargoan@HP-s3733es std]$ eutest "$EUDIR/tests/t_text.e"  
 
interpreting /home/cargoan/euphoria-LINUX-4.1.0/tests/t_text.e: 
 
Test results summary: 
Files (run: 1) (failed: 0) (100% success) 
[cargoan@HP-s3733es std]$ cat changes 
--- text.e	2015-01-12 10:27:00.977966000 +0100 
+++ text.e.new	2015-01-12 10:18:10.010966000 +0100 
@@ -1892,12 +1892,11 @@ 
 										if pos > decs then 
 											argtext = argtext[ 1 .. $ - pos + decs ] 
 										elsif pos < decs then 
-											argtext = argtext[ 1 .. $ - pflag ] & repeat('0', decs - pos) 
-											--if pflag then 
-												--argtext = argtext[ 1 .. $ - 1 ] & '.' & repeat('0', decs - pos) & ')' 
-											--else 
-												--argtext = argtext & '.' & repeat('0', decs - pos) 
-											--end if 
+											if pflag then 
+												argtext = argtext[ 1 .. $ - 1 ] & repeat('0', decs - pos) & ')' 
+											else 
+												argtext = argtext & repeat('0', decs - pos) 
+											end if 
 										end if 
 									end if 
 								elsif decs > 0 then 
[cargoan@HP-s3733es std]$  
 

???????...

new topic     » goto parent     » topic index » view message » categorize

23. Re: text.e bugs?

cargoan said...

Check passes for me.??? (Arch Linux 64)

What issue is this patch intended to fix?

new topic     » goto parent     » topic index » view message » categorize

24. Re: text.e bugs?

This:

 
include std/console.e  
include std/text.e 
 
 
display("Fmt A: [(,,:14.2] Fmt B: [,,:14.2]  Raw: []",     { 267.4,  267.4,  267.4})  
display("Fmt A: [+(,,:14.2] Fmt B: [+,,:14.2]  Raw: []\n", {-267.4, -267.4, -267.4})  
 
/*   output 

 
Fmt A:         267.40 Fmt B:         267.40  Raw: 267.4 
Fmt A:        (267.4) Fmt B:        -267.40  Raw: -267.4 
 
 
*/ 
 
 
-- eucode 
new topic     » goto parent     » topic index » view message » categorize

25. Re: text.e bugs?

cargoan said...

This:

 
include std/console.e  
include std/text.e 
 
 
display("Fmt A: [(,,:14.2] Fmt B: [,,:14.2]  Raw: []",     { 267.4,  267.4,  267.4})  
display("Fmt A: [+(,,:14.2] Fmt B: [+,,:14.2]  Raw: []\n", {-267.4, -267.4, -267.4})  
 
/*   output 

 
Fmt A:         267.40 Fmt B:         267.40  Raw: 267.4 
Fmt A:        (267.4) Fmt B:        -267.40  Raw: -267.4 
 
*/ 
 
 
-- eucode 

This is the output that I get from what is currently checked in...

 
Fmt A:        267.400 Fmt B:        267.400  Raw: 267.4 
Fmt A:       (267.40) Fmt B:       -267.400  Raw: -267.4 
 

new topic     » goto parent     » topic index » view message » categorize

26. Re: text.e bugs?

 
patched: 
Fmt A:         267.40 Fmt B:         267.40  Raw: 267.4 
Fmt A:       (267.40) Fmt B:        -267.40  Raw: -267.4 
 
 

new topic     » goto parent     » topic index » view message » categorize

27. Re: text.e bugs?

cargoan said...

 
patched: 
Fmt A:         267.40 Fmt B:         267.40  Raw: 267.4 
Fmt A:       (267.40) Fmt B:        -267.40  Raw: -267.4 
 
 

Understood. That patch has now been committed as well.

new topic     » goto parent     » topic index » view message » categorize

28. Re: text.e bugs?

jimcbrown said...
cargoan said...

Sorry, I changed commented lines so patch not applied.

 
--- text.e	2015-01-12 09:22:20.992966000 +0100 
+++ text.e	2015-01-12 09:26:31.060966000 +0100 
 

 
[$]: eutest t_text.e  
 
interpreting t_text.e: 
 
Test results summary: 
Files (run: 1) (failed: 0) (100% success) 

Now I'm getting this:

  failed: format 'F', expected: "The answer is 1.234500" but got: "The answer is 1.23450000" 
  178 tests run, 177 passed, 1 failed, 99% success 

I understand what happened here. I missed a line of the patch. My fault, sorry.

new topic     » goto parent     » topic index » view message » categorize

29. Re: text.e bugs?

Actually it was my mistake. I had to delete a line in the first patch that should be commented

This one:

argtext = argtext[ 1 .. $ - pflag ] & repeat('0', decs - pos) 

Then jim comments the other and left that, when it should be the opposite. Although they had the error of a dot insertion (copy/paste stuff)

Thank you for everything!

new topic     » goto parent     » topic index » view message » categorize

30. Re: text.e bugs?

I found this:

 
printf(1, "%.6f\n", 2.6758787874) ==> 2.675879 
printf(1, "%.6g\n", 2.6758787874) ==> 2.67588 
 

printf general format bug?

new topic     » goto parent     » topic index » view message » categorize

31. Re: text.e bugs?

cargoan said...

I found this:

 
printf(1, "%.6f\n", 2.6758787874) ==> 2.675879 
printf(1, "%.6g\n", 2.6758787874) ==> 2.67588 
 

printf general format bug?

Probably. I get identical results from the following C code, so it's a C library issue, not an Euphoria issue.

#include <stdio.h> 
int main(int argc, char ** argv) 
{ 
printf("%.6f\n", 2.6758787874); 
printf("%.6g\n", 2.6758787874); 
return 0; 
} 
new topic     » goto parent     » topic index » view message » categorize

32. Re: text.e bugs?

jimcbrown said...
cargoan said...

printf general format bug?

Probably. I get identical results from the following C code, so it's a C library issue, not an Euphoria issue.

It has nothing to do with the C library. If you increase the number of digits before the decimal point:

   2.6758787874 ==> 2.675879  
   2.6758787874 ==> 2.67588  
  12.6758787874 ==> 12.675879  
  12.6758787874 ==> 12.6759  
 123.6758787874 ==> 123.675879  
 123.6758787874 ==> 123.676  
1234.6758787874 ==> 1234.675879  
1234.6758787874 ==> 1234.68 
I think the ".6" has a different meaning for f (six decimal paces?) and g (six digits?).
If anyone finds somewhere this is explained properly, please post a link here.

Pete

new topic     » goto parent     » topic index » view message » categorize

33. Re: text.e bugs?

petelomax said...

... I think the ".6" has a different meaning for f (six decimal paces?) and g (six digits?).
If anyone finds somewhere this is explained properly, please post a link here.

Pete

http://www.gnu.org/software/libc/manual/html_node/Floating_002dPoint-Conversions.html#Floating_002dPoint-Conversions

said...

The ‘%g’ and ‘%G’ conversions print the argument in the style of ‘%e’ or ‘%E’ (respectively) if the exponent would be less than -4 or greater than or equal to the precision; otherwise they use the ‘%f’ style. A precision of 0, is taken as 1. Trailing zeros are removed from the fractional portion of the result and a decimal-point character appears only if it is followed by a digit.

new topic     » goto parent     » topic index » view message » categorize

34. Re: text.e bugs?

Please! Ignore this patch.

I put later other with the amendments and 64 bits support.

And more

include std/text.e 
 
 
puts(1, format("Fmt A: [(,,:018.2] Fmt B: [,,:018.2]  Raw: []",     { 1267.4,  1267.4,  1267.4}) & 10)  
puts(1, format("Fmt A: [(,,:018.2] Fmt B: [,,:018.2]  Raw: []",     {-1267.4, -1267.4, -1267.4}) & 10)  
puts(1, format("Fmt A: [+(,,:018.2] Fmt B: [+,,:018.2]  Raw: []",   { 1267.4,  1267.4,  1267.4}) & 10)  
puts(1, format("Fmt A: [+(,,:018.2] Fmt B: [+,,:018.2]  Raw: []\n", {-1267.4, -1267.4, -1267.4}) & 10)  
 
 
puts(1, format("Fmt A: [z,,:18] Fmt B: [,,:018.2]  Raw: []",   { 1267.4,  1267.4,  1267.4}) & 10)  
puts(1, format("Fmt A: [z,,:18] Fmt B: [,,:018.2]  Raw: []",   {-1267.4, -1267.4, -1267.4}) & 10)  
puts(1, format("Fmt A: [+z,,:18] Fmt B: [+,,:018.2]  Raw: []", { 1267.4,  1267.4,  1267.4}) & 10)  
puts(1, format("Fmt A: [+z,,:18] Fmt B: [+,,:018.2]  Raw: []", {-1267.4, -1267.4, -1267.4}) & 10)  

[$]: eui ~/prutext.ex  
Fmt A: 000000000001267.40 Fmt B: 000000000001267.40  Raw: 1267.4 
Fmt A: 00000000001267.40) Fmt B: 000000000001267.40  Raw: -1267.4 
Fmt A: 000000000001267.40 Fmt B: 000000000001267.40  Raw: 1267.4 
Fmt A: 00000000001267.40) Fmt B: 000000000001267.40  Raw: -1267.4 
 
Fmt A: 0000000000001267.4 Fmt B: 000000000001267.40  Raw: 1267.4 
Fmt A: -000000000001267.4 Fmt B: 000000000001267.40  Raw: -1267.4 
Fmt A: +000000000001267.4 Fmt B: 000000000001267.40  Raw: 1267.4 
Fmt A: -000000000001267.4 Fmt B: 000000000001267.40  Raw: -1267.4 
 
[$]: cd $EUINC/std; diff -u text.e  text.e.new | patch; eutest "$EUDIR/tests/t_text.e"; 
patching file text.e 
 
interpreting /home/cargoan/euphoria-LINUX-4.1.0/tests/t_text.e: 
 
Test results summary: 
Files (run: 1) (failed: 0) (100% success) 
 
[$]: eui ~/prutext.ex  
Fmt A: 000000000001267.40 Fmt B: 000000000001267.40  Raw: 1267.4 
Fmt A: (0000000001267.40) Fmt B: -00000000001267.40  Raw: -1267.4 
Fmt A: +00000000001267.40 Fmt B: +00000000001267.40  Raw: 1267.4 
Fmt A: (0000000001267.40) Fmt B: -00000000001267.40  Raw: -1267.4 
 
Fmt A: 0000000000001267.4 Fmt B: 000000000001267.40  Raw: 1267.4 
Fmt A: -000000000001267.4 Fmt B: -00000000001267.40  Raw: -1267.4 
Fmt A: +000000000001267.4 Fmt B: +00000000001267.40  Raw: 1267.4 
Fmt A: -000000000001267.4 Fmt B: -00000000001267.40  Raw: -1267.4 

patch:

--- text.e	2015-01-14 09:02:11.151693000 +0100 
+++ text.e	2015-01-14 08:53:20.514693000 +0100 
@@ -1441,7 +1441,9 @@ 
 	integer ep 
 	integer pflag 
 	integer count 
-	 
+	sequence fmt 
+	atom argval 
+		 
 	if atom(arg_list) then 
 		arg_list = {arg_list} 
 	end if 
@@ -1548,7 +1550,7 @@ 
 	    				end if 
 	    				width = width * 10 + pos - 1 
 	    				if width = 0 then 
-	    					zfill = '0' 
+	    					zfill = 1 
 	    				end if 
 	    			end while 
  
@@ -1760,7 +1762,19 @@ 
 									end if 
 								end if 
 							else 
-								argtext = trim(sprintf("%15.15g", arg_list[argn])) 
+								argval = arg_list[argn] 
+								if argval < 0 then 
+								   argval = -argval 
+								end if 
+								if decs < 0 then 
+									fmt = "%.15g" 
+								elsif argval >= 1e15 or 
+									  argval < 1e-4 then 
+									fmt = sprintf("%%.%de", decs) 
+								else 
+									fmt = sprintf("%%.%df", decs) 
+								end if 
+								argtext = trim(sprintf(fmt, arg_list[argn])) 
 								-- Remove any leading 0 after e+ 
 								while ep != 0 with entry do 
 									argtext = remove(argtext, ep+2) 
@@ -1770,7 +1784,11 @@ 
 								if zfill != 0 and width > 0 then 
 									if width > length(argtext) then 
 										if argtext[1] = '-' then 
-											argtext = '-' & repeat('0', width - length(argtext)) & argtext[2..$] 
+											if msign then 
+												argtext = '-' & repeat('0', width - length(argtext) - 1) & argtext[2..$] 
+											else 
+												argtext = '-' & repeat('0', width - length(argtext)) & argtext[2..$] 
+											end if 
 										else 
 											argtext = repeat('0', width - length(argtext)) & argtext 
 										end if 
@@ -1790,7 +1808,7 @@ 
 											argtext = '(' & argtext[2..$] & ')' 
 										else 
 											if argtext[2] = '0' then 
-												argtext = '(' & argtext[3..$] & ')' 
+												argtext = '(' & argtext[2..$] & ')' 
 											else 
 												argtext = argtext[2..$] & ')' 
 											end if 
 
 

new topic     » goto parent     » topic index » view message » categorize

35. Re: text.e bugs?

cargoan said...
petelomax said...

... I think the ".6" has a different meaning for f (six decimal paces?) and g (six digits?).
If anyone finds somewhere this is explained properly, please post a link here.

Pete

http://www.gnu.org/software/libc/manual/html_node/Floating_002dPoint-Conversions.html#Floating_002dPoint-Conversions

said...

The ‘%g’ and ‘%G’ conversions print the argument in the style of ‘%e’ or ‘%E’ (respectively) if the exponent would be less than -4 or greater than or equal to the precision; otherwise they use the ‘%f’ style. A precision of 0, is taken as 1. Trailing zeros are removed from the fractional portion of the result and a decimal-point character appears only if it is followed by a digit.

Thanks.

For completeness, that page also said...

The precision specifies how many digits follow the decimal-point character for the ‘%f’, ‘%e’, and ‘%E’ conversions. For these conversions, the default precision is 6. If the precision is explicitly 0, this suppresses the decimal point character entirely. For the ‘%g’ and ‘%G’ conversions, the precision specifies how many significant digits to print.

I think I'll probably just add a see also("external link") to that from my help file.

new topic     » goto parent     » topic index » view message » categorize

36. Re: text.e bugs?

Same as previous plus 64bits support.

Tests fails in 4.1 version, expected a floating (1.2345e+17) but it is an integer in 64 bits, and expected a 32 bits sequence in binary format.

I use only Euphoria 4.1.

[$]: eutest "$EUDIR/tests/t_text.e"; 
 
interpreting /home/cargoan/euphoria-LINUX-4.1.0/tests/t_text.e: 
  failed: format 'I', expected: "The answer is 1.2345e+17" but got: "The answer is 123450000000000000.0000" 
  failed: format 'AH', expected: "11111111111111111111111101001111" but got: "1111111111111111111111111111111111111111111111111111111101001111" 
  178 tests run, 176 passed, 2 failed, 99% success 
FAILURE: /home/cargoan/euphoria-LINUX-4.1.0/tests/t_text.e program died with status 1 
 
Test results summary: 
    FAIL: /home/cargoan/euphoria-LINUX-4.1.0/tests/t_text.e 
Files (run: 1) (failed: 1) (0% success) 
 

Patch:

--- text.e	2015-01-16 16:51:23.272149000 +0100 
+++ text.e	2015-01-16 16:49:52.882149000 +0100 
@@ -1408,6 +1408,22 @@ 
 -- See Also: 
 --   [[:sprintf]] 
 -- 
+ifdef EU4_1 then 
+    constant MAX_BITS =  64 
+    constant MAX_DIGS =  18 
+    constant MAX_INT  =  0x3FFF_FFFF_FFFF_FFFF 
+    constant MIN_INT  = -0x4000_0000_0000_0000 
+elsedef 
+    constant MAX_BITS =  32 
+    constant MAX_DIGS =  15 
+    constant MAX_INT  =  0x3FFF_FFFF 
+    constant MIN_INT  = -0x4000_0000 
+end ifdef 
+ 
+constant MAX_UCS4 =  0xFFFF_FFFF 
+constant MAX_IFMT =  0x3FFF_FFFF 
+constant MIN_IFMT = -0x4000_0000 
+ 
  
 public function format(sequence format_pattern, object arg_list = {}) 
 	sequence result 
@@ -1441,7 +1457,9 @@ 
 	integer ep 
 	integer pflag 
 	integer count 
-	 
+	sequence fmt 
+	atom argval 
+		 
 	if atom(arg_list) then 
 		arg_list = {arg_list} 
 	end if 
@@ -1548,7 +1566,7 @@ 
 	    				end if 
 	    				width = width * 10 + pos - 1 
 	    				if width = 0 then 
-	    					zfill = '0' 
+	    					zfill = 1 
 	    				end if 
 	    			end while 
  
@@ -1677,18 +1695,18 @@ 
 							argtext = arg_list[argn] 
 						end if 
 						 
-					elsif integer(arg_list[argn])  
-					-- for consistent formatting, we need to test in case of 64-bit euphoria 
-					and arg_list[argn] <= 0x3fff_ffff 
-					and arg_list[argn] >= -0x4000_0000 then 
+					elsif integer(arg_list[argn]) 
+					    -- for consistent formatting, we need to test in case of 64-bit euphoria 
+					    and arg_list[argn] <= MAX_IFMT 
+					    and arg_list[argn] >= MIN_IFMT then 
 						if istext then 
-							argtext = {and_bits(0xFFFF_FFFF, math:abs(arg_list[argn]))} 
+							argtext = {and_bits(MAX_UCS4, math:abs(arg_list[argn]))} 
 							 
 						elsif bwz != 0 and arg_list[argn] = 0 then 
 							argtext = repeat(' ', width) 
 							 
 						elsif binout = 1 then 
-							argtext = stdseq:reverse( convert:int_to_bits(arg_list[argn], 32)) + '0' 
+							argtext = stdseq:reverse( convert:int_to_bits(arg_list[argn], MAX_BITS)) + '0' 
 							if zfill != 0 and width > 0 then 
 								if width > length(argtext) then 
 									argtext = repeat('0', width - length(argtext)) & argtext 
@@ -1749,7 +1767,7 @@ 
  
 					elsif atom(arg_list[argn]) then 
 						if istext then 
-							argtext = {and_bits(0xFFFF_FFFF, math:abs(floor(arg_list[argn])))} 
+							argtext = {and_bits(MAX_UCS4, math:abs(floor(arg_list[argn])))} 
 							 
 						else 
 							if hexout then 
@@ -1760,7 +1778,19 @@ 
 									end if 
 								end if 
 							else 
-								argtext = trim(sprintf("%15.15g", arg_list[argn])) 
+								argval = arg_list[argn] 
+								if argval < 0 then 
+								   argval = -argval 
+								end if 
+								if decs < 0 then 
+									fmt = sprintf("%%.%dg", MAX_DIGS) 
+								elsif argval >= power(10, MAX_DIGS) or 
+									  argval < 1e-4 then 
+									fmt = sprintf("%%.%de", decs) 
+								else 
+									fmt = sprintf("%%.%df", decs) 
+								end if 
+								argtext = sprintf(fmt, arg_list[argn]) 
 								-- Remove any leading 0 after e+ 
 								while ep != 0 with entry do 
 									argtext = remove(argtext, ep+2) 
@@ -1770,7 +1800,7 @@ 
 								if zfill != 0 and width > 0 then 
 									if width > length(argtext) then 
 										if argtext[1] = '-' then 
-											argtext = '-' & repeat('0', width - length(argtext)) & argtext[2..$] 
+											argtext = '-' & repeat('0', width - length(argtext) - msign) & argtext[2..$] 
 										else 
 											argtext = repeat('0', width - length(argtext)) & argtext 
 										end if 
@@ -1790,7 +1820,7 @@ 
 											argtext = '(' & argtext[2..$] & ')' 
 										else 
 											if argtext[2] = '0' then 
-												argtext = '(' & argtext[3..$] & ')' 
+												argtext = '(' & argtext[2..$] & ')' 
 											else 
 												argtext = argtext[2..$] & ')' 
 											end if 
@@ -1821,7 +1851,7 @@ 
 								argtext = tempv 
 							elsif integer(tempv) then 
 								if istext then 
-									argtext = {and_bits(0xFFFF_FFFF, math:abs(tempv))} 
+									argtext = {and_bits(MAX_UCS4, math:abs(tempv))} 
 							 
 								elsif bwz != 0 and tempv = 0 then 
 									argtext = repeat(' ', width) 
@@ -1831,20 +1861,23 @@ 
  
 							elsif atom(tempv) then 
 								if istext then 
-									argtext = {and_bits(0xFFFF_FFFF, math:abs(floor(tempv)))} 
+									argtext = {and_bits(MAX_UCS4, math:abs(floor(tempv)))} 
 								elsif bwz != 0 and tempv = 0 then 
 									argtext = repeat(' ', width) 
 								else 
-									argtext = trim(sprintf("%15.15g", tempv)) 
+									fmt = sprintf("%%%d.%dg", {MAX_DIGS, MAX_DIGS}) 
+									argtext = trim(sprintf(fmt, tempv)) 
 								end if 
 							else 
+								fmt = sprintf("%%.%dg", MAX_DIGS) 
 								argtext = pretty:pretty_sprint( tempv, 
-											{2,0,1,1000,"%d","%.15g",32,127,1,0} 
+											{2,0,1,1000,"%d",fmt,32,127,1,0} 
 											) 
 							end if 
 						else 
+							fmt = sprintf("%%.%dg", MAX_DIGS) 
 							argtext = pretty:pretty_sprint( arg_list[argn], 
-										{2,0,1,1000,"%d","%.15g",32,127,1,0} 
+										{2,0,1,1000,"%d",fmt,32,127,1,0} 
 										) 
 						end if 
 						-- Remove any leading 0 after e+ 
 

Thank you everyone for your patience.

new topic     » goto parent     » topic index » view message » categorize

37. Re: text.e bugs?

Can you just send me your finished version of text.e , with all patches already applied?

new topic     » goto parent     » topic index » view message » categorize

38. Re: text.e bugs?

jimcbrown said...

Can you just send me your finished version of text.e , with all patches already applied?

Done.

http://openeuphoria.org/pastey/264.wc

interpreting /home/cargoan/euphoria-LINUX-4.1.0/tests/t_text.e: 
 
  failed: format 'AH', expected: "11111111111111111111111101001111" but got: "1111111111111111111111111111111111111111111111111111111101001111" 
  178 tests run, 177 passed, 1 failed, 99% success 
FAILURE: /home/cargoan/euphoria-LINUX-4.1.0/tests/t_text.e program died with status 1 
 
Test results summary: 
    FAIL: /home/cargoan/euphoria-LINUX-4.1.0/tests/t_text.e 
Files (run: 1) (failed: 1) (0% success) 
 
and this:

puts(1, format("[X,_]", {-2}))  -- prints FFFF_FFFF_FFFF_FFFE 

64 bit integers.

new topic     » goto parent     » topic index » view message » categorize

39. Re: text.e bugs?

cargoan said...
jimcbrown said...

Can you just send me your finished version of text.e , with all patches already applied?

Done.

http://openeuphoria.org/pastey/264.wc

interpreting /home/cargoan/euphoria-LINUX-4.1.0/tests/t_text.e: 
 
  failed: format 'AH', expected: "11111111111111111111111101001111" but got: "1111111111111111111111111111111111111111111111111111111101001111" 
  178 tests run, 177 passed, 1 failed, 99% success 
FAILURE: /home/cargoan/euphoria-LINUX-4.1.0/tests/t_text.e program died with status 1 
 
Test results summary: 
    FAIL: /home/cargoan/euphoria-LINUX-4.1.0/tests/t_text.e 
Files (run: 1) (failed: 1) (0% success) 
 

Hmm. That file is giving me the following failures on 32bit:

  failed: format 'AA', expected: "seq is {1.2,5,\"abcdef\",{3}}" but got: "seq is {1.19999999999999996,5,\"abcdef\",{3}}" 
  failed: format 'AH', expected: "11111111111111111111111101001111" but got: "0" 
  failed: format 'AO', expected: "+00117.2" but got: "00000003" 
  failed: format 'AP', expected: "-00117.2" but got: "00000003" 
  failed: format 'AT', expected: "+117.2" but got: "+117.200000000000003" 
  failed: format 'AU', expected: "-117.2" but got: "-117.200000000000003" 
  failed: format 'AV', expected: "(117.2)" but got: "(117.200000000000003)" 
  failed: format 'AW', expected: "(0117.2)" but got: "0000003)" 
  failed: format 'BA', expected: "117.2" but got: "117.200000000000003" 
  failed: format 'BL', expected: "5.5004)" but got: "000013)" 
  178 tests run, 168 passed, 10 failed, 94% success 

new topic     » goto parent     » topic index » view message » categorize

40. Re: text.e bugs?

I don't know. I have only 64 bits.

If I do this then pass all tests.

--ifdef EU4_1 then 
--    constant MAX_BITS =  64 
--    constant MAX_DIGS =  18 
--    constant MAX_INT  =  0x3FFF_FFFF_FFFF_FFFF 
--    constant MIN_INT  = -0x4000_0000_0000_0000 
--elsedef 
    constant MAX_BITS =  32 
    constant MAX_DIGS =  15 
    constant MAX_INT  =  0x3FFF_FFFF 
    constant MIN_INT  = -0x4000_0000 
--end ifdef 
 
constant MAX_UCS4 =  0xFFFF_FFFF 
constant MAX_IFMT =  0x3FFF_FFFF 
constant MIN_IFMT = -0x4000_0000 
 

[$]: eutest "$EUDIR/tests/t_text.e" 
 
interpreting /home/cargoan/euphoria-LINUX-4.1.0/tests/t_text.e: 
 
Test results summary: 
Files (run: 1) (failed: 0) (100% success) 

new topic     » goto parent     » topic index » view message » categorize

41. Re: text.e bugs?

cargoan said...

I don't know. I have only 64 bits.

If I do this then pass all tests.

--ifdef EU4_1 then 
--    constant MAX_BITS =  64 
--    constant MAX_DIGS =  18 
--    constant MAX_INT  =  0x3FFF_FFFF_FFFF_FFFF 
--    constant MIN_INT  = -0x4000_0000_0000_0000 
--elsedef 
    constant MAX_BITS =  32 
    constant MAX_DIGS =  15 
    constant MAX_INT  =  0x3FFF_FFFF 
    constant MIN_INT  = -0x4000_0000 
--end ifdef 
 
constant MAX_UCS4 =  0xFFFF_FFFF 
constant MAX_IFMT =  0x3FFF_FFFF 
constant MIN_IFMT = -0x4000_0000 
 

[$]: eutest "$EUDIR/tests/t_text.e" 
 
interpreting /home/cargoan/euphoria-LINUX-4.1.0/tests/t_text.e: 
 
Test results summary: 
Files (run: 1) (failed: 0) (100% success) 

I think I figured it out. I've committed a fixed version.

new topic     » goto parent     » topic index » view message » categorize

42. Re: text.e bugs?

Just downloaded and compiled. Only one question remains, should text:format round in the same manner as printf, or is this better left as an option for the programmer?

7 Printf:        1499.46  Fmt A:       1,499.45 Fmt B:       1,499.45  Raw: 1499.459  
8 Printf:        -267.46  Fmt A:       (267.45) Fmt B:        -267.45  Raw: -267.456  
 
new topic     » goto parent     » topic index » view message » categorize

43. Re: text.e bugs?

irv said...

Just downloaded and compiled. Only one question remains, should text:format round in the same manner as printf, or is this better left as an option for the programmer?

7 Printf:        1499.46  Fmt A:       1,499.45 Fmt B:       1,499.45  Raw: 1499.459  
8 Printf:        -267.46  Fmt A:       (267.45) Fmt B:        -267.45  Raw: -267.456  
 

Something like that? (adding 'r' to decs):

[$]:  cat ~/pru2.ex; eui ~/pru2.ex 
 
include std/text.e 
 
puts(1, format("Fmt A: [(,,:12.2] Fmt B: [,,:12.2]  Raw: []\n",   {-267.456,-267.456,-267.456})) 
puts(1, format("Fmt A: [(,,:12.2r] Fmt B: [,,:12.2r]  Raw: []\n", {-267.456,-267.456,-267.456})) 
puts(1, format("Fmt A: [(,,:12.] Fmt B: [,,:12.]  Raw: []\n", {-267.56,-267.56,-267.56})) 
puts(1, format("Fmt A: [(,,:12.] Fmt B: [,,:12.r]  Raw: []\n", {-267.56,-267.56,-267.56})) 
 
puts(1, format("The answer is [.4]\n",  {1.234567e17})) 
puts(1, format("The answer is [.4r]\n", {1.234567e17})) 
puts(1, format("The answer is [.]\n", {1.567234e17})) 
puts(1, format("The answer is [.r]\n", {1.567234e17})) 
 
 
Fmt A:     (267.45) Fmt B:      -267.45  Raw: -267.456 
Fmt A:     (267.46) Fmt B:      -267.46  Raw: -267.456 
Fmt A:        (267) Fmt B:         -267  Raw: -267.56 
Fmt A:        (267) Fmt B:         -268  Raw: -267.56 
The answer is 1.2345e+17 
The answer is 1.2346e+17 
The answer is 1e+17 
The answer is 2e+17 
 

with this patch:

--- text.e	2015-01-26 09:35:20.466148000 +0100 
+++ text.e	2015-01-26 09:22:46.022148000 +0100 
@@ -1412,18 +1412,16 @@ 
 ifdef BITS64 then 
     constant MAX_BITS =  64 
     constant MAX_DIGS =  18 
-    constant MAX_INT  =  0x3FFF_FFFF_FFFF_FFFF 
-    constant MIN_INT  = -0x4000_0000_0000_0000 
 elsedef 
     constant MAX_BITS =  32 
     constant MAX_DIGS =  15 
-    constant MAX_INT  =  0x3FFF_FFFF 
-    constant MIN_INT  = -0x4000_0000 
 end ifdef 
  
 constant MAX_UCS4 =  0xFFFF_FFFF 
 constant MAX_IFMT =  0x3FFF_FFFF 
 constant MIN_IFMT = -0x4000_0000 
+constant MAX_FFMT =  power(10, 15) 
+constant MIN_FFMT =  power(10, -4) 
  
 public function format(sequence format_pattern, object arg_list = {}) 
 	sequence result 
@@ -1456,6 +1454,7 @@ 
 	object envvar 
 	integer ep 
 	integer pflag 
+	integer round 
 	integer count 
 	sequence fmt 
 	atom argval 
@@ -1572,12 +1571,17 @@ 
  
 	    		case '.' then 
 	    			decs = 0 
+	    			round = 0 
 	    			while i < length(format_pattern) do 
 	    				i += 1 
 	    				tch = format_pattern[i] 
 	    				pos = find(tch, "0123456789") 
 	    				if pos = 0 then 
-	    					i -= 1 
+	    					if tch = 'r' then 
+	    						round = MAX_DIGS 
+	    					else 
+	    						i -= 1 
+	    					end if 
 	    					exit 
 	    				end if 
 	    				decs = decs * 10 + pos - 1 
@@ -1783,14 +1787,31 @@ 
 								   argval = -argval 
 								end if 
 								if decs < 0 then 
-									fmt = sprintf("%%.%dg", MAX_DIGS)   -- default '%g' format precision 
-								elsif argval >= power(10, 15) or 
-									  argval < 1e-4 then 
-									fmt = sprintf("%%.%de", decs) 
+									fmt = sprintf("%%.%dg", MAX_DIGS) 
+								elsif argval >= MAX_FFMT or 
+									  argval < MIN_FFMT then 
+									fmt = sprintf("%%.%de", decs + MAX_DIGS - round) 
 								else 
-									fmt = sprintf("%%.%df", decs) 
+									fmt = sprintf("%%.%df", decs + MAX_DIGS - round) 
 								end if 
 								argtext = sprintf(fmt, arg_list[argn]) 
+								pos = find('e', argtext) 
+								if pos = 0 then 
+									if decs >= 0 then 
+										argtext = argtext[ 1 .. $ - MAX_DIGS + round ] 
+									end if 
+									if argtext[$] = '.' then 
+										argtext = argtext[ 1 .. $ - 1 ] 
+									end if 
+								else 
+									sequence arg1 = argtext[ 1 .. pos - 1 - MAX_DIGS + round ] 
+									if decs >= 0 then 
+										if arg1[$] = '.' then 
+											arg1 = arg1[ 1 .. $ - 1 ] 
+										end if 
+									end if 
+									argtext = arg1 & argtext[ pos .. $ ] 
+								end if 
 								-- Remove any leading 0 after e+ 
 								while ep != 0 with entry do 
 									argtext = remove(argtext, ep+2) 
 
 

new topic     » goto parent     » topic index » view message » categorize

44. Re: text.e bugs?

cargoan said...
irv said...

Just downloaded and compiled. Only one question remains, should text:format round in the same manner as printf, or is this better left as an option for the programmer?

7 Printf:        1499.46  Fmt A:       1,499.45 Fmt B:       1,499.45  Raw: 1499.459  
8 Printf:        -267.46  Fmt A:       (267.45) Fmt B:        -267.45  Raw: -267.456  
 

Something like that? (adding 'r' to decs):

Do we need to take a vote on this new feature, or can someone just roll this into the 4.1 branch?

new topic     » goto parent     » topic index » view message » categorize

45. Re: text.e bugs?

Sorry, I just do not understand all that well. I don't know english.

It was only a proposal to the question raised irv. If who wants to use it, use it.

(patch for rev. c99132075957)

Greets.

new topic     » goto parent     » topic index » view message » categorize

46. Re: text.e bugs?

jimcbrown said...

Do we need to take a vote on this new feature, or can someone just roll this into the 4.1 branch?

I don't even know what this "new feature" is. ELI5?

new topic     » goto parent     » topic index » view message » categorize

47. Re: text.e bugs?

euphoric said...
jimcbrown said...

Do we need to take a vote on this new feature, or can someone just roll this into the 4.1 branch?

I don't even know what this "new feature" is. ELI5?

Adding a new qualifier to the format() routine, 'r', which provides the option to round numbers the same way that printf() does.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu