Gamestudio Links
Zorro Links
Newest Posts
Instrument Price Zorro Chart
by felixfx. 10/19/19 20:48
Today real live account blown - my experience
by Clifford_B. 10/19/19 17:09
Building Diversified Portfolios - New Paper
by SnoopySniff. 10/18/19 16:23
Indices & metals easier to trade than FX???
by SnoopySniff. 10/18/19 10:08
What are you working on?
by txesmi. 10/17/19 07:00
Ducascopy exporter
by line7. 10/17/19 06:21
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
5 registered members (AndrewAMD, felixfx, Dalla, painkiller, ugofx), 658 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
VillageTalkies, line7, Shutch, Clifford_B, Paulius
18310 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 4 1 2 3 4
file_write var array ? #477896
08/12/19 19:00
08/12/19 19:00
Joined: Jan 2019
Posts: 71
berlin
L
laz Offline OP
Junior Member
laz  Offline OP
Junior Member
L

Joined: Jan 2019
Posts: 71
berlin
I need to use an array to store some data and save them to file.

But i normally not use all slots, sometimes maybe 3, 50 or 77, max 100...

How do i save the needed amount (3 in this example) of var values to file?
Code
function run() {
	
	string my_file = "Data\\FAA_TEST.csv";
	
        int  ar_used = 3;
	var my_array[100];	
	
	my_array[0] = 1000.0001;
	my_array[1] = 2000.0002;
	my_array[2] = 3000.0003;	
	
	file_delete(my_file);	
	file_write(my_file,my_array,ar_used*8);
		
	var my_read[100];
	
	file_read(my_file,my_read,10*8);
	
	int i;

	for(i=0;i<10;i++) printf("\nmy_array[%i] %f | my_read[%i] %f",i,my_array[i],i,my_read[i]);
	
	quit();
	
}
Is it correct this way or are there better ways?
Quote
my_array[0] 1000.000122 | my_read[0] 1000.000122
my_array[1] 2000.000244 | my_read[1] 2000.000244
my_array[2] 3000.000244 | my_read[2] 3000.000244
Later i want to read them, why does this 1000.0001>22< happen?

Thanks!

Last edited by laz; 08/12/19 21:30.
Re: file_write var array ? [Re: laz] #477899
08/12/19 21:43
08/12/19 21:43
Joined: Jan 2019
Posts: 71
berlin
L
laz Offline OP
Junior Member
laz  Offline OP
Junior Member
L

Joined: Jan 2019
Posts: 71
berlin
I think i'll use the data functions for that wink

https://manual.zorro-project.com/data.htm

But, why does this 1000.0001>22< happen?

Last edited by laz; 08/12/19 21:45.
Re: file_write var array ? [Re: laz] #477907
08/13/19 15:24
08/13/19 15:24
Joined: Jul 2000
Posts: 27,029
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,029
Frankfurt
Because computer math is slightly different than the math at school, due to the finite precision of variables.

https://en.wikipedia.org/wiki/Floating-point_arithmetic

Re: file_write var array ? [Re: laz] #477918
08/14/19 02:34
08/14/19 02:34
Joined: Jan 2019
Posts: 71
berlin
L
laz Offline OP
Junior Member
laz  Offline OP
Junior Member
L

Joined: Jan 2019
Posts: 71
berlin
Autsch... Thanks jcl crazy

Sorry but nobody has teached me computer math. I've taught myself what I know about programming, and sometimes I just miss things.

NEW MINIMAL EXAMPLE
Code
function run() {
		
	int i;
	var my_array[10];
	
	my_array[0] = 1000.0111;
	my_array[1] = 2000.0022;
	my_array[2] = 3000.0003;	
	
	watch("test0 = ",(1000.0111 - my_array[0]) == 0.0);
	watch("test1 = ",(2000.0022 - my_array[1]) == 0.0);
	watch("test2 = ",(3000.0003 - my_array[2]) == 0.0);
	
	for(i=0;i<4;i++) printf("\nmy_array[%i] %f",i,my_array[i]);
	
	quit();
	
}
Quote
file-append-array2 compiling...........
test0 = 1
test1 = 1
test2 = 1
my_array[0] 1000.011108
my_array[1] 2000.002197
my_array[2] 3000.000244
my_array[3] 0.000000
Quit
test0,1,2 are TRUE. I would think, that my printing is wrong - but what is wrong?

If i round 3000.000244 to 4 digits, it is 3000.0002 and not 3000.0003, why the initial zero (0) of my_array[3] stays unchanged and the 3000.0003 changes to 3000.000244?

Even if I ask a simple or stupid question, it would be nice if someone answers ...

Thanks for your help...

Last edited by laz; 08/15/19 14:44.
Re: file_write var array ? [Re: laz] #477945
08/17/19 11:24
08/17/19 11:24
Joined: May 2015
Posts: 163
Czech Republic
Grat Offline
Member
Grat  Offline
Member

Joined: May 2015
Posts: 163
Czech Republic
I make small modification
Code
function main() {
		
	int i;
	//var *my_array=zalloc(4*sizeof(var));
	var my_array[4]={0.0,0.0,0.0,0.0};
  
       for(i=0;i<4;i++) printf("\nmy_array[%i] %.5f",i,my_array[i]);
	
	my_array[0] =(var) 1000.0111000;
	my_array[1] =(var) 2000.0022000;
	my_array[2] =(var) 3000.0003000;	
	
	var n=0;
	for(i=0;i<4;i++){ 
            printf("\nmy_array[%i] %.8f",i,my_array[i]);
            n+=my_array[i];
       }
       printf("\n%f ",n);
       for(i=0;i<4;i++) printf("\nmy_array[%i] %.8g",i,my_array[i]);
	
}


output...

Quote

my_array[1] 0.00000
my_array[2] 0.00000
my_array[3] 0.00000
my_array[0] 1000.01110840
my_array[1] 2000.00219727
my_array[2] 3000.00024414
my_array[3] 0.00000000
6000.013550
my_array[0] 1000.0111
my_array[1] 2000.0022
my_array[2] 3000.0002
my_array[3] 0



So, i thinking something is a wrong.

1000.0111+2000.0022+3000.0002 = 6000.013600

but no 6000.013550


Last edited by Grat; 08/17/19 11:37.
Re: file_write var array ? [Re: laz] #477946
08/17/19 11:34
08/17/19 11:34
Joined: May 2015
Posts: 163
Czech Republic
Grat Offline
Member
Grat  Offline
Member

Joined: May 2015
Posts: 163
Czech Republic
in the python:
Code
my_array = [1000.0111000, 2000.0022000, 3000.0003000]
n=0
for x in my_array:
    print ("{:.9f}".format(x),)
    n+=x
print ("{:.9f}".format(n),)


is output:
1000.011100000
2000.002200000
3000.000300000
6000.013600000

Re: file_write var array ? [Re: laz] #477947
08/17/19 11:47
08/17/19 11:47
Joined: May 2015
Posts: 163
Czech Republic
Grat Offline
Member
Grat  Offline
Member

Joined: May 2015
Posts: 163
Czech Republic
Ok, next test:

Code
function main() {
		
  double d3=100.0003;
  double d2=1.0002;
  printf("\n%f+ %f= %f",d3,d2,d3+d2);

  var v3=100.0003;
  var v2=1.0002;
  printf("\n%f+ %f= %f",v3,v2,v3+v2);

  float f3=100.0003;
  float f2=1.0002;
  printf("\n%f+ %f= %f",f3,f2,f3+f2);
  
}


with output:


test1 compiling................ ok

100.000298+ 1.000200= 101.000498
100.000298+ 1.000200= 101.000498
0.007825+ -2.000000= -26815622246983973000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000

Re: file_write var array ? [Re: laz] #477954
08/19/19 12:33
08/19/19 12:33
Joined: Jan 2019
Posts: 71
berlin
L
laz Offline OP
Junior Member
laz  Offline OP
Junior Member
L

Joined: Jan 2019
Posts: 71
berlin
Thanks grat for testing, there is a small typo in your first post:

Quote
1000.0111+2000.0022+3000.0002 = 6000.013600

1 000.0111 + 2 000.0022 + 3 000.0003 = 6 000.0136

What are we missing jcl?

Last edited by laz; 08/19/19 12:40.
Re: file_write var array ? [Re: laz] #477971
08/20/19 09:03
08/20/19 09:03
Joined: Jul 2000
Posts: 27,029
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,029
Frankfurt
I don't even know what the problem is, let alone what you are missing.

Re: file_write var array ? [Re: laz] #477974
08/20/19 12:54
08/20/19 12:54
Joined: Jan 2019
Posts: 71
berlin
L
laz Offline OP
Junior Member
laz  Offline OP
Junior Member
L

Joined: Jan 2019
Posts: 71
berlin
The question is why Zorro shows changed values:

