U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ SQL » Huge error of Postgresql! Double fields by transmission to the program lose a fractional part!
Re: Huge error of Postgresql! Double fields by transmission to the program lose a fractional part! [message #47544 is a reply to message #47541] Thu, 26 January 2017 14:10 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
sergeynikitin wrote on Thu, 26 January 2017 02:23
I test timings:

Test code:
#include <Core/Core.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
	double a;
	String s = "269.96336996337";
	#define LOOPS 1000000
	for(int i = 0; i < LOOPS; i++){
		RTIMING("Using atof");
		a = atof(s);
	}
	for(int i = 0; i < LOOPS; i++){
		RTIMING("Using ScanDouble");
		a = ScanDouble(s);
	}
}


TIMING results:
TIMING Using ScanDouble:  1.12 s  -  1.12 us ( 1.22 s  / 1000000 ), min:  0.00 ns, max:  1.00 ms, nesting: 1 - 1000000
TIMING Using atof     : 337.45 ms - 337.45 ns (439.00 ms / 1000000 ), min:  0.00 ns, max:  1.00 ms, nesting: 1 - 1000000

It's not dramatically slower! But standard settings (on various environments) show right results!




BTW, have you tried in Release? MSC14 32-bit release I am getting:

TIMING Using ScanDouble: 120.72 ms - 120.72 ns (148.00 ms / 1000000 ), min:  0.00 ns, max:  2.00 ms, nesting: 1 - 1000000
TIMING Using atof     : 281.72 ms - 281.72 ns (309.00 ms / 1000000 ), min:  0.00 ns, max:  1.00 ms, nesting: 1 - 1000000


I really would not like U++ being slower... Smile
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: I propose to Add Postgresql to topic header
Next Topic: How can .sch express a many-to-many relationship ?
Goto Forum:
  


Current Time: Sun Sep 27 04:38:15 GMT+2 2026

Total time taken to generate the page: 0.02209 seconds