| View previous topic :: View next topic |
| Author |
Message |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Nov 23, 2002 11:21 pm Post subject: Error 25... |
|
|
Hi all,
I was just making a boring program to valide 'postbank' numbers, when I hit a real strange error. It says that the number is Non-numeric... Can't find the mistake, so I think it is be a bug...
| Code: | %%pasnummer = 523456789
%z = 1
repeat
%%number = @prod(@substr(%%pasnummer,%z,%z),%z)
%%test = @fadd(%%number,%%test)
%z = @succ(%z)
until @equal(%z,9) |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Nov 23, 2002 11:45 pm Post subject: |
|
|
Try replacing the @prod() with the floating point equivalent instead. which
is what, @fdiv()?.
-Garrett |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Nov 23, 2002 11:48 pm Post subject: |
|
|
No bug...
You forgot to init %%test with a value.
I'm moving this to the General Help Section,
we should post suspected bugs there first...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sun Nov 24, 2002 12:15 pm Post subject: |
|
|
Not really, but you can use empty vars if you're
not using floating point math functions...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Sun Nov 24, 2002 5:08 pm Post subject: |
|
|
If using loops, it is a good practice with any programming language to initialize all
variables which will be used in the loop. |
|
| Back to top |
|
 |
Tsunami1988 Contributor


Joined: 15 Aug 2002 Posts: 70 Location: The Netherlands
|
Posted: Sat Nov 30, 2002 6:40 pm Post subject: |
|
|
| skit3000 wrote: | Hi Mac,
If you are doing maths, and you have a sum like this:
X =
Y = X + 1
Then the answer is 1. But why does VDS need a X = 0? That a little strange, isn't it? |
this is because sets X to null, not 0. |
|
| Back to top |
|
 |
DoT_PiTcH Contributor

Joined: 07 Aug 2002 Posts: 85
|
Posted: Sun Dec 01, 2002 2:26 am Post subject: |
|
|
not nessisarily
X =
could mean x = anything
like in pascal, there is no standard....
i believe VDS is this way to considering it was writing in delphi(OO pascal) |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Sun Dec 01, 2002 3:38 am Post subject: |
|
|
| Not necessarily, in Delphi variables are defined by types (strings, integers, etc) in VDS they are all strings even if they contain only numbers it's still evaluated as a string. |
|
| Back to top |
|
 |
Tsunami1988 Contributor


Joined: 15 Aug 2002 Posts: 70 Location: The Netherlands
|
Posted: Sun Dec 01, 2002 10:22 am Post subject: |
|
|
| DoT_PiTcH wrote: | not nessisarily
X =
could mean x = anything
like in pascal, there is no standard....
i believe VDS is this way to considering it was writing in delphi(OO pascal) |
it could be, but I believe that sets X to null. |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sun Dec 01, 2002 2:28 pm Post subject: |
|
|
Try this script:
| Code: | %X =
if @equal(%X,0)
warn "%X = 0"
end
if @null(%X)
warn "%X is null"
end
exit |
_________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Tsunami1988 Contributor


Joined: 15 Aug 2002 Posts: 70 Location: The Netherlands
|
Posted: Sun Dec 01, 2002 2:38 pm Post subject: |
|
|
| FreezingFire wrote: | Try this script:
| Code: | %X =
if @equal(%X,0)
warn "%X = 0"
end
if @null(%X)
warn "%X is null"
end
exit |
|
I told you it was null  |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sun Dec 01, 2002 5:03 pm Post subject: |
|
|
Actually all,
VDS does not allocate an empty variable and this can be proven with a simple VDS script.
Consider the following code.
| Code: |
%Y = 2
%X =
%Z = @Prod(%Y,%X)
Info Z = %Z@Cr()Y = %Y@Cr()X = %X
Rem Now lets inspect each variable
Info The Length of Z = @Len(%Z)@CR()ASCII value of Z = @ASC(%Z)
Info The Length of Y = @Len(%Y)@CR()ASCII value of Y = @ASC(%Y)
Rem The next line should give you an error after the Info box is shown
Info The Length of X = @Len(%X)@CR()ASCII value of X = @ASC(%X)
|
Not that this is a bug in VDS but rather this: A VDS floating point function has to make sure that the values passed to it is numeric becuase of the decimal point or comma. I am no Math expert but is this not true Value times Nothing is still nothing right, Value plus Nothing is Value, Value minus Nothing is Value? Now if you tried Value divided by Nothing you will get a VDS error 26 "Arithmetic error" and that is because you cannot divide by nothing....So in the case of division this is an underflow error but not a divide by zero error eventhough VDS treats both with the same error number.
And there you have the rest of the story  _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Sun Dec 01, 2002 5:22 pm Post subject: |
|
|
| I think in math you use 0 as the equivalent to 'nothing', in vds if you use a blank variable x = " " that simply is not the same as using 0. |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sun Dec 01, 2002 5:27 pm Post subject: |
|
|
%A = "" is the same thing as %A =
You can see the length of that, zero indicating a length of zero characters, meaning "null". Here's a quote taken from dictionary.com:
Null is defined as "Zero; nothing," so in this case, the length of the var without data is returned "zero".
| Code: | %A = " "
%B = ""
%C =
%A = @len(%A)
%B = @len(%B)
%c = @len(%c)
info %a;%b;%c |
_________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
|