my_array[0] 1000.01110840
my_array[1] 2000.00219727
my_array[2] 3000.00024414

instead of

my_array[0] = 1000.0111;
my_array[1] = 2000.0022;
my_array[2] = 3000.0003;

Your answer was :

Quote
Because computer math is slightly different than the math at school, due to the finite precision of variables.

https://en.wikipedia.org/wiki/Floating-point_arithmetic


I don't understand that, can you please explain?

Re: file_write var array ? [Re: laz] #477977
08/20/19 13:24
08/20/19 13:24
Joined: Feb 2017
Posts: 772
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 772
Chicago
A var is actually a double. The characteristics of computer mathematics affect how doubles add and subtract. This has nothing to do with Zorro.

Re: file_write var array ? [Re: laz] #477981
08/20/19 17:18
08/20/19 17:18
Joined: Jan 2019
Posts: 71
berlin
L
laz Offline OP
Junior Member
laz  Offline OP
Junior Member
L

Joined: Jan 2019
Posts: 71
berlin
It means (if i understand right) that if i do this:

my_array[2] = 3000.0003;

The internal value of my_array[2] is 3000.00024414 ?

And that is why (3000.0003 (real 3000.00024414) - my_array[2] (real 3000.00024414)) == 0 ?

That helped me a bit:
https://www.youtube.com/watch?v=PZRI1IfStY0
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

I think I got it (in parts), I have to admit that I have some knowledge gaps in this area. I keep reading about it, and while I'm doing this i can see why i never had problems with it. I always set a precision (like in R options(digits = 12)) and round to the accuracy i need, and i normally never do this if (double == double) without rounding.

Code
> R-CODE
options(digits = 12)
> a<-3000.0003
> a
[1] 3000.0003
> options(digits = 15)
> a<-3000.0003
> a
[1] 3000.0003
> options(digits = 16)
> a<-3000.0003
> a
[1] 3000.0003
> options(digits = 17)
> a<-3000.0003
> a
[1] 3000.0003000000002
> options(digits = 18)
> a<-3000.0003
> a
[1] 3000.00030000000015
> options(digits = 20)
> a<-3000.0003
> a
[1] 3000.0003000000001521

Why is R not adding anything until digits >= 17? Or better: Why is the value in C-Lite 3000.00024414 and in R 3000.0003>>00000000<< up to digits = 16?

How can i influence this in C-lite? Because at this point rounding(3000.00024414, to 4 digits) will result in 3000.0002, not 3000.0003 - and in R that works fine?

Many thanks for helping me with that basic stuff!

Last edited by laz; 08/21/19 01:02.
Re: file_write var array ? [Re: laz] #478045
08/29/19 12:27
08/29/19 12:27
Joined: Jan 2019
Posts: 71
berlin
L
laz Offline OP
Junior Member
laz  Offline OP
Junior Member
L

Joined: Jan 2019
Posts: 71
berlin
Guys, I'm really sorry - but I still need help with that crazy...

I read all the links (and much more):

https://en.wikipedia.org/wiki/Floating-point_arithmetic
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
https://opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=467836
https://zorro-project.com/manual/en/aarray.htm
https://zorro-project.com/manual/en/format.htm

Code
var t1 = 0.1;

file_append(tfn,strf("%i,%.14f,%.14f,%.14f\n",Bar,t1,(var)t1,(double)t1),0);

result: 10,0.10000000149012,0.10000000149012,0.10000000149012

https://zorro-project.com/manual/en/aarray.htm
Type double, var | Size (bytes) 8 | Digits ~14

http://www.binaryconvert.com/result_float.html?decimal=048046049 | float(.1) | 0.100000001490116119384765625
http://www.binaryconvert.com/result_double.html?decimal=048046049 | double(.1) | 0.1000000000000000055511151231257827021181583404541015625

Why does file_append/strf write var/double as floats?

Quote
As the printf class of functions are variadic (denoted by the elipsis „…“ in the function signature) the default argument promotions take place. Finally the call printf("float = %f\n", f) will after promotion look like printf("float = %f\n", (double)f) and printf can safely assume that every %f, %g, and %e denotes a parameter of type double. https://blogs.fau.de/wittmann/2013/11/c-default-argument-promotions/

Why does printf print doubles as a float?

"%f Floating-point number (var, double) " https://zorro-project.com/manual/en/format.htm

"The printf function does not automatically promote float to double." https://manual.zorro-project.com/printf.htm

