Author Topic: Is ieee754 fp meant to be a replacement for bcd fp?  (Read 5947 times)

0 Members and 1 Guest are viewing this topic.

Offline emece67

  • Frequent Contributor
  • **
  • !
  • Posts: 614
  • Country: 00
Re: Is ieee754 fp meant to be a replacement for bcd fp?
« Reply #50 on: November 25, 2021, 07:23:01 pm »
.
« Last Edit: August 19, 2022, 04:47:04 pm by emece67 »
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6264
  • Country: fi
    • My home page and email address
Re: Is ieee754 fp meant to be a replacement for bcd fp?
« Reply #51 on: November 25, 2021, 10:00:56 pm »
when using ieee754 fp does the string conversion (algorithm)process produce an approximation in binary for a given decimal string
Like I've attempted to explain above, "With base-2 exponents (as used in Binary32/64/128), the problem is that not all decimal number strings can be represented exactly."
(That should really read "... not all decimal numbers with a fractional part can be ...", though.)

If I answered your question with "Yes", then I'd be contradicting myself, and saying that "no decimal number strings can be represented exactly in binary", which is not true.
If I answered your question with "No", then I'd be contradicting myself, and saying that "all decimal number strings can be represented exactly in binary", which is not true.

You have posed a loaded question.  I have thus far assumed that you did this accidentally, because you did not understand the argument, and have attempted to clarify.  This is what I'd like others to do to me, when I myself accidentally pose a loaded question, and do not realize it myself.  I will always rather eat humble pie and admit being wrong when shown exactly how I'm wrong, and learn from my mistakes, because doing any other thing would be intellectually dishonest, and make me poorer for it.  I will not let my ego hinder my learning, no matter how often I feel I've made a stupid error or made an ass of myself.

However, I do now have a slight suspicion that you are demanding an answer to the loaded question that you designed to allow you to claim validates your incorrect presupposition.  I will not do this, because it is rhetorical sleight-of-hand and misdirection, and I have zero interest in such social games at all.  Sometimes the correct answer is to show how the question as posed is invalid.

Before you construct another loaded question, please take the time to re-read the entire thread from a third person perspective, and take your ego out of it.  Read it as if it were completely unknown people to you discussing the issue.  See me as someone with experience in the real-world implementations trying to describe the differences, someone trying to help the asker, and not an antagonist.  Then, when you find the point where your understanding diverges from mine, describe that, and we can continue a mutually beneficial discussion here, without falling into the dirty muck-slinging of social games.

For example, if you have any interest in C programming, I could show you how arbitrary-precision arithmetic on ASCII decimal strings, BCD, Densely-Packed-Decimals, or in binary, are actually implemented.  I've done all of them at one point or another, and don't have a "favourite", because it is just one more tool in my toolbox of useful stuff.
None of them are "the most precise" or yield the most accurate results, because precision and accuracy are simply not related at all to the underlying base/radix.
 

Offline commieTopic starter

  • Frequent Contributor
  • **
  • Posts: 278
  • Country: gb
Re: Is ieee754 fp meant to be a replacement for bcd fp?
« Reply #52 on: November 26, 2021, 03:44:21 pm »
when using ieee754 fp does the string conversion (algorithm)process produce an approximation in binary for a given decimal string
Like I've attempted to explain above, "With base-2 exponents (as used in Binary32/64/128), the problem is that not all decimal number strings can be represented exactly."

...and there are many thousands of decimal numbers which do not give an exact binary fit, what does the ieee754 conversion algorthm do then?, it gives the closest fit or approximation in binary? correct?

(That should really read "... not all decimal numbers with a fractional part can be ...", though.)

..and, for those decimal numbers that do fit exactly are very few indeed, right?


If I answered your question with "Yes", then I'd be contradicting myself, and saying that "no decimal number strings can be represented exactly in binary", which is not true.
If I answered your question with "No", then I'd be contradicting myself, and saying that "all decimal number strings can be represented exactly in binary", which is not true.

Okay, let me make yet more clear for you, when using ieee754 fp does the string conversion (algorithm)process produce an approximation in binary for a given decimal string, in nearly all cases or conversions?, yes or no?
 

Offline commieTopic starter

  • Frequent Contributor
  • **
  • Posts: 278
  • Country: gb
Re: Is ieee754 fp meant to be a replacement for bcd fp?
« Reply #53 on: November 26, 2021, 05:29:56 pm »
Decimal FP can have its uses (which is why it found its way in IEEE754:2008), as long as you know why you're using it and can justify never exceeding the max number of significant digits the decimal format you're going to use allows.

Hey, Siliconwizard, why did ieee754 32/64/128 require modifying into ieee854 if the former was so good? :-//
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6264
  • Country: fi
    • My home page and email address
Re: Is ieee754 fp meant to be a replacement for bcd fp?
« Reply #54 on: November 26, 2021, 06:18:57 pm »
Now I'm getting angry.  This is not a conversation to discover facts, this is some kind of sick social game to twist words, and I don't like it a bit.

Pun intended.

..and, for those decimal numbers that do fit exactly are very few indeed, right?
Did you miss the part where I said that only 8 out of 1000 for three-digit decimal to binary?

The part you keep consciously ignoring because it invalidates your conclusion, is that for the inverse, 10-bit fractional binary to at most three decimal digits, only 8 out of 1024 have exact decimal representations.
There is nothing special about decimal or binary here.  We could be talking about any other base/radix, and my arguments would still be exactly the same: even if someone argued that "binary is more precise than decimal".
You believe that using decimal is more precise than binary.  I am not saying that binary is more precise than decimal, I am saying that the base/radix – binary or decimal or any other – does not intrinsically affect precision or accuracy at all.

It feels like telling two teens arguing whether black or white racing stripes make a car go faster, that their argument is invalid because the color of racing stripes does not affect the speed of the car at all; and one of them keeps demanding a yes-or-no answer to "does white racing stripes make a car go faster", because they think that a "no" answer means "black racing stripes make a car go faster" and they "win" the argument.  This is stupid, and helps nobody.

You want me to say "yes", because in your mind, it validates your conclusion.  I'm trying to show you it doesn't, because your argument does not lead to the conclusion you have drawn at all.  You would like me to play your game, but the only way to arrive at the mathematically correct conclusions is to avoid answering your loaded question with either of the two options you have provided.

This is damned annoying and makes you look like a pushy teen idiot, commie.  Snap out of it, please.  I've told you I feel kinship, because some of these concepts really threw me in a loop once upon a time, too, and I wish I'd had someone trying to explain these things to me as I am now trying to explain to you.  Otherwise I'd have blocked and ignored you ages ago, because I really, really hate these social games.  So, stop treating me as an opponent or antagonist, will you?

If I answered your question with "Yes", then I'd be contradicting myself, and saying that "no decimal number strings can be represented exactly in binary", which is not true.
If I answered your question with "No", then I'd be contradicting myself, and saying that "all decimal number strings can be represented exactly in binary", which is not true.
Okay, let me make yet more clear for you, when using ieee754 fp does the string conversion (algorithm)process produce an approximation in binary for a given decimal string, in nearly all cases or conversions?, yes or no?
How is restating your question more clear?  I've made it crystal clear (pun intended) that I refuse to play the social verbal game you have constructed.

You didn't even know about this detail at all, before I pointed it out to you in my post you already quoted.  Now you insist I must assert "yes or no" to a statement I myself told you.

Why do you insist on getting that assertion?  My understanding is that you are using this discussion as a sort of a game, and believe that if you get me to re-confirm a statement I've already made, it somehow proves your incorrect conclusion, and you "win", somehow.

I refuse to play.  Moreover, I am not writing here to you only.  I know that these threads are easily discovered by searching for related terms on the web, so many people who are pondering the related terms, will discover this thread.  Most of what I write here is directed to them, because helping a single person is much less rewarding than helping many people.  I am not playing your social word games, I am trying to write posts to help everybody reading this thread, now or afterwards, you included, to the best of my ability.
 
The following users thanked this post: Siwastaja

Offline commieTopic starter

  • Frequent Contributor
  • **
  • Posts: 278
  • Country: gb
Re: Is ieee754 fp meant to be a replacement for bcd fp?
« Reply #55 on: November 26, 2021, 07:13:22 pm »
You didn't even know about this detail at all, before I pointed it out to you in my post you already quoted.  Now you insist I must assert "yes or no" to a statement I myself told you.

Yes,I did/do know the detail of ieee754 fp and alot more besides, before engaging in tireless wasteful discussions with you. As I have stated elsewhere, Ieee754 utilizes a conversion, in which case the great Mathematician Karl Gauss, stated every conversion generates errors. Now, bcd fp on the other hand does not use a conversion algorithm and it therefore retains accuracy when  moving fp numbers in/out,i.e. keyboard/memory/display, whereby ieee745 fp is a joke.


   
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6264
  • Country: fi
    • My home page and email address
Re: Is ieee754 fp meant to be a replacement for bcd fp?
« Reply #56 on: November 26, 2021, 09:35:25 pm »
As I have stated elsewhere, Ieee754 utilizes a conversion
No, neither IEEE 754-1985, IEEE 754-2008, nor (current) IEEE 754-2019 specify any "conversions" at all.

The standard only defines
  • Binary32, Binary64, Binary128 binary interchange formats
  • Decimal32, Decimal64, and Decimal128 interchange formats
  • Arithmetic formats (representable real and complex numbers, infinities, and NaNs) using the above interchange formats
  • Rounding rules
  • Operations (arithmetic operations like addition, subtraction, multiplication, division, but also functions like square root, powers, trigonometric functions, and so on)
  • Exception handling (especially divide by zero handling)
IEEE 754 does not specify how numbers are converted.  Really, all it says about the subject, is that however it is done, it should be done with less than half an unit in the least significant place of error, with exact half rounded according to the rounding rules.

Now, bcd fp on the other hand does not use a conversion algorithm and it therefore retains accuracy when  moving fp numbers in/out,i.e. keyboard/memory/display
You most certainly need to do a conversion to BCD, if the display and/or keyboard uses binary, octal, duodecimal, or hexadecimal, and not decimal.

Some of such systems currently still in use involve astronomy (where angles are in degrees, minutes, and seconds, instead of decimal degrees) and time (when time is not in decimal seconds, but as seconds, minutes, hours, days, months, and years).  Decimal is prevalent, but by no means the only one currently in use.

(In computer programs, the binary format of floating-point numbers, "a" and "A" conversions in C since C99, are used to provide exact floating point numbers in a binary basis (hexadecimal, i.e. four-bit digits, in base-16) when the exact decimal form would be excessively long – up to 768 decimal digits –, and the value should be conveyed in text form with maximum precision available.  In most cases, the hexadecimal format is transparently supported by the C library, so that wherever a decimal real number can be input, a hexadecimal floating-point format is also acceptable.  In particular, strtod()/strtof()/strtold() will do this for you, and is the recommended way to parse floating-point inputs from strings in standard, hosted environments, in C.
If you use Bash or a related shell, you can use printf '%a\n' number to convert number to the hexadecimal form, and printf '%.768g\n' number to convert to decimal form with maximum precision, with number being either decimal or hexadecimal real number.)

whereby ieee745 fp is a joke
IEEE 754 is no joke, proven by how it is supported by almost all computing environments, and there are basically no competitors for it.

(Integer arithmetic and fixed point arithmetic as used in e.g. digital signal processing is not a competitor, since they boil down to just basic integer arithmetic, and IEEE 754 has basically nothing to do with integer arithmetic.)

IEEE 754 is commonly used even by calculators that use decimal base either use IEEE 754 Decimal types; the rest use very closely related representations (DPD, in particular), and basically just cherry-pick features from IEEE 754 instead of implementing it completely.



I don't think I have anything useful to further this thread, so I will bow out in defeat here.  I failed to help.  :'(

If anyone else happens to read through this thread, and has questions about IEEE 754 BinaryN/DecimalN or BDC/DPD/binary arbitrary-precision arithmetic, and especially implementing them and their relative upsides and downsides, I'd recommend starting a new thread in the Programming sub-forum here.  There are many members here with plenty of embedded programming experience, and the discussions can range from beginner to expert level.  As for myself, I'm most interested in the implementation side of things, as shown in my Constructing short C strings in limited or constrained situations, which we could expand into say calculators with decimal inputs and outputs, if anyone is working on that kind of stuff.

If you do start a thread there, but find my style of posts annoying/aggravating/waste of time (see e.g. Mind over bugs: C pointer edition thread for examples), just drop me a friendly private message or email with a link to the thread, with a note "Would you mind not participating in this thread?", and I will stay away.

In general, you can block me completely here so you don't need to read my posts at all, by opening your own Profile (near the top of each page), then Modify Profile, and in the pop-up lists, Buddies/Ignore lists... and Edit Ignore List.  I add members to it if I feel I cannot respond in a mutually beneficial manner because of emotions or whatever, and about once a month or two, review the list whether that is still the case, and if not, clear the list.  It, too, is just a tool, and not some sort of social game.

Disgruntled people have already added my email address to various spam lists, so there's not much point in doing that to spite me.  I've got pretty good filters for that, having had an email address since 1994.
« Last Edit: November 26, 2021, 09:39:05 pm by Nominal Animal »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf