BBC BASIC for Windows
« Rounding numbers »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:56pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 hotthread  Author  Topic: Rounding numbers  (Read 2268 times)
Edja
Developer

member is offline

Avatar




PM


Posts: 60
xx Re: Rounding numbers
« Reply #15 on: Apr 11th, 2015, 12:36pm »

Quote:
I certainly don't think the functions offered by Edja and DDRM have any place here at all. Their contributions were well-meaning but have sent you in the wrong direction.
True. Your further questions "unfolded" an objective that was clearly different.
Eddy
User IP Logged

rtr2
Guest
xx Re: Rounding numbers
« Reply #16 on: Apr 11th, 2015, 1:08pm »

on Apr 11th, 2015, 12:36pm, Edja wrote:
Your further questions "unfolded" an objective that was clearly different.

The OP was no doubt trying to be helpful by distilling his problem down to what he thought were the basics. I encourage that, but there is a danger - as happened here - that the true objective will not be conveyed accurately.

Part of the problem is that the underlying issues are mathematical rather than specifically to do with programming. It's fundamental that 'rounding to two decimal places' has no well-defined meaning when applied to a number represented in binary floating-point. Indeed the concept of 'decimal places' only really applies to decimal numbers!

That is precisely why the built-in rounding functionality in BBC BASIC (in STR$ or in FNusing, which uses STR$ to do the work) happens only when converting a binary number to a decimal number.

Richard.
User IP Logged

Pages: 1 2  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls