![]() |
Forum Index : Microcontroller and PC projects : A bug report?
Author | Message | ||||
Malibu Senior Member ![]() Joined: 07/07/2018 Location: AustraliaPosts: 260 |
G'day everyone ![]() I've been playing around with a few new (new to me, anyway) functions in MM+ and maybe stumbled across a couple of bugs... Here's the whittled down code to make it easier... Option autorun on OPTION EXPLICIT dim Value=pi '<Gives value of 3.141592741, should be 3.141592653 cls GuiSetup page 1 sub GuiSetup gui setup 1 font 4 gui displaybox #1,5,5,310,90,rgb(black),RGB(cyan) gui displaybox #2,5,100,310,90,rgb(black),RGB(cyan) ctrlval(1)=str$(Value),0,5 'A syntax error, but does not flag a fault ctrlval(2)=str$(Value,0,5) 'Works correctly end sub Bug 1) I selected PI as my number because it's a good number that I didn't need to type in... it's already there. I remember PI to 7 decimal places from school days, so this value didn't look correct. I'm pretty sure it's not, but I'm happy to be proved wrong ![]() Bug 2) CtrlVal(1) line was a coding typo on my part, which MM happily ignored when it was running. CtrlVal(2) line is what I was trying to achieve with rounding to 5 decimal places. Should CtrlVal(1) line have flagged a fault during run-time because the closing bracket is in the wrong position (which means what comes after is not valid code), or is it actually a valid bit of coding? (Sorry, I meant to say it's MM Basic Ver 5.04.10) John |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
It looks like PI is stuck as single precision. MMBasic V5.4.10 should be double precision and in V5.5.1 PI is defined as #define PI_VALUE 3.14159265358979323 I don't know C anywhere well enough to say why it looses precision. > RUN 3.141592653589793 3.141592741012573 > I don't know graphics programming well enough to comment on the other problem. Jim VK7JH MMedit |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |