Talk:Decimal floating point number to binary: Difference between revisions

From Rosetta Code
Content added Content deleted
(what does "decimal floating point" mean?)
 
(→‎What is a "decimal floating point number"?: added comments, added a new section. -- ~~~~)
Line 1: Line 1:
==What is a "decimal floating point number"?==
==What is a "decimal floating point number"?==
I don't understand the task. Most floating-point numbers are in no way "decimal", but rather stored with a binary mantissa and exponent. The example given, 23.34375, is a decimal number, but it is not necessarily a floating-point number, despite the fact that many languages would store it as floating-point (such as C or Perl 5). Other languages will store it as a rational representation with explicit numerator and denominator (Perl 6 does this, unless you explicitly use E notation). Still other languages might choose to store it in a fixed-point representation with an implied denominator. And some languages will simply keep it as an ASCII string (vintage Tcl) or as a BCD string (REXX I think) and do arithmetic on the string. So I suspect this task should either drop the words "floating point" or should make it clear what is supposed to be "floating" here. Thanks. --[[User:TimToady|TimToady]] ([[User talk:TimToady|talk]]) 20:19, 4 February 2014 (UTC)
I don't understand the task. Most floating-point numbers are in no way "decimal", but rather stored with a binary mantissa and exponent. The example given, 23.34375, is a decimal number, but it is not necessarily a floating-point number, despite the fact that many languages would store it as floating-point (such as C or Perl 5). Other languages will store it as a rational representation with explicit numerator and denominator (Perl 6 does this, unless you explicitly use E notation). Still other languages might choose to store it in a fixed-point representation with an implied denominator. And some languages will simply keep it as an ASCII string (vintage Tcl) or as a BCD string (REXX I think) and do arithmetic on the string. So I suspect this task should either drop the words "floating point" or should make it clear what is supposed to be "floating" here. Thanks. --[[User:TimToady|TimToady]] ([[User talk:TimToady|talk]]) 20:19, 4 February 2014 (UTC)

: REXX stores all values (including the aforementioned numbers) as a (character) '''string''', not a BCD. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 22:07, 4 February 2014 (UTC)
: I would hope that   ''decimal floating point number''   wouldn't be re-defined as a decimal floating point number being stored in binary. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 22:07, 4 February 2014 (UTC)

==range of numbers==
No mention was made for the range of numbers (in digits or as characters).
<br>I.E.: &nbsp; how large can/should they be? -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 22:07, 4 February 2014 (UTC)

Also, I would assume that negative numbers would be allowed. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 22:07, 4 February 2014 (UTC)

Revision as of 22:07, 4 February 2014

What is a "decimal floating point number"?

I don't understand the task. Most floating-point numbers are in no way "decimal", but rather stored with a binary mantissa and exponent. The example given, 23.34375, is a decimal number, but it is not necessarily a floating-point number, despite the fact that many languages would store it as floating-point (such as C or Perl 5). Other languages will store it as a rational representation with explicit numerator and denominator (Perl 6 does this, unless you explicitly use E notation). Still other languages might choose to store it in a fixed-point representation with an implied denominator. And some languages will simply keep it as an ASCII string (vintage Tcl) or as a BCD string (REXX I think) and do arithmetic on the string. So I suspect this task should either drop the words "floating point" or should make it clear what is supposed to be "floating" here. Thanks. --TimToady (talk) 20:19, 4 February 2014 (UTC)

REXX stores all values (including the aforementioned numbers) as a (character) string, not a BCD. -- Gerard Schildberger (talk) 22:07, 4 February 2014 (UTC)
I would hope that   decimal floating point number   wouldn't be re-defined as a decimal floating point number being stored in binary. -- Gerard Schildberger (talk) 22:07, 4 February 2014 (UTC)

range of numbers

No mention was made for the range of numbers (in digits or as characters).
I.E.:   how large can/should they be? -- Gerard Schildberger (talk) 22:07, 4 February 2014 (UTC)

Also, I would assume that negative numbers would be allowed. -- Gerard Schildberger (talk) 22:07, 4 February 2014 (UTC)