Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Should I fly to the moon using the cmm2 as flight computer?
Page 2 of 3 | |||||
Author | Message | ||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6792 |
I hope they wouldn't be using the Apollo Guidance system for anything important now. It wasn't all that much more powerful than, say, a 16-bit version of a TRS-80 with core store ROM for program storage. Things have moved on a bit. They could probably replace it with the much more capable Pico. :) The technology wasn't lost so much as abandoned. Edited 2024-01-01 19:27 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
andreas Senior Member Joined: 07/12/2020 Location: GermanyPosts: 207 |
The real "Guidance system for Apollo" was Katherine Johnson , who died 2020. She calculated everything by hand. -andreas |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6792 |
Yep - the electronic box was basically a pre-programmed calculator. It had several programs in its ROM. Have a play with a guidance computer. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1241 |
BCD Library Wikipedia(.de): Remember: This is a Computer EDIT: Opps, Andreas was faster ... Regards Michael Edited 2024-01-01 23:41 by twofingers causality ≠ correlation ≠ coincidence |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3802 |
1. I don't see how that explains the particularly odd result i.e. the one with explicit 19 2. using floating point for counting integers (below a quite big threshold) normally is exact (*) and the results for the loop suggest that's the case (*) and always is for IEEE I believe 3. using Geoff's old MMBasic for Linux gives the same results for both loop and explicit expression 4. MMB4L doesn't give the same results Did something change (to explain the oddity) between the rather old Linux version (MMBasic Version 4.4.07e) and the newer ones? John Edited 2024-01-02 01:15 by JohnS |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
Early versions of MMBasic were 32 bit floating point only - no integers. Without knowing if your example gives results consistent with floating point or integers, I assume that it is floating point. That did make life easier in some respects. I think integers appeared in V4.6 or thereabouts. Jim VK7JH MMedit MMBasic Help |
||||
zeitfest Guru Joined: 31/07/2019 Location: AustraliaPosts: 482 |
My impression was, 32bit floating point would only handle numbers as definite integers up to 16 million or so, and the Maximite basic had another bit issue which reduced it further to a max integer magnitude of a little over 8 million. I guess odd-value integers over that magnitude were treated as even numbers (?). |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
From the V4.5 manual VK7JH MMedit MMBasic Help |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3802 |
All of that may well be the case but as far as I can see fails to explain what I have raised. I certainly can't see the relevance (or accuracy) of Peter's message about 3.0. As an aside, cos(pi/2) isn't zero using floating point because pi isn't quite the exact value of the mathematical concept of pi, thus pi/2 is a way off the exact value in maths and cos(pi/2) also not quite the mathematical value. Let's call it epsilon (a small value). Then epsilon gets multiplied by 10 to a power, such as 19. It should be the same whether 19 is explicit or comes from a loop counter (unless the loop counter can't store 19 exactly but it should manage that!). Looks & smells like a bug. It's a bug that probably doesn't matter when calculating based on cos(pi/2) but if it's a bug it'll bite elsewhere most probably. John Edited 2024-01-02 08:12 by JohnS |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
print 10^19 print 10^19.0 first line is treated as INTEGER and overflows giving odd result. second line is treated as a float. (Tested on MMB4W and other platforms may be different) Sometimes Integers are best, sometimes floats are best. The only "bug" is, MMBasic has little overflow protection and it is up to the programmer to do the tests. Jim VK7JH MMedit MMBasic Help |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
> print 10^19 :print 10^19.0 -8446744073709551616 1e+19 PicoMiteVGA MMBasic Version 5.08.08b2 |
||||
vegipete Guru Joined: 29/01/2013 Location: CanadaPosts: 1109 |
Open Windows Calculator and set it Programmer mode. Ensure decimal mode and type 1 followed by 18 zeros. (More than 18 zeros won't fit.) Now multiply by 10. The same result, -8,446,744,073,709,551,616 appears. Visit Vegipete's *Mite Library for cool programs. |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3802 |
Yes. That's what has changed. MMBasic used to behave like Microsoft's Basic (and many others) but no longer does. It's now more like C... edit: probably a good idea to change the manuals to remove or qualify the statement "MMBasic is a Microsoft BASIC compatible implementation ..." John Edited 2024-01-02 18:25 by JohnS |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6792 |
"MMBasic is a Microsoft BASIC compatible implementation ..." Was never 100% true as Microsoft BASIC would never run on a PIC chip. It's close enough for most purposes though. :) When you are pushing numbers into the highest bit things will always get messed up. Programmers shouldn't do that as the poor computer doesn't know what you intended (unless you are able to define, say, an unsigned integer to throw an overflow message). Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3802 |
Obviously it wasn't 100% true but at least the arithmetic behaved essentially the same - and no longer does so. I'm not sure the best way to warn users but somewhere it maybe needs to be emphasised that a seemingly innocent expression now has this behaviour and you won't be warned that overflow has occurred. This is explicit in C by design (and most C programs barely use floating point if at all). It isn't how Microsoft BASIC behaves or would be expected to behave AFAIK. Probably also not allowed by ANSI, ISO et al but I don't have a copy of such standards. (Will go look if I can.) John |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6792 |
It's hardly surprising though. MMBasic is written in C AFAIK and will probably be using C libraries for the maths. The old BASIC interpreters were written in assembler. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3802 |
No, it's not that. It was C all along. It used to work like Microsoft & other BASICs (and was C then as now). The expression evaluator must have changed in some way to favour integer rather than floating point. (Maybe when 64-bit integers were added?) John |
||||
EDNEDN Senior Member Joined: 18/02/2023 Location: United StatesPosts: 118 |
The biggest incompatibility with Microsoft BASIC for me is the structure of the IF / THEN statements when going to a different program location. Microsoft BASIC would allow: IF <some condition> THEN 1234 IF <some condition> THEN GOTO 1234 IF <some condition> GOTO 1234 And the first two forms were allowed on the ELSE part of the IF. This would not be at all difficult to get in compliance with Microsoft BASIC if it bothered enough people. But surprisingly, I haven't heard anybody mention it. Edited 2024-01-03 01:06 by EDNEDN |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6792 |
GOTO isn't guaranteed to be supported in future versions of MMBasic. MMBasic doesn't use "true" line numbers either - IIRC you can't jump to them unless you make them labels. You can use them but they are merely ignored. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9118 |
MMbasic fully supports goto and gosub to line numbers including the syntax variants posted above - just tested Edited 2024-01-03 02:45 by matherp |
||||
Page 2 of 3 |
Print this page |