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 : Maths precedence error in MMBasic? Any maths gurus out there?
Page 3 of 3 | |||||
Author | Message | ||||
zeitfest Guru Joined: 31/07/2019 Location: AustraliaPosts: 482 |
+1 I agree, although there are "thousands built" and it might be expected that at least the initial testing would find it. Then again, It's not as if NASA is using this stuff. |
||||
NPHighview Senior Member Joined: 02/09/2020 Location: United StatesPosts: 200 |
Jim - I love that you're quoting "Numerical Recipes in C", one of my favorites. I have a couple of others that you might like: "Numerical Methods that Usually Work" - Acton (see cover photo - a hoot!) "Math Toolkit for Realtime Programming" - Crenshaw ...and my favorite, "Mathematical Methods in the Physical Sciences" by Mary Boas (I've worked pretty much every problem in that book, under Boas' stern tutelage) Live in the Future. It's Just Starting Now! |
||||
darthvader Regular Member Joined: 31/01/2020 Location: FrancePosts: 76 |
HP Prime G2 give me : 3.00012207031 Theory is when we know everything but nothing work ... Practice is when everything work but no one know why ;) |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
Hi Volhout, I have consulted my old GW-Basic 3.2 reference manual in printed form (unfortunately in German) :-) It actually gives some information about this – everything used to be better™! But see for yourself. It says something about the function hierarchy and the order from left to right, unless brackets are used first. Matthias |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1241 |
Thanks Matthias! The English version is not quite as clear. But leads to the same result. Two consecutive operators must be separated by parentheses. This means that if you follow the instructions you will get correct results. EDIT Translation: Edited 2024-05-13 11:30 by twofingers causality ≠ correlation ≠ coincidence |
||||
zeitfest Guru Joined: 31/07/2019 Location: AustraliaPosts: 482 |
Integer math gives the answer as 3 How is the negation operator processed in MMBasic ? (ed) To be fair, it is a reasonable thing for Basic to test for repeated exponentiation, and flag it so as to enforce bracketing. Edited 2024-05-13 12:14 by zeitfest |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6783 |
Ah, so the answer is INT(PI). Is that a coincidence? :) Nothing wrong with integers. I always use them when counting on my fingers and toes. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4223 |
Hi Mick, Unfortunately I cannot use integers for fingers. 9.5 is my count. But toes are still integers... Volhout Edited 2024-05-13 19:59 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Page 3 of 3 |
Print this page |