[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2009-12-11T01:33:49-05:00 http://www.petesqbsite.com/phpBB3/app.php/feed/topic/3182 2009-12-11T01:33:49-05:00 2009-12-11T01:33:49-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20201#p20201 <![CDATA[VAL function problem]]>
sum$ = LTRIM$(STR$(TOTAL#))

'Use INSTR to find the decimal point place:

position% = INSTR(sum$, ".") + 2 ' for 2 decimal places

result$ = MID$(sum$, 1, position%)

PRINT result$

Statistics: Posted by burger2227 — Fri Dec 11, 2009 1:33 am


]]>
2009-12-11T00:27:14-05:00 2009-12-11T00:27:14-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20200#p20200 <![CDATA[VAL function problem]]> You are correct. I changed my code and it corrected my VAL issue. But that brought about another problem, when I do the
TOTAL# = TOTAL# + value ---- it returns TOTAL as a Double value, but brings me right back to my original problem that I had. 9889.89 turns into 9889.8896484375 for some reason...

My total will be in the millions with a decimal, do I need to define it as a Double?

Crap.. this can't be this hard!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
All I want to add is add large numbers together....

Statistics: Posted by mrjaybov — Fri Dec 11, 2009 12:27 am


]]>
2009-12-11T00:07:09-05:00 2009-12-11T00:07:09-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20199#p20199 <![CDATA[I see what happened...]]>
num$ = "9889.98"

value = VAL(num$) ' Single value is accurate

TOTAL# = TOTAL# + value ' returns TOTAL as a Double value

PRINT value, TOTAL#

Certain values, not all, will do that. If you are adding a lot of values, you can convert the results back to a string to get rid of the extra decimal places.

Or you can display the trimmed results with:

PRINT USING " #############,.##"; TOTAL#

PRINT USING will also round the decimal places, but that is just for show. The actual value does not change.

Statistics: Posted by burger2227 — Fri Dec 11, 2009 12:07 am


]]>
2009-12-10T22:56:46-05:00 2009-12-10T22:56:46-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20198#p20198 <![CDATA[VAL function problem]]> Statistics: Posted by Mentat — Thu Dec 10, 2009 10:56 pm


]]>
2009-12-10T22:15:58-05:00 2009-12-10T22:15:58-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20197#p20197 <![CDATA[VAL function problem]]> Statistics: Posted by mrjaybov — Thu Dec 10, 2009 10:15 pm


]]>
2009-12-10T19:05:13-05:00 2009-12-10T19:05:13-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20196#p20196 <![CDATA[VAL function problem]]>
Are you using variables like: value = VAL(number$) ?

Undefined numerical variables default as Single, but it seems like a Double problem.

Statistics: Posted by burger2227 — Thu Dec 10, 2009 7:05 pm


]]>
2009-12-10T17:20:52-05:00 2009-12-10T17:20:52-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20195#p20195 <![CDATA[VAL function problem]]> Statistics: Posted by mrjaybov — Thu Dec 10, 2009 5:20 pm


]]>