You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

vpr

Beginner

  • "vpr" is male
  • "vpr" started this thread

Posts: 30

Date of registration: May 21st 2014

  • Send private message

1

Saturday, December 24th 2016, 2:53am

Single Array Returning Double

Can anyone explain why I get a double when I pass the TypeName function a value from a single array? This code produces:


java.lang.Double
java.lang.Float


Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
Dim x(0) As Single
Dim y As Single

Public Sub Form_Load()

x(0)=0

Debug.Print(TypeName(x(0)))
Debug.Print(TypeName(y))
   
End Sub

This post has been edited 1 times, last edit by "vpr" (Dec 24th 2016, 2:58am)


Dani

Intermediate

Posts: 325

Date of registration: Nov 19th 2009

Location: GERMANY

  • Send private message

2

Monday, December 26th 2016, 7:15pm

Hey there,
I don't know if it is intentionally meant or a mistake, but I found this in the VBA tree of the framework:
svn\Framework\src\VBA\VBArray.java

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
...
	public static VBArraySingle createVBArray(float[] val) throws Exception {
		return (new VBArray(val));
	}
...
        public VBArray(float[] val) throws Exception {
		setBound(0, val.length-1, false);
		for (int i = 0; i <= val.length-1; i++)	setValueDbl(i, val[i]);
	}
...
	public void setValueDbl(int Index, double Value) throws Exception {
		setValue (Index, new Double(Value));
	}
...


So we got a float being passed to setValueDbl(...) !!

Dani

vpr

Beginner

  • "vpr" is male
  • "vpr" started this thread

Posts: 30

Date of registration: May 21st 2014

  • Send private message

3

Monday, December 26th 2016, 9:06pm

Hey, yeah I noticed the same thing. I wonder if Manuel could shed some light on this.

Rate this thread
WoltLab Burning Board