Quantcast
Channel:
Viewing all articles
Browse latest Browse all 43849

Wiki Page: When dividing 1 by 2, SilkTest returns 0 instead of 0.5, how can this be rectified?

$
0
0
Running the following command in SilkTest will result in an incorrect answer print(1/2) SilkTest will return 0 instead of 0.5. This is because SilkTest in this instance is defaulted to INTEGER and not REAL. In order for SilkTest to return the correct value of 0.5, one of the values given must be of type REAL. Editing the code as below will result in the correct answer being returned by SilkTest. print(1.0/2) Or alternatively the returned/printed value can be cast explicitly to type REAL by using [real] immediately preceding the value. print([real]1/2)

Viewing all articles
Browse latest Browse all 43849

Trending Articles