But double to float?
Quote
The %f format specifier for the printf/scanf class of functions denotes a variable of type float which consumes 32 bits. In the example above d is of type double which uses 64 bits and actually requires %lf. The provided argument d (64 bits) would be interpreted as a variable of type float (32 bits). https://blogs.fau.de/wittmann/2013/11/c-default-argument-promotions/

%lf does not exist in clite or does it?

Quote
Rounding errors occur when a number can’t be stored precisely. This can happen even with simple numbers, like 0.1. Therefore, rounding errors can, and do, happen all the time.
A corollary of this rule is: never use floating point numbers for financial or currency data. https://www.learncpp.com/cpp-tutorial/floating-point-numbers

I'm clearly missing something here and i don't get it...

Many thanks!

Last edited by laz; 08/29/19 22:56.
Re: file_write var array ? [Re: laz] #478065
08/31/19 01:33
08/31/19 01:33
Joined: Oct 2018
Posts: 40
J
JamesHH Offline
Newbie
JamesHH  Offline
Newbie
J

Joined: Oct 2018
Posts: 40
Actually, I noticed something very similar the other day: I was working with type var and they only seemed to have float precision instead of double, which is concerning.

I will test some more when I have time.

You can do arithmetic operations instead of printf to test the accuracy. For example, you can subtract close values, like 1.00000001 - 1.0,
and check the result which would be 0 for type float but >0 for type double.

Re: file_write var array ? [Re: laz] #478066
08/31/19 11:42
08/31/19 11:42
Joined: Jan 2019
Posts: 71
berlin
L
laz Offline OP
Junior Member
laz  Offline OP
Junior Member
L

Joined: Jan 2019
Posts: 71
berlin
Thanks for joining james...

Either I have overlooked it or it is nowhere mentioned that data written/printed will be transformed and thereby lose precision. The R-bridge also sends data (double) different from those written by Zorro (float) in text files.I have now read more intensively about the topic and unfortunately there are many pitfalls, I would find it easier and better, if we can determine the precision.

Example:% f for floats% lf or something for doubles

How to print/write data with more precision?

I can't use printf, strf, file functions and so on or is that wrong - or is it possible and I'm just too stupid?

Last edited by laz; 09/03/19 19:47.
Re: file_write var array ? [Re: laz] #478080
09/04/19 05:18
09/04/19 05:18
Joined: Oct 2018
Posts: 40
J
JamesHH Offline
Newbie
JamesHH  Offline
Newbie
J

Joined: Oct 2018
Posts: 40
There seems to be two different possibilities here. 1) The value in memory is double precision, but is being printed as float. This would be strange. printf has been part of C for decades and the format string is standard. I can't remember, but you can look up how to print a specified number of digits after the decimal point. Something like %f.12 or %f12, I can't recall ...

2) The value in memory is only floating point precision.

Have you ruled out 2?

Re: file_write var array ? [Re: laz] #478087
09/05/19 22:19
09/05/19 22:19
Joined: Jan 2019
Posts: 71
berlin
L
laz Offline OP
Junior Member
laz  Offline OP
Junior Member
L

Joined: Jan 2019
Posts: 71
berlin
1) The value in memory is double precision, but is being printed as float.

^^^ I think that's it...

"This would be strange. printf has been part of C for decades and the format string is standard."

That was the reason why i was confused - i did not expect that - apart from my knowledge gaps in floating point arithmetic.

The manual says: "For printing float variables with the %f placeholder, typecast them to (var) or (double) (f.i. printf("Profit: %.2f",(var)TradeProfit);). "

But as you can see in my examples, typecasting to (var) or (double) does not work.

Code
var t1 = 0.1;

file_append("Data/test-write.csv",strf("%i,%.14f,%.14f,%.14f\n",Bar,t1,(var)t1,(double)t1),0);

result: 10,0.10000000149012,0.10000000149012,0.10000000149012

If i printf a (var) I'll expect a (var==double) to be printed, precision depending on the format string like "%.8f"...

Even writing into a csv with double precision is not possible at the moment - or am I wrong?

Maybe jcl can explain it in easy words, what's correct and why it is like it is?

Last edited by laz; 09/05/19 22:39.
Re: file_write var array ? [Re: laz] #478094
09/06/19 16:47
09/06/19 16:47
Joined: Oct 2018
Posts: 40
J
JamesHH Offline
Newbie
JamesHH  Offline
Newbie
J

Joined: Oct 2018
Posts: 40
Originally Posted by laz
1) The value in memory is double precision, but is being printed as float.

^^^ I think that's it...


Well, as far as I can tell you have not confirmed that this is the case.

If t1 in your code snippet was a float, then your output would be exactly as expected.

What happens if you replace

Code
var t1 = 0.1;


with

Code
float t1 = 0.1;
?

Re: file_write var array ? [Re: laz] #478109
09/09/19 09:19
09/09/19 09:19
Joined: Jul 2000
Posts: 27,029
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,029
Frankfurt
The types var and double are identical. They have 64 bit precision, while float has 32 bit precision.

Re: file_write var array ? [Re: jcl] #478133
09/11/19 16:47
09/11/19 16:47
Joined: Oct 2018
Posts: 40
J
JamesHH Offline
Newbie
JamesHH  Offline
Newbie
J

Joined: Oct 2018
Posts: 40
Originally Posted by jcl
The types var and double are identical. They have 64 bit precision, while float has 32 bit precision.


They are identical, but in Zorro scripts double is *not* an IEEE754 Double precision 64-bit. The following script demonstrates a double that is being represented the same as an IEEE754 32-bit float:

function main()
{
double x = 1.00000001;

if(x == 1.0) {
printf("\nx is float");
} else {
printf("\nx is double");
}
}

Can you please clarify what is going on? This is very serious!!

Re: file_write var array ? [Re: laz] #478135
09/11/19 17:19
09/11/19 17:19
Joined: Feb 2017
Posts: 772
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 772
Chicago
<snip>

Last edited by AndrewAMD; 09/11/19 18:02. Reason: misread the output
Re: file_write var array ? [Re: AndrewAMD] #478136
09/11/19 17:39
09/11/19 17:39
Joined: Oct 2018
Posts: 40
J
JamesHH Offline
Newbie
JamesHH  Offline
Newbie
J

Joined: Oct 2018
Posts: 40
Umm, you've just proved my point.

Yes, var is typedef'd as double, but that's not the issue.

Your output shows that, in Zorro, var/double is behaving just like a 32-bit float:

float representation of 0.123456789012345678901234567890

That's called an MRE, not production code. Which branch do you think should execute?

Re: file_write var array ? [Re: laz] #478148
09/13/19 17:26
09/13/19 17:26
Joined: Apr 2008
Posts: 253
Austria
Petra Offline
Member
Petra  Offline
Member

Joined: Apr 2008
Posts: 253
Austria
You can easily see with a tiny script that var behaves like a 64 bit double. But number representation and variable precision are not the same. Variables have 15 decimals, numbers written in your script have probably less.

Re: file_write var array ? [Re: Petra] #478150
09/13/19 20:18
09/13/19 20:18
Joined: Oct 2018
Posts: 40
J
JamesHH Offline
Newbie
JamesHH  Offline
Newbie
J

Joined: Oct 2018
Posts: 40
Originally Posted by Petra
You can easily see with a tiny script that var behaves like a 64 bit double. But number representation and variable precision are not the same. Variables have 15 decimals, numbers written in your script have probably less.


No, my script demonstrates that var/double behaves like a 32-bit precision float.

Did you see the one above where 1.00000001 == 1.0?

Here is another script showing that type "double" is 32-bit precision in Zorro:

function main()
{
double x = 0.123456789012345;

printf("\nx = %.15f", x);
}

Output:

x = 0.123456791043282

The output is the float representation of the number 0.123456789012345: float 32-bit representation of 0.123456789012345

Re: file_write var array ? [Re: laz] #478151
09/13/19 20:25
09/13/19 20:25
Joined: Apr 2008
Posts: 253
Austria
Petra Offline
Member
Petra  Offline
Member

Joined: Apr 2008
Posts: 253
Austria
That script wont work, youre still confusing number representation with precision.

Standard test program for variable precision:

Code
void main()
{
	double d = 1000000000000000.;  // 15 zeros -> 64 bits
	d = 1. + 1./d;
	printf("\n %.15f",d);
}

laugh

Re: file_write var array ? [Re: Petra] #478152
09/13/19 22:49
09/13/19 22:49
Joined: Oct 2018
Posts: 40
J
JamesHH Offline
Newbie
JamesHH  Offline
Newbie
J

Joined: Oct 2018
Posts: 40
Interesting!

So why is x being set to 1.0 in the following script?

Code

function main()
{
	double x = 1.00000001;
	printf("\n %.15f", x);
}


Re: file_write var array ? [Re: Petra] #478153
09/13/19 22:59
09/13/19 22:59
Joined: Oct 2018
Posts: 40
J
JamesHH Offline
Newbie
JamesHH  Offline
Newbie
J

Joined: Oct 2018
Posts: 40
Oh, so you are saying that *constants* do not have the same precision as variables?

Re: file_write var array ? [Re: laz] #478155
09/14/19 08:31
09/14/19 08:31
Joined: Jul 2000
Posts: 27,029
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,029
Frankfurt
Numbers in scripts are interpreted as either int or float, depending on decimal point. This must be kept in mind when assigning very large or very small constants or constant expressions to a variable. You can find details in the manual under "Variables". This has nothing to do with the bit size of a double.

Re: file_write var array ? [Re: laz] #478158
09/15/19 12:17
09/15/19 12:17
Joined: Feb 2017
Posts: 772
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 772
Chicago
As a workaround, you can enter a high-precision variable as a string and then parse it.

Code
#include <default.c>
void main() {
	var v = strvar("0.123456789012345678901234567890",0,0.0);
	printf("\nv: %0.30f",v);
	v *= 10000000000.;
	printf("\nv: %0.30f",v);
	printf("\ndone.");
}
/*  output:
v: 0.123456789012345680000000000000
v: 1234567890.123456700000000000000000000000
done.
*/


Here's the original script, fixed:
Code
#include <default.c>
void run() {
	string my_file = "Data\\FAA_TEST.csv";

	int  ar_used = 3;
	var my_array[100];	

	my_array[0] = strvar("1000.0001",0,0);
	my_array[1] = strvar("2000.0002",0,0);
	my_array[2] = strvar("3000.0003",0,0);

	file_delete(my_file);	
	file_write(my_file,my_array,ar_used*8);
		
	var my_read[100];

	file_read(my_file,my_read,10*8);

	int i;

	for(i=0;i<10;i++) printf("\nmy_array[%i] %f | my_read[%i] %f",i,my_array[i],i,my_read[i]);

	quit();
}
/*  OUTPUT:
	float_test compiling...........
	my_array[0] 1000.000100 | my_read[0] 1000.000100
	my_array[1] 2000.000200 | my_read[1] 2000.000200
	my_array[2] 3000.000300 | my_read[2] 3000.000300
	my_array[3] 0.000000 | my_read[3] 0.000000
	my_array[4] 0.000000 | my_read[4] 0.000000
	my_array[5] 0.000000 | my_read[5] 0.000000
	my_array[6] 0.000000 | my_read[6] 0.000000
	my_array[7] 0.000000 | my_read[7] 0.000000
	my_array[8] 0.000000 | my_read[8] 0.000000
	my_array[9] 0.000000 | my_read[9] 0.000000
	Quit
*/


Or you can write your script in VC++, so you will not need to put up with the eccentricities of the Lite-C compiler. laugh

Re: file_write var array ? [Re: AndrewAMD] #478162
09/16/19 00:32
09/16/19 00:32
Joined: Oct 2018
Posts: 40
J
JamesHH Offline
Newbie
JamesHH  Offline
Newbie
J

Joined: Oct 2018
Posts: 40
Thanks for the suggestions.

Yes, but this requires Zorro-S if I understood the manual. I should have Zorro-S considering how much I use it.

Re: file_write var array ? [Re: laz] #478163
09/16/19 10:18
09/16/19 10:18
Joined: Jul 2000
Posts: 27,029
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,029
Frankfurt
VC++ requires Zorro S, but there is certainly also a solution for your problem with the free version. I only need to understand what you want to do. For what purpose do you have to write 15-digit numbers in your script?

Re: file_write var array ? [Re: jcl] #478164
09/16/19 15:16
09/16/19 15:16
Joined: Oct 2018
Posts: 40
J
JamesHH Offline
Newbie
JamesHH  Offline
Newbie
J

Joined: Oct 2018
Posts: 40
Originally Posted by jcl
VC++ requires Zorro S, but there is certainly also a solution for your problem with the free version. I only need to understand what you want to do. For what purpose do you have to write 15-digit numbers in your script?


I don't tongue My concern was that something was wrong and doubles were only 32-bit, based on my test scripts loading from a constant.

Still, I think the ability to run scripts through the MSVS debugger is enough of a reason to justify upgrading to Zorro S.

Page 1 of 4 1 2 3 4

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1