• FCONSTANT specification

    From marcel hendrix@mhx@iae.nl to comp.lang.forth on Mon Oct 12 12:40:03 2026
    From Newsgroup: comp.lang.forth

    In view of the current thread of floating-point input and output, how
    should we specify FCONSTANTs ? My concern is when the system potentially
    uses single, double, or extended-double (or worse).
    Is the algorithm that guarantees that a printed number can be converted 'losslessly' back to its internal presentation able to do that
    regardless of the number of bits in the internal representation?

    We probably don't want that FP library code developed for a double implementation specifies table constants etc. that are depending on the precision of its internal implementation. (I had this problem last week
    when porting a ddfloat library to xdfloats, although there it was
    especially tricky.)

    Example:
    0e dfvalue t1 0e sfvalue t2
    1e f>xd 7e f>xd xd/ xdconstant xd=1/7
    xd=1/7 xdfe. 1.42857142857142857142857142857142857142e-1

    1e 7e f/ +e. 1.4285714285714285714e-0001
    1e 7e f/ TO t1 t1 +e. 1.4285714285714284921e-0001
    1e 7e f/ TO t2 t2 +e. 1.4285714924335479736e-0001

    You will notice that simply rounding the 80-bit output will not produce
    the correct double and single constants. (xd => extended double is ok,
    by accident?)

    The standard (can't?) say(s) anything about this?

    -marcel

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Mon Oct 12 07:31:57 2026
    From Newsgroup: comp.lang.forth

    On 10/12/26 5:40 AM, marcel hendrix wrote:
    In view of the current thread of floating-point input and output, how
    should we specify FCONSTANTs ? My concern is when the system potentially uses single, double, or extended-double (or worse).
    Is the algorithm that guarantees that a printed number can be converted 'losslessly' back to its internal presentation able to do that
    regardless of the number of bits in the internal representation?

    We probably don't want that FP library code developed for a double implementation specifies table constants etc. that are depending on the precision of its internal implementation. (I had this problem last week
    when porting a ddfloat library to xdfloats, although there it was
    especially tricky.)


    There is, of course, no lossless translation of decimal input strings
    into a finite internal binary representation, whether it is single
    precision, double precision, extended precision, or higher. IEEE 754
    does guarantee that a lower precision binary representation is always
    lossless when going to a supported higher precision representation e.g. binary32 to binary64.

    The implementation of REPRESENT which I've discussed using dtoa() is
    specific to converting decimal strings to internal double precision
    binary format. There are versions of this code for IEEE extended
    precision format, and maybe also for higher precision IEEE formats.
    Please check the netlib page for dtoa.

    Your question applies not just to FCONSTANTs but also to FLITERALs. One problem with addressing your question is that it depends on a specific
    format, and the Forth standard does not require any particular format.
    If we are talking about internal decimal format only, which no one seems
    to use, then it seems like it would be easy to specify how a decimal
    string should convert to internal representation. For all IEEE binary
    formats, the number of decimal digits which must be specified for
    roundtrip binary -> decimal -> binary are given in the IEEE 754
    standard. For double precision, it is 17.

    --
    KM

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Mon Oct 12 08:38:06 2026
    From Newsgroup: comp.lang.forth

    On 10/12/26 7:31 AM, Krishna Myneni wrote:
    On 10/12/26 5:40 AM, marcel hendrix wrote:
    In view of the current thread of floating-point input and output, how
    should we specify FCONSTANTs ? My concern is when the system
    potentially uses single, double, or extended-double (or worse).

    ... For all IEEE binary
    formats, the number of decimal digits which must be specified for
    roundtrip binary -> decimal -> binary are given in the IEEE 754
    standard. For double precision, it is 17.
    ..

    I was unable to give a more complete answer for IEEE binary formats,
    having been pulled away from the computer. Here is a more complete
    answer, from the IEEE 754 standard:

    Limits on correctly rounded conversion:

    binary16: Pmin = 5 digits
    binary32: Pmin = 9 digits
    binary64: Pmin = 17 digits
    binary128: Pmin = 36 digits

    For all other binary formats bf,

    Pmin(bf) = 1 + ceiling(p*log_10(2)), where p is the number of
    significant bits in bf.

    e.g. for double precision, p = 53 bit significand, the above formula
    gives 17 decimal digits.

    For 64 bit significand (80-bit extended precision) , the formula gives
    21 digits.

    --
    KM


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Mon Oct 12 09:14:14 2026
    From Newsgroup: comp.lang.forth

    On 10/12/26 8:38 AM, Krishna Myneni wrote:
    ...
    from the IEEE 754 standard:

    Limits on correctly rounded conversion:

    binary16: Pmin = 5 digits
    binary32: Pmin = 9 digits
    binary64: Pmin = 17 digits
    binary128: Pmin = 36 digits

    For all other binary formats bf,

    Pmin(bf) = 1 + ceiling(p*log_10(2)), where p is the number of
    significant bits in bf.

    e.g. for double precision, p = 53 bit significand, the above formula
    gives 17 decimal digits.

    For 64 bit significand (80-bit extended precision) , the formula gives
    21 digits.
    ...

    In Forth:

    2.0e0 FLOG FCONSTANT _FLOG2
    [UNDEFINED] FCEIL [IF]
    : FCEIL ( F: r1 -- r2 ) FNEGATE FLOOR FNEGATE ;
    [THEN]

    : P_min ( u1 -- u2) S>F _FLOG2 F* FCEIL F>D DROP 1+ ;


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Mon Oct 12 16:56:13 2026
    From Newsgroup: comp.lang.forth

    On 10/12/2026 4:14 PM, Krishna Myneni wrote:
    [..]> 2.0e0 FLOG FCONSTANT _FLOG2
    [UNDEFINED] FCEIL [IF]
    : FCEIL ( F: r1 -- r2 ) FNEGATE FLOOR FNEGATE ;
    [THEN]

    : P_min ( u1 -- u2) S>F _FLOG2 F* FCEIL F>D DROP 1+ ;

    FORTH> xd=pi (xdfe.) 2dup CR TYPE DROP #25 4 + CR TYPE 3.14159265358979323846264338327950288422e0
    3.141592653589793238462643383 ok

    So here it is easy to see it is correct.
    What if PI had been 3.1415926535897932384626433835121212121212 ?

    FORTH> s" 3.1415926535897932384626433835121212121212e" cr 2dup TYPE
    XD (xdfe.) DROP #25 4 + CR TYPE
    3.1415926535897932384626433835121212121212e
    3.141592653589793238462643383 ok

    Maybe don't ever output more than 25 digits?

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Mon Oct 12 11:08:41 2026
    From Newsgroup: comp.lang.forth

    On 10/12/26 9:56 AM, marcel hendrix wrote:
    On 10/12/2026 4:14 PM, Krishna Myneni wrote:
    [..]> 2.0e0 FLOG FCONSTANT _FLOG2
    [UNDEFINED] FCEIL [IF]
    : FCEIL ( F: r1 -- r2 ) FNEGATE FLOOR FNEGATE ;
    [THEN]

    : P_min ( u1 -- u2) S>F _FLOG2 F* FCEIL F>D DROP 1+ ;

    FORTH> xd=pi (xdfe.) 2dup CR TYPE-a DROP #25 4 + CR TYPE 3.14159265358979323846264338327950288422e0
    3.141592653589793238462643383 ok

    So here it is easy to see it is correct.
    What if PI had been 3.1415926535897932384626433835121212121212 ?

    FORTH> s" 3.1415926535897932384626433835121212121212e" cr 2dup TYPE
    XD (xdfe.) DROP #25 4 + CR TYPE
    3.1415926535897932384626433835121212121212e
    3.141592653589793238462643383 ok

    Maybe don't ever output more than 25 digits?


    What binary precision (number of significand bits) are you using for
    your xdfloats?

    --
    KM


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Mon Oct 12 18:38:47 2026
    From Newsgroup: comp.lang.forth

    On 10/12/2026 6:08 PM, Krishna Myneni wrote:
    On 10/12/26 9:56 AM, marcel hendrix wrote:
    On 10/12/2026 4:14 PM, Krishna Myneni wrote:
    [..]> 2.0e0 FLOG FCONSTANT _FLOG2
    [UNDEFINED] FCEIL [IF]
    : FCEIL ( F: r1 -- r2 ) FNEGATE FLOOR FNEGATE ;
    [THEN]

    [..]

    What binary precision (number of significand bits) are you using for
    your xdfloats?
    xdfloats are 128 bits ( 2 extended doubles [80 bits] ).
    ddfloats are 106 bits ( 2 doubles [53 bits] ).
    The '25' is based on an extended float (64 bit mantissa).

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Mon Oct 12 13:05:04 2026
    From Newsgroup: comp.lang.forth

    On 10/12/26 11:38 AM, marcel hendrix wrote:
    On 10/12/2026 6:08 PM, Krishna Myneni wrote:
    On 10/12/26 9:56 AM, marcel hendrix wrote:
    On 10/12/2026 4:14 PM, Krishna Myneni wrote:
    [..]> 2.0e0 FLOG FCONSTANT _FLOG2
    [UNDEFINED] FCEIL [IF]
    : FCEIL ( F: r1 -- r2 ) FNEGATE FLOOR FNEGATE ;
    [THEN]

    [..]

    What binary precision (number of significand bits) are you using for
    your xdfloats?
    xdfloats are 128 bits ( 2 extended doubles [80 bits] ).
    ddfloats are 106 bits ( 2 doubles [53 bits] ).
    The '25' is based on an extended float (64 bit mantissa).


    Ok. It is a composite of two extended precision numbers. That makes it a little difficult to apply the P_min formula. But maybe we can go by the analogy with double double precision.

    If a ddfloat was equivalent to a single binary significand of 106 bits, according to the P_min formula, the output to decimal with 33 digits
    would cycle back to the same binary pattern. Then, an xdfloat treated as equivalent to a single binary significand of 128 bits was output in
    decimal to P_min = 40 digits would cycle back to the same binary pattern.

    In reality, the double double or double extended are probably not
    equivalent to a normalized binary encoding of the sum of the significand
    bits for two doubles/two extended for each case, so I think the number
    of digits given by P_min represent a maximum limit on the number of
    decimal digits which would cycle if they were output by the same binary pattern.

    The problem could be at the front end (decimal string to binary
    conversion) or for the inverse case (binary to decimal string), or
    possibly both. For now, you could test with a single specified extended
    float binary value and output it to 21 decimal digits and see if it
    cycles back to the same binary value. To test the cycling, you have to
    start with the binary value. If that fails, it would indicate a problem.

    --
    KM

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Mon Oct 12 18:36:31 2026
    From Newsgroup: comp.lang.forth

    marcel hendrix <mhx@iae.nl> writes:
    In view of the current thread of floating-point input and output, how
    should we specify FCONSTANTs ? My concern is when the system potentially >uses single, double, or extended-double (or worse).

    Standard Forth only has one FP type on the FP stack, and FCONSTANT
    stores that and pushes that, just like F! and F@ do.

    Is the algorithm that guarantees that a printed number can be converted >'losslessly' back to its internal presentation able to do that
    regardless of the number of bits in the internal representation?

    Sure.

    We probably don't want that FP library code developed for a double >implementation specifies table constants etc. that are depending on the >precision of its internal implementation.

    You will have to work with some limit, but I expect that you can make
    numbers with, say 36 digits, and ideally you can derive the numbers
    for various formats up to binary128 from that. But if the mathematics
    behind these numbers is not just to use an approximation to something,
    but to have a bias that corrects for some error elsewhere, maybe that
    is not enough.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Tue Oct 13 22:29:01 2026
    From Newsgroup: comp.lang.forth

    On 10/12/2026 8:36 PM, Anton Ertl wrote:
    marcel hendrix <mhx@iae.nl> writes:
    In view of the current thread of floating-point input and output, how
    should we specify FCONSTANTs ? My concern is when the system potentially
    uses single, double, or extended-double (or worse).

    Standard Forth only has one FP type on the FP stack, and FCONSTANT
    stores that and pushes that, just like F! and F@ do.


    Procrustes Forth? On such a system SF@/! and DF@/! must convert an
    internal to an external format, and the conversion must be precise.
    Switching between single and double precision is a well-known trick to
    improve convergence of certain algorithms. This conversion *could* be a serious headache.

    Is the algorithm that guarantees that a printed number can be converted
    'losslessly' back to its internal presentation able to do that
    regardless of the number of bits in the internal representation?

    Sure.

    My question is: if we have a text representation of a number with say 40
    (or whatever) digits, will that unchanged string work to give the
    best approximation on single, double, ... binary internal formats?
    Is your answer to that: 'Sure' ?
    We probably don't want that FP library code developed for a double
    implementation specifies table constants etc. that are depending on the
    precision of its internal implementation.

    You will have to work with some limit, but I expect that you can make
    numbers with, say 36 digits, and ideally you can derive the numbers
    for various formats up to binary128 from that. But if the mathematics
    behind these numbers is not just to use an approximation to something,
    but to have a bias that corrects for some error elsewhere, maybe that
    is not enough.
    ...you can derive the numbers...

    The question still is: How?

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Wed Oct 14 05:50:49 2026
    From Newsgroup: comp.lang.forth

    marcel hendrix <mhx@iae.nl> writes:
    On 10/12/2026 8:36 PM, Anton Ertl wrote:
    marcel hendrix <mhx@iae.nl> writes:
    In view of the current thread of floating-point input and output, how
    should we specify FCONSTANTs ? My concern is when the system potentially >>> uses single, double, or extended-double (or worse).

    Standard Forth only has one FP type on the FP stack, and FCONSTANT
    stores that and pushes that, just like F! and F@ do.


    Procrustes Forth? On such a system SF@/! and DF@/! must convert an
    internal to an external format, and the conversion must be precise.

    Yes, at least one of them, and possibly both have to perform the
    conversion. And if you use the 387 FP instructions, both have to
    perform a conversion even if you set the mantissa length to 53 or 24
    bits, because the exponent length still is 16 bits, i.e., you can
    represent numbers as normal number in the internal format that are
    denormal or infinity in the external format.

    Concerning precision, there is the double-rounding problem <https://en.wikipedia.org/wiki/Rounding#Double_rounding>, e.g., if you
    perform an FP operation like F+ at 80 bits (or even at 53+16 bits),
    and then convert to binary64, in some cases you get a different (less
    precise) result than if you had performed FP addition directly in
    binary64 format (with only one rounding round), e.g., with SSE2.

    I have read that double rounding for the FP operations where IEEE FP
    requires a specific result (rather than allowing any result up to a
    certain error), in particular F+ F- F* F/ FSQRT, double rounding does
    not change the result compared to single rounding if the mantissa
    length of the first rounding is more than twice as long than the
    mantissa length of the second rounding. E.g., F+ SF! should not
    suffer from double-rounding errors if the FP stack uses a 53-bit or
    64-bit mantissa.

    Switching between single and double precision is a well-known trick to >improve convergence of certain algorithms.

    I have not heard of that. Why should doing the first steps in SP
    improve convergence over doing it all in DP or extended precision?

    Is the algorithm that guarantees that a printed number can be converted
    'losslessly' back to its internal presentation able to do that
    regardless of the number of bits in the internal representation?

    Sure.

    My question is: if we have a text representation of a number with say 40
    (or whatever) digits, will that unchanged string work to give the
    best approximation on single, double, ... binary internal formats?
    Is your answer to that: 'Sure' ?

    Actually, having read up on the double-rounding problem, I am no
    longer sure: I have come across <https://www.exploringbinary.com/double-rounding-errors-in-floating-point-conversions/>,
    which shows that for decimal-to-FP conversion there are cases where
    double rounding can give a result that's further from the actual value
    than 1/2 ulp. And when you store an irrational or otherwise
    arbitrarily long number with finite length, you already have one
    rounding step when performing this storing.

    However, the problem affects only relatively few numbers, and you can
    store as many digits of your infinitely long number that the problem
    does not occur for it, for the desired mantissa lengths. Once you
    have that, you "only" need a decimal-to-binary (or, if you store the
    numbers in hex format, a hex-to-binary) conversion routine that
    performs the appropriate rounding (not what Visual C++ does according
    to <https://www.exploringbinary.com/double-rounding-errors-in-floating-point-conversions/>.

    You will have to work with some limit, but I expect that you can make
    numbers with, say 36 digits, and ideally you can derive the numbers
    for various formats up to binary128 from that. But if the mathematics
    behind these numbers is not just to use an approximation to something,
    but to have a bias that corrects for some error elsewhere, maybe that
    is not enough.
    ...you can derive the numbers...

    The question still is: How?

    Gforth converts string-to-double with strtod(), and glibc apparently
    implements it to give you a result within 1/2 ulp (and it also has
    strtold() for long double); for double-extended numbers, you will have
    to look at the algorithms that are used for that problem, e.g., in
    strtod().

    For producing numbers for your table, I would just produce longer and
    longer decimal (or hexadecimal) numbers, convert them to all the
    formats that you are interested in, check that the result is less than
    1/2 ulp (for the format) from the actual number, and stop when that's
    the case for all the target formats. With double-extended as one of
    the target formats, this will probably require 42 digits of mantissa
    or more. I have not worked with Mathematica, but from what I have
    read about it, it seems to be the tool for this job.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From albert@albert@spenarnc.xs4all.nl to comp.lang.forth on Wed Oct 14 10:10:16 2026
    From Newsgroup: comp.lang.forth

    In article <11am4ae$fte4$1@dont-email.me>, marcel hendrix <mhx@iae.nl> wrote: >On 10/12/2026 8:36 PM, Anton Ertl wrote:
    marcel hendrix <mhx@iae.nl> writes:
    In view of the current thread of floating-point input and output, how
    should we specify FCONSTANTs ? My concern is when the system potentially >>> uses single, double, or extended-double (or worse).

    Standard Forth only has one FP type on the FP stack, and FCONSTANT
    stores that and pushes that, just like F! and F@ do.


    Procrustes Forth? On such a system SF@/! and DF@/! must convert an
    internal to an external format, and the conversion must be precise.
    Switching between single and double precision is a well-known trick to >improve convergence of certain algorithms. This conversion *could* be a >serious headache.

    The illusion that you can do something precise with imprecise numbers ...

    The question still is: How?
    The answer is "mu".


    -marcel

    Groetjes Albert
    --
    The Chinese government is satisfied with its military superiority over USA.
    The next 5 year plan has as primary goal to advance life expectancy
    over 80 years, like Western Europe.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Wed Oct 14 08:25:17 2026
    From Newsgroup: comp.lang.forth

    albert@spenarnc.xs4all.nl writes:
    The illusion that you can do something precise with imprecise numbers ...

    What is an "imprecise number"? In any case, every FP number has a
    precise value. It may not be the value you are interested in, but
    that does not make the value any less precise. And thinking about FP
    numbers as "imprecise" or intervals etc. leads you down the path to
    wrong conclusions.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Thu Oct 15 00:47:24 2026
    From Newsgroup: comp.lang.forth

    On 10/12/2026 8:05 PM, Krishna Myneni wrote:
    On 10/12/26 11:38 AM, marcel hendrix wrote:
    On 10/12/2026 6:08 PM, Krishna Myneni wrote:
    On 10/12/26 9:56 AM, marcel hendrix wrote:
    On 10/12/2026 4:14 PM, Krishna Myneni wrote:
    [..]> 2.0e0 FLOG FCONSTANT _FLOG2
    [UNDEFINED] FCEIL [IF]
    : FCEIL ( F: r1 -- r2 ) FNEGATE FLOOR FNEGATE ;
    [THEN]

    [..]

    What binary precision (number of significand bits) are you using for
    your xdfloats?
    xdfloats are 128 bits ( 2 extended doubles [80 bits] ).
    ddfloats are 106 bits ( 2 doubles [53 bits] ).
    The '25' is based on an extended float (64 bit mantissa).



    [..]


    The problem could be at the front end (decimal string to binary
    conversion) or for the inverse case (binary to decimal string), or
    possibly both. For now, you could test with a single specified extended float binary value and output it to 21 decimal digits and see if it
    cycles back to the same binary value. To test the cycling, you have to
    start with the binary value. If that fails, it would indicate a problem.
    This is a very good and helpful suggestion. It deepened my
    understanding, although a full solution is not obvious yet.

    Here are the results for the 128 bit package. Testing is done with three
    40 digit numbers, xd=E, xd=PI*2 and xd=3*PI/4. I first convert the full
    number from text (with the mantissa cut to XDPRECISION digits) to
    binary. That binary output is converted back to text (estimate) and then estimate is converted to estimate estimate. The binary of estimate
    estimate is compared to the binary of input cut.
    It can be observed that the numbers eventually cycle if XDPRECISION is sufficiently high, and they approach the full input better and better
    (but not exactly). That doesn't matter because the binary values become indistinguishable although the text representations don't. For instance,
    with xdprecision = 39,
    2.718281828459045235360287471352662497757e0 and 2.718281828459045235360287471352662497770e0 give the same binary result.

    For lower xdprecision (37) the value for xd=2*pi differs by ~ 2e-38
    from its cycled result. This is what I expect from a 128 bit mantissa,
    -128e F2^X +e. prints 2.9387358770557187700e-0039.

    I interpret this as follows:
    1. Always use #38 SET-XDPRECISION for computations
    2. Do not worry when the cycled value of a constant *prints*
    differently, it's the binary value that counts
    3. Rounding numbers must be done by rounding the full precision binary
    value like `a human`, not by choosing a lower XDPRECISION. This is
    counter-intuitive, but look at the the 27 >XD-TEST result below: the
    (estimate2 - input) values differ by 1 decimal, depending on
    the input value's digit pattern.

    FORTH> 39 >XD-TEST
    full input 2.7182818284590452353602874713526624977572e0
    input cut to 39 places = 2.718281828459045235360287471352662497757e0
    estimate 2.718281828459045235360287471352662497770e0
    estimate of estimate 2.718281828459045235360287471352662497770e0 estimate2 - input = 0e0
    full input 6.2831853071795864769252867665590057683943e0
    input cut to 39 places = 6.283185307179586476925286766559005768394e0
    estimate 6.283185307179586476925286766559005768349e0
    estimate of estimate 6.283185307179586476925286766559005768349e0 estimate2 - input = 0e0
    full input 2.3561944901923449288469825374596271631478e0
    input cut to 39 places = 2.356194490192344928846982537459627163147e0
    estimate 2.356194490192344928846982537459627163137e0
    estimate of estimate 2.356194490192344928846982537459627163137e0 estimate2 - input = 0e0
    ( expect optimal result for XDPRECISION = 38 ) ok

    FORTH> 38 >XD-TEST
    full input 2.7182818284590452353602874713526624977572e0
    input cut to 38 places = 2.71828182845904523536028747135266249775e0
    estimate 2.71828182845904523536028747135266249777e0
    estimate of estimate 2.71828182845904523536028747135266249777e0
    estimate2 - input = 0e0
    full input 6.2831853071795864769252867665590057683943e0
    input cut to 38 places = 6.28318530717958647692528676655900576839e0
    estimate 6.28318530717958647692528676655900576844e0
    estimate of estimate 6.28318530717958647692528676655900576844e0
    estimate2 - input = 0e0
    full input 2.3561944901923449288469825374596271631478e0
    input cut to 38 places = 2.35619449019234492884698253745962716314e0
    estimate 2.35619449019234492884698253745962716313e0
    estimate of estimate 2.35619449019234492884698253745962716313e0
    estimate2 - input = 0e0
    ( expect optimal result for XDPRECISION = 38 ) ok

    FORTH> 37 >XD-TEST
    full input 2.7182818284590452353602874713526624977572e0
    input cut to 37 places = 2.7182818284590452353602874713526624977e0
    estimate 2.7182818284590452353602874713526624977e0
    estimate of estimate 2.7182818284590452353602874713526624977e0
    estimate2 - input = 0e0
    full input 6.2831853071795864769252867665590057683943e0
    input cut to 37 places = 6.2831853071795864769252867665590057683e0
    estimate 6.2831853071795864769252867665590057682e0
    estimate of estimate 6.2831853071795864769252867665590057682e0
    estimate2 - input = 2.3509887016445750159374730744444913556e-38
    full input 2.3561944901923449288469825374596271631478e0
    input cut to 37 places = 2.3561944901923449288469825374596271631e0
    estimate 2.3561944901923449288469825374596271630e0
    estimate of estimate 2.3561944901923449288469825374596271630e0
    estimate2 - input = 8.2284604557560125557811557605557197447e-38
    ( expect optimal result for XDPRECISION = 38 ) ok

    FORTH> 27 >XD-TEST
    full input 2.7182818284590452353602874713526624977572e0
    input cut to 27 places = 2.718281828459045235360287471e0
    estimate 2.718281828459045235360287471e0
    estimate of estimate 2.718281828459045235360287471e0
    estimate2 - input = 0e0
    full input 6.2831853071795864769252867665590057683943e0
    input cut to 27 places = 6.283185307179586476925286766e0
    estimate 6.283185307179586476925286765e0
    estimate of estimate 6.283185307179586476925286765e0
    estimate2 - input = 9.999999999502223297179835753e-28
    full input 2.3561944901923449288469825374596271631478e0
    input cut to 27 places = 2.356194490192344928846982537e0
    estimate 2.356194490192344928846982535e0
    estimate of estimate 2.356194490192344928846982535e0
    estimate2 - input = 1.999999999970974320485304401e-27
    ( expect optimal result for XDPRECISION = 38 ) ok

    I also have a >DD-TEST for 106 bit mantissas. The results are
    qualitatively the same. A test for iForth's extended floats shows a lot
    of potential for improvement but that will be something for the next
    release.

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Thu Oct 15 12:40:00 2026
    From Newsgroup: comp.lang.forth

    On 14/10/2026 7:25 pm, Anton Ertl wrote:
    albert@spenarnc.xs4all.nl writes:
    The illusion that you can do something precise with imprecise numbers ...

    What is an "imprecise number"? In any case, every FP number has a
    precise value. It may not be the value you are interested in, but
    that does not make the value any less precise. And thinking about FP
    numbers as "imprecise" or intervals etc. leads you down the path to
    wrong conclusions.

    If the recently-dubbed "high quality" REPRESENTs aren't printing out
    intervals then what are they doing? Following the leader?



    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Thu Oct 15 05:55:08 2026
    From Newsgroup: comp.lang.forth

    dxf <dxforth@gmail.com> writes:
    On 14/10/2026 7:25 pm, Anton Ertl wrote:
    What is an "imprecise number"? In any case, every FP number has a
    precise value. It may not be the value you are interested in, but
    that does not make the value any less precise. And thinking about FP
    numbers as "imprecise" or intervals etc. leads you down the path to
    wrong conclusions.

    If the recently-dubbed "high quality" REPRESENTs aren't printing out >intervals then what are they doing? Following the leader?

    If you give a precise REPRESENT a big-enough buffer, it gives you the
    decimal representation of the floating-point value, exactly.

    If you give it a buffer that's too short for the exact representation,
    you get a rounded result, rounded to the nearest decimal number that
    fits in the buffer.

    It seems pretty obvious to me that REPRESENT (whether high-quality or
    not) does not output an interval. An interval is indicated by two
    numbers, REPRESENT only outputs one.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Thu Oct 15 07:22:22 2026
    From Newsgroup: comp.lang.forth

    On 10/14/26 5:47 PM, marcel hendrix wrote:
    On 10/12/2026 8:05 PM, Krishna Myneni wrote:
    On 10/12/26 11:38 AM, marcel hendrix wrote:
    On 10/12/2026 6:08 PM, Krishna Myneni wrote:
    On 10/12/26 9:56 AM, marcel hendrix wrote:
    On 10/12/2026 4:14 PM, Krishna Myneni wrote:
    [..]> 2.0e0 FLOG FCONSTANT _FLOG2
    [UNDEFINED] FCEIL [IF]
    : FCEIL ( F: r1 -- r2 ) FNEGATE FLOOR FNEGATE ;
    [THEN]

    [..]

    What binary precision (number of significand bits) are you using for
    your xdfloats?
    xdfloats are 128 bits ( 2 extended doubles [80 bits] ).
    ddfloats are 106 bits ( 2 doubles [53 bits] ).
    The '25' is based on an extended float (64 bit mantissa).



    [..]


    The problem could be at the front end (decimal string to binary
    conversion) or for the inverse case (binary to decimal string), or
    possibly both. For now, you could test with a single specified
    extended float binary value and output it to 21 decimal digits and see
    if it cycles back to the same binary value. To test the cycling, you
    have to start with the binary value. If that fails, it would indicate
    a problem.
    This is a very good and helpful suggestion. It deepened my
    understanding, although a full solution is not obvious yet.

    Here are the results for the 128 bit package. Testing is done with three
    40 digit numbers, xd=E, xd=PI*2 and xd=3*PI/4. I first convert the full number from text (with the mantissa cut to XDPRECISION digits) to
    binary. That binary output is converted back to text (estimate) and then estimate is converted to estimate estimate. The binary of estimate
    estimate is compared to the binary of input cut.
    It can be observed that the numbers eventually cycle if XDPRECISION is sufficiently high, and they approach the full input better and better
    (but not exactly). That doesn't matter because the binary values become indistinguishable although the text representations don't. For instance, with xdprecision = 39,
    2.718281828459045235360287471352662497757e0-a and 2.718281828459045235360287471352662497770e0-a give the same binary result.

    For lower xdprecision (37) the value for xd=2*pi differs by ~ 2e-38
    from its cycled result. This is what I expect from a 128 bit mantissa,
    -128e F2^X +e. prints 2.9387358770557187700e-0039.

    I interpret this as follows:
    -a1. Always use #38 SET-XDPRECISION for computations
    -a2. Do not worry when the cycled value of a constant *prints*
    -a-a-a differently, it's the binary value that counts
    -a3. Rounding numbers must be done by rounding the full precision binary
    -a-a-a value like `a human`, not by choosing a lower XDPRECISION. This is
    -a-a-a counter-intuitive, but look at the the 27 >XD-TEST result below: the
    -a-a-a (estimate2 - input) values differ by 1 decimal, depending on
    -a-a-a the input value's digit pattern.

    FORTH> 39 >XD-TEST
    full input-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 2.7182818284590452353602874713526624977572e0
    input cut to 39 places =-a-a 2.718281828459045235360287471352662497757e0 estimate-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 2.718281828459045235360287471352662497770e0
    estimate of estimate-a-a-a-a-a-a 2.718281828459045235360287471352662497770e0 estimate2 - input =-a 0e0
    full input-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 6.2831853071795864769252867665590057683943e0
    input cut to 39 places =-a-a 6.283185307179586476925286766559005768394e0 estimate-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 6.283185307179586476925286766559005768349e0
    estimate of estimate-a-a-a-a-a-a 6.283185307179586476925286766559005768349e0 estimate2 - input =-a 0e0
    full input-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 2.3561944901923449288469825374596271631478e0
    input cut to 39 places =-a-a 2.356194490192344928846982537459627163147e0 estimate-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 2.356194490192344928846982537459627163137e0
    estimate of estimate-a-a-a-a-a-a 2.356194490192344928846982537459627163137e0 estimate2 - input =-a 0e0
    ( expect optimal result for XDPRECISION = 38 ) ok

    FORTH> 38 >XD-TEST
    full input-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 2.7182818284590452353602874713526624977572e0
    input cut to 38 places =-a-a 2.71828182845904523536028747135266249775e0 estimate-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 2.71828182845904523536028747135266249777e0
    estimate of estimate-a-a-a-a-a-a 2.71828182845904523536028747135266249777e0 estimate2 - input =-a 0e0
    full input-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 6.2831853071795864769252867665590057683943e0
    input cut to 38 places =-a-a 6.28318530717958647692528676655900576839e0 estimate-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 6.28318530717958647692528676655900576844e0
    estimate of estimate-a-a-a-a-a-a 6.28318530717958647692528676655900576844e0 estimate2 - input =-a 0e0
    full input-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 2.3561944901923449288469825374596271631478e0
    input cut to 38 places =-a-a 2.35619449019234492884698253745962716314e0 estimate-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 2.35619449019234492884698253745962716313e0
    estimate of estimate-a-a-a-a-a-a 2.35619449019234492884698253745962716313e0 estimate2 - input =-a 0e0
    ( expect optimal result for XDPRECISION = 38 ) ok

    ...

    These tests look encouraging.

    IEEE 754 guarantees that lower precision binary formats are lossless
    when converted to higher precision binary formats. So if you need binary significands which convert accurately to 40 decimal digits or higher you
    can do so with double precision alone, assuming you have a REPRESENT
    that will output a sufficient number of digits, properly rounded. The 53
    bit significand from the double, extended with 0 bit values, can then be
    used within the higher precision format, and the conversion from the
    higher format should show the same digits (the unbiased base 2 exponent
    should remain the same).

    --
    Krishna



    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Fri Oct 16 12:22:34 2026
    From Newsgroup: comp.lang.forth

    On 15/10/2026 4:55 pm, Anton Ertl wrote:
    dxf <dxforth@gmail.com> writes:
    On 14/10/2026 7:25 pm, Anton Ertl wrote:
    What is an "imprecise number"? In any case, every FP number has a
    precise value. It may not be the value you are interested in, but
    that does not make the value any less precise. And thinking about FP
    numbers as "imprecise" or intervals etc. leads you down the path to
    wrong conclusions.

    If the recently-dubbed "high quality" REPRESENTs aren't printing out
    intervals then what are they doing? Following the leader?

    If you give a precise REPRESENT a big-enough buffer, it gives you the
    decimal representation of the floating-point value, exactly.

    It gives a decimal representation of the nearest storage slot that the floating-point value was assigned. That floating-point value never had
    more than 17 useful digits.

    The question then becomes why? Why deliberately misrepresent users?
    I'd have to fall on my head.

    ...
    It seems pretty obvious to me that REPRESENT (whether high-quality or
    not) does not output an interval. An interval is indicated by two
    numbers, REPRESENT only outputs one.

    Print two and the interval becomes obvious.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Thu Oct 15 22:58:19 2026
    From Newsgroup: comp.lang.forth

    On 10/14/26 8:40 PM, dxf wrote:
    On 14/10/2026 7:25 pm, Anton Ertl wrote:
    albert@spenarnc.xs4all.nl writes:
    The illusion that you can do something precise with imprecise numbers ... >>
    What is an "imprecise number"? In any case, every FP number has a
    precise value. It may not be the value you are interested in, but
    that does not make the value any less precise. And thinking about FP
    numbers as "imprecise" or intervals etc. leads you down the path to
    wrong conclusions.

    If the recently-dubbed "high quality" REPRESENTs aren't printing out intervals then what are they doing? Following the leader?


    Let's attempt to give a more precise meaning to what is meant by a "high quality" REPRESENT using the IEEE 754 standard as a guide. There are
    several possibilities. First, some definitions from the IEEE 754
    standard, and then some possible meanings when we say "high quality".

    I. Definitions:

    P_min = minimum of number of decimal digits needed, with round to
    nearest, for conversion from internal normalized binary representation
    to decimal output for the significand, which, when converted back to
    binary form gives the same binary significand:

    P_min( p ) = 1 + ceiling(p*log_10(2)); p is the number of significant
    bits (both actual and implied) of the significand in the binary format.

    If a Forth system supports multiple binary formats, define

    M = max{P_min(p_i)} where i indexes the binary format

    Example: For a Forth system supports both single-precision and double-precision IEEE binary formats,

    M = max{ P_min(24), P_min(53) } = max{ 9, 17 } = 17

    II. Possible meanings of "high quality" REPRESENT

    There are 3 sensible choices, in my opinion:

    II.1) On a given Forth system, REPRESENT will output, with rounding to
    nearest a minimum of digits, M, given by maximum of P_min for all
    supported binary formats.

    For example, if a Forth system supports nothing above binary double
    precision (binary64), it should be capable of providing M = 17
    significant decimal digits, with round to nearest.


    II.2) Follow the IEEE 754 standard and specify that the Forth system has
    "an implementation-defined limit on the number of significant digits
    that can be converted with correct rounding to and from supported binary formats. That limit, H, shall be such that H reN M + 3 and it should be
    that H is unbounded."

    Then, the minimum number of significant digits for a system which
    supports nothing higher than binary64, it should provide at least H = 20 significant digits in any specified rounding mode.

    Note that the IEEE 754 standard goes to pains to specify there is no
    upper bound on H, only a lower bound.

    II.3) Provide H significant decimal digits to support most *fixed
    length* binary formats currently in use, whether they are internally
    supported by the Forth system or supported via source code. Some fixed
    length binary formats currently in use are:

    extended precision (p = 64 bits)
    double double precision (p = 106 bits)
    quad precision (p = 113 bits)
    double extended precision (p = 128 bits)
    double quad precision (p = 226 bits)

    Then M = 70, and H >= 73 significant digits.


    Of the three choices above, II.1 or II.2 is probably what smaller
    systems would choose: M = 17 or H = H_min = 20 significant digits. If
    they want to provide double double precision, then II.2 would be a
    better choice (H = H_min = 36 significant digits).

    Systems with less memory constraints should choose II.3.

    --
    KM





    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Fri Oct 16 05:12:12 2026
    From Newsgroup: comp.lang.forth

    dxf <dxforth@gmail.com> writes:
    On 15/10/2026 4:55 pm, Anton Ertl wrote:
    dxf <dxforth@gmail.com> writes:
    On 14/10/2026 7:25 pm, Anton Ertl wrote:
    What is an "imprecise number"? In any case, every FP number has a
    precise value. It may not be the value you are interested in, but
    that does not make the value any less precise. And thinking about FP
    numbers as "imprecise" or intervals etc. leads you down the path to
    wrong conclusions.

    If the recently-dubbed "high quality" REPRESENTs aren't printing out
    intervals then what are they doing? Following the leader?

    If you give a precise REPRESENT a big-enough buffer, it gives you the
    decimal representation of the floating-point value, exactly.

    It gives a decimal representation of the nearest storage slot that the >floating-point value was assigned.

    Storage slot? Are your postings AI slop?

    Anyway, every binary FP number can be represented exactly as decimal
    number, but some FP numbers need a large number of digits in decimal representation. Gforth's E.EXACT outputs this decimal representation,
    when based on an appropriate ecvt_r() (such as that in glibc 2.36).

    That floating-point value never had
    more than 17 useful digits.

    How many digits are useful depends on the use. In particular, if you
    want to know the exact decimal representation of an FP value, often
    more than 17 digits are necessary, and therefore, for this use,
    useful.

    The question then becomes why? Why deliberately misrepresent users?
    I'd have to fall on my head.

    More AI slop?

    It seems pretty obvious to me that REPRESENT (whether high-quality or
    not) does not output an interval. An interval is indicated by two
    numbers, REPRESENT only outputs one.

    Print two and the interval becomes obvious.

    REPRESENT does not print two. And if you invoke REPRESENT twice with
    the same parameters, you will get the same results.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Fri Oct 16 05:39:27 2026
    From Newsgroup: comp.lang.forth

    Krishna Myneni <krishna.myneni@ccreweb.org> writes:
    II. Possible meanings of "high quality" REPRESENT

    Another meaning is that it produces as many digits as asked for (and
    to use the correct rounding in cases where the asked-for digits are insufficient to represent the number exactly).

    This is what Gforth's REPRESENT provides when it is based on ecvt_r()
    in glibc 2.36 (and probably newer, and probably some older glibcs).

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Fri Oct 16 10:56:10 2026
    From Newsgroup: comp.lang.forth

    On 10/16/2026 5:58 AM, Krishna Myneni wrote:

    [..]

    extended precision (p = 64 bits)
    double double precision (p = 106 bits)
    quad precision (p = 113 bits)
    double extended precision (p = 128 bits)
    double quad precision (p = 226 bits)

    I think double quad extended precision (p = 256 bits) is technically
    possible. Probably not a wise choice for the next decade, but some
    people may decide to go for it.

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From albert@albert@spenarnc.xs4all.nl to comp.lang.forth on Fri Oct 16 11:55:02 2026
    From Newsgroup: comp.lang.forth

    In article <2026Oct15.075508@mips.complang.tuwien.ac.at>,
    Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
    dxf <dxforth@gmail.com> writes:
    On 14/10/2026 7:25 pm, Anton Ertl wrote:
    What is an "imprecise number"? In any case, every FP number has a
    precise value. It may not be the value you are interested in, but
    that does not make the value any less precise. And thinking about FP
    numbers as "imprecise" or intervals etc. leads you down the path to
    wrong conclusions.

    If the recently-dubbed "high quality" REPRESENTs aren't printing out >>intervals then what are they doing? Following the leader?

    If you give a precise REPRESENT a big-enough buffer, it gives you the
    decimal representation of the floating-point value, exactly.

    If you give it a buffer that's too short for the exact representation,
    you get a rounded result, rounded to the nearest decimal number that
    fits in the buffer.

    It seems pretty obvious to me that REPRESENT (whether high-quality or
    not) does not output an interval. An interval is indicated by two
    numbers, REPRESENT only outputs one.

    A fp number represents a rational range, it nominal value plus or minus
    half an ulp.


    - anton
    --
    The Chinese government is satisfied with its military superiority over USA.
    The next 5 year plan has as primary goal to advance life expectancy
    over 80 years, like Western Europe.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Fri Oct 16 07:03:58 2026
    From Newsgroup: comp.lang.forth

    On 10/16/26 12:39 AM, Anton Ertl wrote:
    Krishna Myneni <krishna.myneni@ccreweb.org> writes:
    II. Possible meanings of "high quality" REPRESENT

    Another meaning is that it produces as many digits as asked for (and
    to use the correct rounding in cases where the asked-for digits are insufficient to represent the number exactly).

    This is what Gforth's REPRESENT provides when it is based on ecvt_r()
    in glibc 2.36 (and probably newer, and probably some older glibcs).


    That case is implied by II.3, H >= 73 digits, where H is unbounded.

    --
    KM

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Fri Oct 16 17:36:08 2026
    From Newsgroup: comp.lang.forth

    On 10/16/2026 5:58 AM, Krishna Myneni wrote:

    extended precision (p = 64 bits)
    double double precision (p = 106 bits)
    quad precision (p = 113 bits)
    double extended precision (p = 128 bits)
    double quad precision (p = 226 bits)

    Then M = 70, and H >= 73 significant digits.

    Which implies H >= 83 for quad double extended precision,
    meaning the available QD* in that library is not sufficient.
    Although only QDNEGATE , qd=10 QD* , qd=10 QD/ , and QDF+ are needed,
    one can't get by with a bit shift routine and a simple QQDF+, as +/-INF,
    NAN and subnormals must be handled.

    Or give up in disgust and link to an external library.

    Either that or go for II.2.

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Fri Oct 16 15:40:24 2026
    From Newsgroup: comp.lang.forth

    albert@spenarnc.xs4all.nl writes:
    A fp number represents a rational range, it nominal value plus or minus
    half an ulp.

    What makes you think that the result of

    3 s>f

    or

    s" 3e" >float drop

    represents a range? This value can be represented exactly as FP
    value, there is no rounding happening in this conversion.

    And why should it represent the range

    2.9999999999999997779553950749686919152736663818359375e to 3.0000000000000002220446049250313080847263336181640625e

    in particular?

    Further, when we perform

    6 s>f 3 s>f f-

    why should the results of the individual conversions (none of which
    performs rounding) represent ranges? Why should the result of the
    subtraction (which does not perform any rounding, either, and does not
    set the "inexact" flag in the FPU) represent a range.

    But even if we assume that the results of the conversions are ranges,
    why should the result of the subtraction be the interval above,
    instead of the interval that interval arithmetic would give, which is
    a range that is 3 times bigger in this case (2 times, because the
    interval you claim for 6 is twice as big as that for 3, and 1 time due
    to the interval of 3).

    As mentioned, thinking about FP numbers as "imprecise" or intervals
    etc. leads you down the path to wrong conclusions.

    A better way to think about them is: Each FP number has an exact
    value, but in some cases conversions to FP and FP operations round,
    because there is no FP value for the exact result; this rounding leads
    to errors. The size of this error is the subject of numerical
    analysis.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Fri Oct 16 11:02:25 2026
    From Newsgroup: comp.lang.forth

    On 10/16/26 10:36, marcel hendrix wrote:
    On 10/16/2026 5:58 AM, Krishna Myneni wrote:

    extended precision (p = 64 bits)
    double double precision (p = 106 bits)
    quad precision (p = 113 bits)
    double extended precision (p = 128 bits)
    double quad precision (p = 226 bits)

    Then M = 70, and H >= 73 significant digits.

    Which implies H >= 83 for quad double extended precision,
    meaning the available QD* in that library is not sufficient.
    Although only QDNEGATE , qd=10 QD* , qd=10 QD/ , and QDF+ are needed,
    one can't get by with a bit shift routine and a simple QQDF+, as +/-INF,
    NAN and subnormals must be handled.

    Or give up in disgust and link to an external library.

    Either that or go for II.2.

    -marcel


    Yes, I expect QD* which I assume is quad double mulitply is probably not sufficient to handle quad extended requirements. One point I forgot to
    mention is that the Forth standard for REPRESENT requires rounding to
    nearest, in which case H_min = M (not M+3). There's no way I can see to
    avoid using big number arithmetic for the quad extended precision case.

    It's not hopeless. We have big number arithmetic library code in Forth
    with which to learn how to deal with just about any case. The learning
    curve is there, of course.

    To handle +/-INF and NAN, isn't it sufficient to examine the bit pattern
    for the leading extended precision number in the quad extended precision
    set i.e. no arithmetic should be needed to handle +/-INF and NAN? I'm
    not sure if subnormals will be more difficult to handle than normal
    numbers -- their precision is always less than or equal to normal numbers.

    --
    KM


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Fri Oct 16 21:55:06 2026
    From Newsgroup: comp.lang.forth

    On 10/16/2026 6:02 PM, Krishna Myneni wrote:
    On 10/16/26 10:36, marcel hendrix wrote:
    On 10/16/2026 5:58 AM, Krishna Myneni wrote:

    extended precision (p = 64 bits)
    double double precision (p = 106 bits)
    quad precision (p = 113 bits)
    double extended precision (p = 128 bits)
    double quad precision (p = 226 bits)

    Then M = 70, and H >= 73 significant digits.

    Which implies H >= 83 for quad double extended precision,
    meaning the available QD* in that library is not sufficient.
    Although only QDNEGATE , qd=10 QD* , qd=10 QD/ , and QDF+ are needed,
    one can't get by with a bit shift routine and a simple QQDF+, as +/-
    INF, NAN and subnormals must be handled.

    Or give up in disgust and link to an external library.

    Either that or go for II.2.

    -marcel


    Yes, I expect QD* which I assume is quad double mulitply is probably not sufficient to handle quad extended requirements. One point I forgot to mention is that the Forth standard for REPRESENT requires rounding to nearest, in which case H_min = M (not M+3). There's no way I can see to avoid using big number arithmetic for the quad extended precision case.

    An iForth QD library will have a quad double extended multiply QD* for
    256 bits. Then -256e F2^x gives 8.6e-78 ~> 77 usable decimals.
    Your `2e FLOG 256e F* FCEIL F1+` formula (even rounding) gives M = 79,
    and unfortunately, QD* does not suffice.

    It's not hopeless. We have big number arithmetic library code in Forth
    with which to learn how to deal with just about any case. The learning
    curve is there, of course.

    I don't know there is a Forth-based arbitrary *float* implementation,
    but the MPFR was ported back in 2012. I am looking at it just now. The
    Windows port suffered from a very immature MinGW64 and would need to be revisited.
    But why want QD, QX or QD when the mpfr gives arbitrary precision on its
    own? The charm of QD is that is very small and simple, while MPFR is a
    beast. It could be that it is much faster than QD/QX and QD though.
    Maybe some tests could be done first.
    To handle +/-INF and NAN, isn't it sufficient to examine the bit pattern
    for the leading extended precision number in the quad extended precision
    set i.e. no arithmetic should be needed to handle +/-INF and NAN? I'm
    not sure if subnormals will be more difficult to handle than normal
    numbers -- their precision is always less than or equal to normal numbers.
    I hope that is true, I don't particularly enjoy looking into the MPFR again.

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Fri Oct 16 15:44:22 2026
    From Newsgroup: comp.lang.forth

    On 10/16/26 2:55 PM, marcel hendrix wrote:
    On 10/16/2026 6:02 PM, Krishna Myneni wrote:
    On 10/16/26 10:36, marcel hendrix wrote:
    On 10/16/2026 5:58 AM, Krishna Myneni wrote:

    extended precision (p = 64 bits)
    double double precision (p = 106 bits)
    quad precision (p = 113 bits)
    double extended precision (p = 128 bits)
    double quad precision (p = 226 bits)

    Then M = 70, and H >= 73 significant digits.

    Which implies H >= 83 for quad double extended precision,
    meaning the available QD* in that library is not sufficient.
    Although only QDNEGATE , qd=10 QD* , qd=10 QD/ , and QDF+ are needed,
    one can't get by with a bit shift routine and a simple QQDF+, as +/-
    INF, NAN and subnormals must be handled.

    Or give up in disgust and link to an external library.

    Either that or go for II.2.

    -marcel


    Yes, I expect QD* which I assume is quad double mulitply is probably
    not sufficient to handle quad extended requirements. One point I
    forgot to mention is that the Forth standard for REPRESENT requires
    rounding to nearest, in which case H_min = M (not M+3). There's no way
    I can see to avoid using big number arithmetic for the quad extended
    precision case.

    An iForth QD library will have a quad double extended multiply QD* for
    256 bits. Then -256e F2^x gives 8.6e-78 ~> 77 usable decimals.
    Your `2e FLOG 256e F* FCEIL F1+` formula (even rounding) gives M = 79,
    and unfortunately, QD* does not suffice.

    It's not hopeless. We have big number arithmetic library code in Forth
    with which to learn how to deal with just about any case. The learning
    curve is there, of course.

    I don't know there is a Forth-based arbitrary *float* implementation,
    but the MPFR was ported back in 2012. I am looking at it just now. The Windows port suffered from a very immature MinGW64 and would need to be revisited.
    But why want QD, QX or QD when the mpfr gives arbitrary precision on its own? The charm of QD is that is very small and simple, while MPFR is a beast. It could be that it is much faster than QD/QX and QD though.
    Maybe some tests could be done first.
    To handle +/-INF and NAN, isn't it sufficient to examine the bit
    pattern for the leading extended precision number in the quad extended
    precision set i.e. no arithmetic should be needed to handle +/-INF and
    NAN? I'm not sure if subnormals will be more difficult to handle than
    normal numbers -- their precision is always less than or equal to
    normal numbers.
    I hope that is true, I don't particularly enjoy looking into the MPFR
    again.


    The use of MPFR seems like overkill, since we can just do all higher
    precision (any value of p) floating point calculations using the library.

    I had been working on writing REPRESENT using the FSL big.4th library,
    with my own extensions for necessary functions which were not in the
    original. I hope to get back to that after sorting out my own needs for floating point output formats. If we have working Forth implementations
    of REPRESENT for various values of p, it provides a reference for
    efficient implementation.

    The reason dtoa() is so complex is that it was designed to demonstrate
    high efficiency compared to just simply doing big number arithmetic for
    all cases.

    --
    Krishna

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Sat Oct 17 13:37:25 2026
    From Newsgroup: comp.lang.forth

    On 16/10/2026 4:12 pm, Anton Ertl wrote:
    dxf <dxforth@gmail.com> writes:
    On 15/10/2026 4:55 pm, Anton Ertl wrote:
    dxf <dxforth@gmail.com> writes:
    On 14/10/2026 7:25 pm, Anton Ertl wrote:
    What is an "imprecise number"? In any case, every FP number has a
    precise value. It may not be the value you are interested in, but
    that does not make the value any less precise. And thinking about FP >>>>> numbers as "imprecise" or intervals etc. leads you down the path to
    wrong conclusions.

    If the recently-dubbed "high quality" REPRESENTs aren't printing out
    intervals then what are they doing? Following the leader?

    If you give a precise REPRESENT a big-enough buffer, it gives you the
    decimal representation of the floating-point value, exactly.

    It gives a decimal representation of the nearest storage slot that the
    floating-point value was assigned.

    Storage slot? Are your postings AI slop?

    Did you have a problem understanding it? I've never used AI.

    Anyway, every binary FP number can be represented exactly as decimal
    number, but some FP numbers need a large number of digits in decimal representation. Gforth's E.EXACT outputs this decimal representation,
    when based on an appropriate ecvt_r() (such as that in glibc 2.36).

    That floating-point value never had
    more than 17 useful digits.

    How many digits are useful depends on the use. In particular, if you
    want to know the exact decimal representation of an FP value, often
    more than 17 digits are necessary, and therefore, for this use,
    useful.

    There's 'uses' but you can't give any.

    The question then becomes why? Why deliberately misrepresent users?
    I'd have to fall on my head.

    More AI slop?

    Somebody sold GCC 'The Emperor's New Clothes' and now it is showing off
    its apparel. Sorry, but all I see is vanity laid bare.

    ...

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Fri Oct 16 23:37:33 2026
    From Newsgroup: comp.lang.forth

    On 10/16/26 9:37 PM, dxf wrote:
    On 16/10/2026 4:12 pm, Anton Ertl wrote:
    dxf <dxforth@gmail.com> writes:
    On 15/10/2026 4:55 pm, Anton Ertl wrote:
    dxf <dxforth@gmail.com> writes:
    On 14/10/2026 7:25 pm, Anton Ertl wrote:
    What is an "imprecise number"? In any case, every FP number has a >>>>>> precise value. It may not be the value you are interested in, but >>>>>> that does not make the value any less precise. And thinking about FP >>>>>> numbers as "imprecise" or intervals etc. leads you down the path to >>>>>> wrong conclusions.

    If the recently-dubbed "high quality" REPRESENTs aren't printing out >>>>> intervals then what are they doing? Following the leader?

    If you give a precise REPRESENT a big-enough buffer, it gives you the
    decimal representation of the floating-point value, exactly.

    It gives a decimal representation of the nearest storage slot that the
    floating-point value was assigned.

    Storage slot? Are your postings AI slop?

    Did you have a problem understanding it? I've never used AI.

    Anyway, every binary FP number can be represented exactly as decimal
    number, but some FP numbers need a large number of digits in decimal
    representation. Gforth's E.EXACT outputs this decimal representation,
    when based on an appropriate ecvt_r() (such as that in glibc 2.36).

    That floating-point value never had
    more than 17 useful digits.

    How many digits are useful depends on the use. In particular, if you
    want to know the exact decimal representation of an FP value, often
    more than 17 digits are necessary, and therefore, for this use,
    useful.

    There's 'uses' but you can't give any.


    Yes, you are clearly smarter than the entire IEEE 754 standards
    committee, which specified that a system should leave the number of
    digits requested in a binary to decimal conversion to be unbounded.

    One use case clearly shows up in this thread with Marcel's
    implementation of xdfloats.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Sat Oct 17 16:45:20 2026
    From Newsgroup: comp.lang.forth

    On 16/10/2026 2:58 pm, Krishna Myneni wrote:
    On 10/14/26 8:40 PM, dxf wrote:
    On 14/10/2026 7:25 pm, Anton Ertl wrote:
    albert@spenarnc.xs4all.nl writes:
    The illusion that you can do something precise with imprecise numbers ... >>>
    What is an "imprecise number"?-a In any case, every FP number has a
    precise value.-a It may not be the value you are interested in, but
    that does not make the value any less precise.-a And thinking about FP
    numbers as "imprecise" or intervals etc. leads you down the path to
    wrong conclusions.

    If the recently-dubbed "high quality" REPRESENTs aren't printing out
    intervals then what are they doing?-a Following the leader?


    Let's attempt to give a more precise meaning to what is meant by a "high quality" REPRESENT using the IEEE 754 standard as a guide. There are several possibilities. First, some definitions from the IEEE 754 standard, and then some possible meanings when we say "high quality".

    I. Definitions:

    P_min = minimum of number of decimal digits needed, with round to nearest, for conversion from internal normalized binary representation to decimal output for the significand, which, when converted back to binary form gives the same binary significand:

    P_min( p ) = 1 + ceiling(p*log_10(2)); p is the number of significant bits (both actual and implied) of the significand in the binary format.

    If a Forth system supports multiple binary formats, define

    M = max{P_min(p_i)} where i indexes the binary format

    Example: For a Forth system supports both single-precision and double-precision IEEE binary formats,

    M = max{ P_min(24), P_min(53) } = max{ 9, 17 } = 17

    II. Possible meanings of "high quality" REPRESENT

    There are 3 sensible choices, in my opinion:

    II.1) On a given Forth system, REPRESENT will output, with rounding to nearest a minimum of digits, M, given by maximum of P_min for all supported binary formats.

    For example, if a Forth system supports nothing above binary double precision (binary64), it should be capable of providing M = 17 significant decimal digits, with round to nearest.


    II.2) Follow the IEEE 754 standard and specify that the Forth system has "an implementation-defined limit on the number of significant digits that can be converted with correct rounding to and from supported binary formats. That limit, H, shall be such that H reN M + 3 and it should be that H is unbounded."

    Then, the minimum number of significant digits for a system which supports nothing higher than binary64, it should provide at least H = 20 significant digits in any specified rounding mode.

    Note that the IEEE 754 standard goes to pains to specify there is no upper bound on H, only a lower bound.

    II.3) Provide H significant decimal digits to support most *fixed length* binary formats currently in use, whether they are internally supported by the Forth system or supported via source code. Some fixed length binary formats currently in use are:

    extended precision (p = 64 bits)
    double double precision (p = 106 bits)
    quad precision (p = 113 bits)
    double extended precision (p = 128 bits)
    double quad precision (p = 226 bits)

    Then M = 70, and H >= 73 significant digits.


    Of the three choices above, II.1 or II.2 is probably what smaller systems would choose: M = 17 or H = H_min = 20 significant digits. If they want to provide double double precision, then II.2 would be a better choice (H = H_min = 36 significant digits).

    Systems with less memory constraints should choose II.3.

    When Intel developed the 8087 it was with IEEE double-precision in mind. There's little doubt its the reason they chose an internal representation
    of 80 bits to handle at least some of IEEE's arithmetic and conversion requirements. For me - and perhaps other x87 users - the REPRESENT I can
    build using basic x87 instructions is "high quality" enough.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Sat Oct 17 20:11:52 2026
    From Newsgroup: comp.lang.forth

    On 17/10/2026 3:37 pm, Krishna Myneni wrote:
    On 10/16/26 9:37 PM, dxf wrote:
    On 16/10/2026 4:12 pm, Anton Ertl wrote:
    dxf <dxforth@gmail.com> writes:
    On 15/10/2026 4:55 pm, Anton Ertl wrote:
    dxf <dxforth@gmail.com> writes:
    On 14/10/2026 7:25 pm, Anton Ertl wrote:
    What is an "imprecise number"?-a In any case, every FP number has a >>>>>>> precise value.-a It may not be the value you are interested in, but >>>>>>> that does not make the value any less precise.-a And thinking about FP >>>>>>> numbers as "imprecise" or intervals etc. leads you down the path to >>>>>>> wrong conclusions.

    If the recently-dubbed "high quality" REPRESENTs aren't printing out >>>>>> intervals then what are they doing?-a Following the leader?

    If you give a precise REPRESENT a big-enough buffer, it gives you the >>>>> decimal representation of the floating-point value, exactly.

    It gives a decimal representation of the nearest storage slot that the >>>> floating-point value was assigned.

    Storage slot?-a Are your postings AI slop?

    Did you have a problem understanding it?-a I've never used AI.
    -a
    Anyway, every binary FP number can be represented exactly as decimal
    number, but some FP numbers need a large number of digits in decimal
    representation.-a Gforth's E.EXACT outputs this decimal representation,
    when based on an appropriate ecvt_r() (such as that in glibc 2.36).

    That floating-point value never had
    more than 17 useful digits.

    How many digits are useful depends on the use.-a In particular, if you
    want to know the exact decimal representation of an FP value, often
    more than 17 digits are necessary, and therefore, for this use,
    useful.

    There's 'uses' but you can't give any.


    Yes, you are clearly smarter than the entire IEEE 754 standards committee,

    I wouldn't know about that but I can think for myself. I see no reason to delegate my thinking to another. It doesn't matter how 'smart' they are.
    But if that's what I think and I follow, I become a second-hand person, dependent upon another.

    which specified that a system should leave the number of digits requested in a binary to decimal conversion to be unbounded.

    One use case clearly shows up in this thread with Marcel's implementation of xdfloats.

    Can't make head or tail of that.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From albert@albert@spenarnc.xs4all.nl to comp.lang.forth on Sat Oct 17 12:55:16 2026
    From Newsgroup: comp.lang.forth

    In article <2026Oct16.174024@mips.complang.tuwien.ac.at>,
    Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
    albert@spenarnc.xs4all.nl writes:
    A fp number represents a rational range, it nominal value plus or minus >>half an ulp.

    What makes you think that the result of

    3 s>f

    or

    s" 3e" >float drop

    represents a range? This value can be represented exactly as FP
    value, there is no rounding happening in this conversion.

    And why should it represent the range

    2.9999999999999997779553950749686919152736663818359375e to >3.0000000000000002220446049250313080847263336181640625e

    in particular?

    Further, when we perform

    6 s>f 3 s>f f-

    why should the results of the individual conversions (none of which
    performs rounding) represent ranges? Why should the result of the >subtraction (which does not perform any rounding, either, and does not
    set the "inexact" flag in the FPU) represent a range.

    But even if we assume that the results of the conversions are ranges,
    why should the result of the subtraction be the interval above,
    instead of the interval that interval arithmetic would give, which is
    a range that is 3 times bigger in this case (2 times, because the
    interval you claim for 6 is twice as big as that for 3, and 1 time due
    to the interval of 3).

    As mentioned, thinking about FP numbers as "imprecise" or intervals
    etc. leads you down the path to wrong conclusions.

    A better way to think about them is: Each FP number has an exact
    value, but in some cases conversions to FP and FP operations round,
    because there is no FP value for the exact result; this rounding leads
    to errors. The size of this error is the subject of numerical
    analysis.

    Exactly
    0.0001E0 DUP FSIN F-
    looses a whole lot of precision.
    Maybe "imprecise numbers" is not a bad name after all.
    I aim for psychological impact.

    - anton
    --
    The Chinese government is satisfied with its military superiority over USA.
    The next 5 year plan has as primary goal to advance life expectancy
    over 80 years, like Western Europe.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Sat Oct 17 07:44:28 2026
    From Newsgroup: comp.lang.forth

    On 10/17/26 4:11 AM, dxf wrote:
    On 17/10/2026 3:37 pm, Krishna Myneni wrote:
    ...

    One use case clearly shows up in this thread with Marcel's implementation of xdfloats.

    Can't make head or tail of that.


    Taking the position that anything you don't understand at first glance, without effort, works for you, ok. But it may not be an indication that
    there is a conspiracy of mathematicians and computer scientists.

    --
    KM

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Sat Oct 17 17:36:28 2026
    From Newsgroup: comp.lang.forth

    On 10/17/2026 12:55 PM, albert@spenarnc.xs4all.nl wrote:
    In article <2026Oct16.174024@mips.complang.tuwien.ac.at>,
    Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
    albert@spenarnc.xs4all.nl writes:

    Exactly
    0.0001E0 DUP FSIN F-
    looses a whole lot of precision.
    Maybe "imprecise numbers" is not a bad name after all.
    I aim for psychological impact.
    I think you meant (done with xopg, mpfr, mpc):

    FORTH> LET sin(0.0001e):
    .print 9.9999999833333333416666666646825396828152e-0005 ok
    FORTH> S" 0.0001e" >XD XDSIN
    XDFE. 9.99999998333333334166666666468253968286e-5 ok
    FORTH> 0.0001e FSIN
    +e. 9.9999999833333333426e-0005 ok
    FORTH> LET sin(0.1001e):
    .print 9.9932916564023038037792141684528699818587e-0002 ok
    FORTH> S" 0.1001e" >XD XDSIN
    XDFE. 9.99329165640230380377921416845286998177e-2 ok
    FORTH> 0.1001e FSIN
    +e. 9.9932916564023038040e-0002 ok

    ... although this is most probably due to improper range reduction.

    The target (non-AI) audience knows what they are doing, so why not
    give them the best possible tools?

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From albert@albert@spenarnc.xs4all.nl to comp.lang.forth on Sat Oct 17 19:32:05 2026
    From Newsgroup: comp.lang.forth

    In article <11b04lt$1vpog$1@dont-email.me>, marcel hendrix <mhx@iae.nl> wrote: >On 10/17/2026 12:55 PM, albert@spenarnc.xs4all.nl wrote:
    In article <2026Oct16.174024@mips.complang.tuwien.ac.at>,
    Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
    albert@spenarnc.xs4all.nl writes:

    Exactly
    0.0001E0 DUP FSIN F-
    looses a whole lot of precision.
    Maybe "imprecise numbers" is not a bad name after all.
    I aim for psychological impact.
    I think you meant (done with xopg, mpfr, mpc):

    FORTH> LET sin(0.0001e):
    .print 9.9999999833333333416666666646825396828152e-0005 ok
    FORTH> S" 0.0001e" >XD XDSIN
    XDFE. 9.99999998333333334166666666468253968286e-5 ok
    FORTH> 0.0001e FSIN
    +e. 9.9999999833333333426e-0005 ok
    FORTH> LET sin(0.1001e):
    .print 9.9932916564023038037792141684528699818587e-0002 ok
    FORTH> S" 0.1001e" >XD XDSIN
    XDFE. 9.99329165640230380377921416845286998177e-2 ok
    FORTH> 0.1001e FSIN
    +e. 9.9932916564023038040e-0002 ok

    ... although this is most probably due to improper range reduction.

    Seriously? This is abc of computer science. You loose precision if
    you subtract numbers of equal size that cannot be exactly represented
    in your system.

    The target (non-AI) audience knows what they are doing, so why not
    give them the best possible tools?

    I gave them the best possible impression. Be aware that these numbers
    are imprecise.


    -marcel
    --
    The Chinese government is satisfied with its military superiority over USA.
    The next 5 year plan has as primary goal to advance life expectancy
    over 80 years, like Western Europe.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Sat Oct 17 19:44:34 2026
    From Newsgroup: comp.lang.forth

    On 10/16/2026 9:55 PM, marcel hendrix wrote:
    [..]

    But why want QD, QX or QD when the mpfr gives arbitrary precision on its own? The charm of QD is that is very small and simple, while MPFR is a beast. It could be that it is much faster than QD/QX and QD though.
    Maybe some tests could be done first.
    As MPFR and MPC again work in iForth (inside XOPG), I did the testing.

    LET sin(PI/16): GVAL x

    #100000 value #iters
    : TEST1 CR TIMER-RESET #iters 0 ?do LET sin(x): LOOP
    .ELAPSED ;

    : TEST2 CR TIMER-RESET #iters 0 ?do xd=pi/16 xdsin xddrop LOOP
    .ELAPSED ;

    : BENCH #100000 TO #iters
    TEST1
    TEST2 ;

    FORTH> BENCH
    0.826 seconds elapsed.
    0.095 seconds elapsed. ok

    The mpfr library is about 8 times faster than the XD-FP Forth library
    based on the ideas of Julian V. Noble, Seppo Linnainmaa, and David H.
    Bailey. As my mpfr .so is from 2012, I guess it will be even more
    dramatic with a modern binary. Still, a few xd-fp words might find a
    permanent place in the iForth kernel.

    -marcel

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Sun Oct 18 06:15:01 2026
    From Newsgroup: comp.lang.forth

    albert@spenarnc.xs4all.nl writes:
    In article <2026Oct16.174024@mips.complang.tuwien.ac.at>,
    Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
    A better way to think about them is: Each FP number has an exact
    value, but in some cases conversions to FP and FP operations round,
    because there is no FP value for the exact result; this rounding leads
    to errors. The size of this error is the subject of numerical
    analysis.

    Exactly
    0.0001E0 DUP FSIN F-

    I assume you mean FDUP here.

    looses a whole lot of precision.
    Maybe "imprecise numbers" is not a bad name after all.

    It is. It's not the numbers that are imprecise, it's the operations.
    They round (but not in every case).

    In the present case the conversion from the decimal string to the FP
    number rounds (but that makes little difference for what follows), and
    FSIN rounds. F- does not round in this case, but the absolute error
    from the FSIN rounding is still present in the result and is
    relatively larger compared to the result, so the number of significant
    digits is smaller; this phenomenon is called cancellation.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Sun Oct 18 09:40:08 2026
    From Newsgroup: comp.lang.forth

    dxf <dxforth@gmail.com> writes:
    When Intel developed the 8087 it was with IEEE double-precision in mind. >There's little doubt its the reason they chose an internal representation
    of 80 bits to handle at least some of IEEE's arithmetic and conversion >requirements.

    Citation needed. Several things make this very unlikely:


    *) The recounts of the development of the 8087 and IEEE 754 I have
    read do not provide support for such claims. On the contrary, the
    idea behind the 8087 is reported to be "the best", and everything I
    read from Kahan about 80-bit formats is along the lines of them
    being being better than IEEE 754 DP format, and he deplores that
    they are not more widely available. E.g.: "But the Macintosh based
    on the 68000 gave way to the PowerPC, whose arithmetic is
    inferior." [1]

    [1] 8087: http://web.archive.org/web/20190301193516/http://www.drdobbs.com/architecture-and-design/a-conversation-with-william-kahan/184410314

    BTW, this article was written by Jack Woehr, the author of JaxForth
    and Forth: The New Model.

    [2] IEEE 754: https://people.eecs.berkeley.edu/~wkahan/ieee754status/754story.html

    *) The 8087 project was started before IEEE 754 and launched in 1980,
    IEEE 754 was released in 1985. And in particular, it took at least
    until 1981 to decide between K-C-S (what eventually became IEEE
    754) and VAX F/G FP formats [2].

    *) The 8087 and none of its successors imlements the IEEE 754
    double-precision operations fully. Even with the 53-bit mode for
    the mantissa, the longer exponent means that there are cases where
    the result differs from that of binary64. [That was a sore point
    for Java's write-once-run-anywhere promise until they started to
    rely on SSE2 on AMD64 processors.]

    *) The 80-bit format is not just an internal representation. It's
    exposed to software, and software makes use of it. By contrast,
    many FPUs tend to have three extra bits that are not exposed to the
    users, and which you only see indirectly. E.g., SSE2 has
    instructions MOVUPD, MOVUPS, and MOVDQU, which all do the same
    thing (take a look at the "Operation" description), but may differ
    in how they set up the internal representation, so if you follow a
    load performed with MOVUPS by a MULPD working on the loaded
    register, you may see a slowdown compared to using MOVUPD for the
    load, because the extra bits have to be generated first, before
    performing the actual work of the MULPD.

    *) Lots of other architectures target IEEE double-precision without
    implementing 80-bit FP, much less providing it to users.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hans Bezemer@the.beez.speaks@gmail.com to comp.lang.forth on Sun Oct 18 14:10:11 2026
    From Newsgroup: comp.lang.forth

    On 17-10-2026 06:37, Krishna Myneni wrote:
    Yes, you are clearly smarter than the entire IEEE 754 standards
    committee, which specified that a system should leave the number of
    digits requested in a binary to decimal conversion to be unbounded.

    Err. Not quite. IEEE 754-2008 permits an implementation-defined limit H, provided it meets the standard's minimum requirements. It recommends
    that H be unbounded, but doesn't make an unbounded limit mandatory for binary-format conversions.

    Small correction ;-) It's the difference between "shall" and "should".
    In technical specifications, ISO standards, and quality management
    systems, shall and should have distinct, legally binding meanings:

    * Shall: Indicates a strict, mandatory requirement with zero deviation tolerance. You must comply with it to achieve certification or legal/regulatory compliance.

    * Should: Indicates a recommendation, guideline, or preferred goal. It
    is not mandatory, and noncompliance is permitted if you have valid
    reasons and weigh the implications.

    BTW, AFAIK there isn't a single reference to the IEEE 754-2008 standard
    in even Forth-2012. I quote: "A single- or double-precision
    floating-point number as defined in ANSI/IEEE 754-1985."

    Furthermore, the standard states: "12.3.1.2 Floating-point numbers; The internal representation of a floating-point number, including the format
    and precision of the significand and the format and range of the
    exponent, is implementation defined. Any rounding or truncation of floating-point numbers is implementation defined."

    I.e. a floating point number doesn't have to be any IEEE 754 format.
    Under the ANS standard my ZEN and Eckert FP are still considered
    "floating point numbers". (Yes, ZEN is no longer considered to be
    compliant FP format under Forth-2012, I know).

    That also means that the requirements of the IEEE 754 committee are moot
    to me (well, honestly so are the requirements of the Forth-2012
    committee to me, but that's another story ;-)

    Hans Bezemer
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From albert@albert@spenarnc.xs4all.nl to comp.lang.forth on Sun Oct 18 14:47:10 2026
    From Newsgroup: comp.lang.forth

    In article <2026Oct18.081501@mips.complang.tuwien.ac.at>,
    Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
    albert@spenarnc.xs4all.nl writes:
    In article <2026Oct16.174024@mips.complang.tuwien.ac.at>,
    Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
    A better way to think about them is: Each FP number has an exact
    value, but in some cases conversions to FP and FP operations round, >>>because there is no FP value for the exact result; this rounding leads
    to errors. The size of this error is the subject of numerical
    analysis.

    Exactly
    0.0001E0 DUP FSIN F-

    I assume you mean FDUP here.
    Good catch.


    looses a whole lot of precision.
    Maybe "imprecise numbers" is not a bad name after all.

    It is. It's not the numbers that are imprecise, it's the operations.
    They round (but not in every case).

    F- generates the exact result of the number that is supposed
    to represent 0.001 (maybe imprecisely) and the number that
    represents sin(0.001) imprecisely. The latter is bound to be imprecise
    because sin(0.001) is transcendental, so irrational.

    So F- is not to blame that the result is imprecise.
    : thou 0.001E0 ; OK
    HEX OK
    thou FS.
    4.189374BC6A7EC00000_-3 OK
    thou FSIN FS.
    4.18936948629841A800_-3 OK
    OK
    thou FSIN thou F- FDUP FS.
    -B.7407E67E5800000000_-9 OK

    Now it can be demonstrated by adding the thou back to the result,
    that F- doesn't introduce loss of precision.
    thou F+ FDUP FS.
    4.18936948629841A800_-3 OK
    thou FSIN FS.
    4.18936948629841A800_-3 OK

    Summary F- is working with precision on imprecise numbers.

    In the present case the conversion from the decimal string to the FP
    number rounds (but that makes little difference for what follows), and
    FSIN rounds. F- does not round in this case, but the absolute error
    from the FSIN rounding is still present in the result and is
    relatively larger compared to the result, so the number of significant
    digits is smaller; this phenomenon is called cancellation.

    FSIN doesn't round. It is not magically bound to the math sine function.
    It is defined as an operation that returns a rational number that
    is close within x ULP to the mathematical sine function.

    More succinctly: the sine function is beholden to be represented
    by an imprecise number. All operation results with imprecise numbers
    should be regarded with suspicion.



    - anton

    Groetjes Albert
    --
    The Chinese government is satisfied with its military superiority over USA.
    The next 5 year plan has as primary goal to advance life expectancy
    over 80 years, like Western Europe.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Mon Oct 19 01:52:17 2026
    From Newsgroup: comp.lang.forth

    On 17/10/2026 11:44 pm, Krishna Myneni wrote:
    On 10/17/26 4:11 AM, dxf wrote:
    On 17/10/2026 3:37 pm, Krishna Myneni wrote:
    ...

    One use case clearly shows up in this thread with Marcel's implementation of xdfloats.

    Can't make head or tail of that.


    Taking the position that anything you don't understand at first glance, without effort, works for you, ok.

    "One use case clearly shows up" - but you can't state what it is and I'm supposed to glean it from reading a thread?

    But it may not be an indication that there is a conspiracy of mathematicians and computer scientists.

    For my part I've clearly shown an alternate REPRESENT results in shorter application code - shorter than anyone using a 'standard' REPRESENT has
    been able to achieve. As one of the 'mathematicians and computer scientists' on the Forth committee, what has been your expert response to that? I can
    tell you. You didn't want to know about it.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Sun Oct 18 10:08:13 2026
    From Newsgroup: comp.lang.forth

    On 10/18/26 7:10 AM, Hans Bezemer wrote:
    On 17-10-2026 06:37, Krishna Myneni wrote:
    Yes, you are clearly smarter than the entire IEEE 754 standards
    committee, which specified that a system should leave the number of
    digits requested in a binary to decimal conversion to be unbounded.

    Err. Not quite. IEEE 754-2008 permits an implementation-defined limit H, provided it meets the standard's minimum requirements. It recommends
    that H be unbounded, but doesn't make an unbounded limit mandatory for binary-format conversions.

    Small correction ;-) It's the difference between "shall" and "should".
    In technical specifications, ISO standards, and quality management
    systems, shall and should have distinct, legally binding meanings:


    Yes, I know what "should" means. There is no claim for legal binding,
    and my suggested meanings for "high quality REPRESENT" allow for H to be
    set to a fixed value.

    --
    KM

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Paul Rubin@no.email@nospam.invalid to comp.lang.forth on Sun Oct 18 15:00:28 2026
    From Newsgroup: comp.lang.forth

    albert@spenarnc.xs4all.nl writes:
    Maybe "imprecise numbers" is not a bad name after all.
    I aim for psychological impact.

    In math it's preferable to aim for mathematical correctness.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Paul Rubin@no.email@nospam.invalid to comp.lang.forth on Sun Oct 18 15:10:26 2026
    From Newsgroup: comp.lang.forth

    marcel hendrix <mhx@iae.nl> writes:
    Which implies H >= 83 for quad double extended precision,

    Extended precision = 80 bit numbers? So double extended = 160 bits, and
    quad double extended = 640 bits? Do you mean double quad extended which
    would be 320 bits? I think for all of these, anything above 256 bits
    and maybe anything above 128 bits, you probably want some MPFR-like
    arbitrary precision.

    80 bit extended is looking like an x86 artifact by now, maybe. I wonder
    if anything implements 128 bit extended. There's a spec for it in
    RISC-V but no implementations that I know of.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Mon Oct 19 00:45:59 2026
    From Newsgroup: comp.lang.forth

    On 10/19/2026 12:10 AM, Paul Rubin wrote:
    marcel hendrix <mhx@iae.nl> writes:
    Which implies H >= 83 for quad double extended precision,

    Extended precision = 80 bit numbers? So double extended = 160 bits, and
    quad double extended = 640 bits? Do you mean double quad extended which would be 320 bits?

    No, extended double is an IEEE format that, e.g., matches the Intel
    FPU's 10 byte memory storage and has a mantissa of 64 bits. With 2 * 64
    bits the mantissa of a double extended double becomes 128 bits, and a
    quad extended double will have a 256 bit mantissa. The extended variants appear not to exist (or are not very common), I have found no references
    for them yet (outside of the mainframe area). Double extended double is
    now working, but I have not looked at quad extended double yet.

    With the old Motorola 96-bit format one could have had 80 and 160 bit mantissas, and then quad Motorola double would indeed be 320 bits.

    I think for all of these, anything above 256 bits
    and maybe anything above 128 bits, you probably want some MPFR-like
    arbitrary precision.

    MPFR is definitely much faster.

    80 bit extended is looking like an x86 artifact by now, maybe. I wonder
    if anything implements 128 bit extended. There's a spec for it in
    RISC-V but no implementations that I know of.

    Given that the MPFR is 8 times faster than (my) double extended double,
    an FPU with > 80 bits probably can't compete on speed, although it might
    save memory. The MPFR is much too large if you only need a few functions
    for large decimal input and output strings. The xd-fp library, with a
    full set of math functions, is only 800 lines of Forth including comments.

    -marcel

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Mon Oct 19 17:45:19 2026
    From Newsgroup: comp.lang.forth

    On 19/10/2026 9:10 am, Paul Rubin wrote:
    ...
    80 bit extended is looking like an x86 artifact by now, maybe.

    As there's still much crowing about 64 bit, extended would fulfil
    most people's needs. The issue is hardware support. If it wasn't
    for the x87 largely-complete-fp-on-a-chip just waiting for me to
    access it, I'd have stayed with simple s/w fp. I'm speaking of
    course as an implementer - which is a dying breed.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Paul Rubin@no.email@nospam.invalid to comp.lang.forth on Mon Oct 19 19:55:35 2026
    From Newsgroup: comp.lang.forth

    marcel hendrix <mhx@iae.nl> writes:
    Which implies H >= 83 for quad double extended precision, ...
    No, extended double is an IEEE format that, e.g., matches the Intel
    FPU's 10 byte memory storage and has a mantissa of 64 bits.

    Ah ok, that's what I meant by 80 bit number, because of the other 16
    bits (sign and exponent).

    a quad extended double will have a 256 bit mantissa.

    Nice, what is the memory representation?

    MPFR is definitely much faster.

    MPFR is probably slower than machine coded fixed precision such as
    double extended double or whatever.

    The xd-fp library, with a full set of math functions, is only 800
    lines of Forth including comments.

    That's pretty good, I thought carefully done math functions could be
    messy.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Tue Oct 20 08:52:21 2026
    From Newsgroup: comp.lang.forth

    On 10/20/2026 4:55 AM, Paul Rubin wrote:
    Nice, what is the memory representation?

    They look like an array of 4 extended doubles, and in fact, they are.
    The trick is that *sum* of these four normal 64 bit floats is precisely
    equal to a single float with a 4*64 = 256 bit mantissa. This is done by manipulating the exponents. See "Software for Doubled-Precision
    Floating-Point Computations", Seppo Linnainmaa, ACM Transactions on Mathematical Software, Vol 7, No 3, September 1981, Pages 272-283.

    The xd-fp library, with a full set of math functions, is only 800
    lines of Forth including comments.

    That's pretty good, I thought carefully done math functions could be
    messy.

    The float library is based on David H. Bailey's paper and is very
    concise. I used only the paper, but there are special issues with
    specifying constants and literals that I originally ignored, see a few
    other threads here. Looking at the (bulky) C, source helped a little: https://github.com/greggroth/im_learning_cpp/blob/master/comp_programing_exam_solution/qd-2.3.12/src


    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hans Bezemer@the.beez.speaks@gmail.com to comp.lang.forth on Sun Oct 25 15:05:15 2026
    From Newsgroup: comp.lang.forth

    On 18-10-2026 17:08, Krishna Myneni wrote:
    On 10/18/26 7:10 AM, Hans Bezemer wrote:
    On 17-10-2026 06:37, Krishna Myneni wrote:
    Yes, you are clearly smarter than the entire IEEE 754 standards
    committee, which specified that a system should leave the number of
    digits requested in a binary to decimal conversion to be unbounded.

    Err. Not quite. IEEE 754-2008 permits an implementation-defined limit
    H, provided it meets the standard's minimum requirements. It
    recommends that H be unbounded, but doesn't make an unbounded limit
    mandatory for binary-format conversions.

    Small correction ;-) It's the difference between "shall" and "should".
    In technical specifications, ISO standards, and quality management
    systems, shall and should have distinct, legally binding meanings:


    Yes, I know what "should" means. There is no claim for legal binding,
    and my suggested meanings for "high quality REPRESENT" allow for H to be
    set to a fixed value.

    Well, let's see your exact quote here:
    "Yes, you are clearly smarter than the entire IEEE 754 standards
    committee" What has that got to do with anything? I thought we were
    talking arguments here -- not taking IQ tests.

    "which specified that a system should leave the number of digits
    requested in a binary to decimal conversion to be unbounded." Actually
    -- it didn't, as I've proven beyond a reasonable doubt. That means you
    were wrong -- and making more than one claim that wasn't supported on
    any standard.

    I advise you to do your home work properly before publicly stating that
    a commenter is stupid and ignorant. If you wanna play lazy, be my guest.
    But watch your mouth.

    Hans Bezemer
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Mon Oct 26 15:05:18 2026
    From Newsgroup: comp.lang.forth

    On 10/25/26 9:05 AM, Hans Bezemer wrote:
    On 18-10-2026 17:08, Krishna Myneni wrote:
    On 10/18/26 7:10 AM, Hans Bezemer wrote:
    On 17-10-2026 06:37, Krishna Myneni wrote:
    Yes, you are clearly smarter than the entire IEEE 754 standards
    committee, which specified that a system should leave the number of
    digits requested in a binary to decimal conversion to be unbounded.

    Err. Not quite. IEEE 754-2008 permits an implementation-defined limit
    H, provided it meets the standard's minimum requirements. It
    recommends that H be unbounded, but doesn't make an unbounded limit
    mandatory for binary-format conversions.

    Small correction ;-) It's the difference between "shall" and
    "should". In technical specifications, ISO standards, and quality
    management systems, shall and should have distinct, legally binding
    meanings:


    Yes, I know what "should" means. There is no claim for legal binding,
    and my suggested meanings for "high quality REPRESENT" allow for H to
    be set to a fixed value.


    "which specified that a system should leave the number of digits
    requested in a binary to decimal conversion to be unbounded." Actually
    -- it didn't, as I've proven beyond a reasonable doubt. That means you
    were wrong -- and making more than one claim that wasn't supported on
    any standard.

    I advise you to do your home work properly before publicly stating that
    a commenter is stupid and ignorant. If you wanna play lazy, be my guest.
    ...

    Perhaps you *should* actually read the IEEE 754 standard before making
    your claim that I misrepresented it. My emphasis below.

    "There might be an implementation-defined limit on the number of
    significant digits that can be converted with correct rounding to and
    from supported binary formats. That limit, H, shall be such that H reN M +
    3 and *it should be that H is unbounded.*"

    --
    KM



    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Mon Oct 26 16:24:38 2026
    From Newsgroup: comp.lang.forth

    On 10/26/26 3:05 PM, Krishna Myneni wrote:
    On 10/25/26 9:05 AM, Hans Bezemer wrote:
    On 18-10-2026 17:08, Krishna Myneni wrote:
    On 10/18/26 7:10 AM, Hans Bezemer wrote:
    On 17-10-2026 06:37, Krishna Myneni wrote:
    Yes, you are clearly smarter than the entire IEEE 754 standards
    committee, ...

    As far as that comment is concerned, yes, it was a bit of sarcasm, in
    response to claims by a poster that everyone else except him was
    operating in some thought bubble concerning binary to decimal floating
    point conversion.

    I don't believe I am smarter than the IEEE 754 committee, which is why I
    made the effort to read the standard and try to understand what it says.

    For those concerned, I'm not interesting in getting into fights with
    people on the internet, and I will block idiots who are looking for a fight.

    --
    Krishna Myneni





    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hans Bezemer@the.beez.speaks@gmail.com to comp.lang.forth on Tue Oct 27 11:02:54 2026
    From Newsgroup: comp.lang.forth

    On 26-10-2026 22:24, Krishna Myneni wrote:
    As far as that comment is concerned, yes, it was a bit of sarcasm, in response to claims by a poster that everyone else except him was
    operating in some thought bubble concerning binary to decimal floating
    point conversion.
    I don't think that "insulting" fits my definition of "sarcasm".

    I don't believe I am smarter than the IEEE 754 committee, which is why I made the effort to read the standard and try to understand what it says.
    Strange. I've always considered the strength of an argument -- instead
    of committing the eternal sin of the logical fallacy "call to authority".

    For those concerned, I'm not interesting in getting into fights with
    people on the internet, and I will block idiots who are looking for a
    fight.
    Oh. So I supposed you blocked yourself -- by calling others stupid and ignorant. Because -- that sounds like a clear invitation for a prolonged verbal disagreement. And I haven't seen an apology yet..

    But -- if this should be a covert threat towards me -- see how much I
    care :-) But remember, I can post all kinds of stuff to your posts, and
    you'll never know why people are laughing at you!

    Hans Bezemer

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hans Bezemer@the.beez.speaks@gmail.com to comp.lang.forth on Tue Oct 27 11:05:07 2026
    From Newsgroup: comp.lang.forth

    On 26-10-2026 21:05, Krishna Myneni wrote:
    That limit, H, shall be such that H reN M + > 3 and *it should be that H is unbounded.*"

    You still have no idea what SHOULD means, do you?

    Hans Bezemer

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Tue Oct 27 11:59:05 2026
    From Newsgroup: comp.lang.forth

    On 10/27/2026 11:02 AM, Hans Bezemer wrote:
    [..]
    But -- if this should be a covert threat towards me -- see how much I
    care :-) But remember, I can post all kinds of stuff to your posts, and you'll never know why people are laughing at you!

    You're way out of line.

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Wed Oct 28 14:40:29 2026
    From Newsgroup: comp.lang.forth

    On 27/10/2026 8:24 am, Krishna Myneni wrote:
    On 10/26/26 3:05 PM, Krishna Myneni wrote:
    On 10/25/26 9:05 AM, Hans Bezemer wrote:
    On 18-10-2026 17:08, Krishna Myneni wrote:
    On 10/18/26 7:10 AM, Hans Bezemer wrote:
    On 17-10-2026 06:37, Krishna Myneni wrote:
    Yes, you are clearly smarter than the entire IEEE 754 standards
    committee, ...

    As far as that comment is concerned, yes, it was a bit of sarcasm, in response to claims by a poster that everyone else except him was operating in some thought bubble concerning binary to decimal floating point conversion.

    I don't believe I am smarter than the IEEE 754 committee, which is why I made the effort to read the standard and try to understand what it says.
    ...

    The standard says different things depending upon which version one reads.

    But first a comment on standards and the committees that create them. Standards
    are a convention on practice as decided by people. Standards don't represent 'truth', 'the science', or necessarily even facts. Short of legislation, there's
    no reason to accept a standard. Concerning the 'smart' people on committees, their position is less flexible. They have exactly two options: go along with what the rest of the committee contends - or get out. For a committee member to vote against consensus, against ratification, is tantamount to resignation. Committees have no use for members that won't conform. For this reason I'm generally more interested in what individuals, critics, have to say about standards.

    Back to IEEE-754. There seems quite a difference between the 1985 and 2008 versions. AFAICT the former gives no meaning to mantissa digits greater than 17 in the case of double precision. It's a problem for those who relied on 'smart' people to think for them because now they're presented with different standards, different committees, different thinking.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Krishna Myneni@krishna.myneni@ccreweb.org to comp.lang.forth on Wed Oct 28 06:45:04 2026
    From Newsgroup: comp.lang.forth

    On 10/27/26 10:40 PM, dxf wrote:
    ...

    I don't believe I am smarter than the IEEE 754 committee, which is why I made the effort to read the standard and try to understand what it says.
    ...

    The standard says different things depending upon which version one reads.

    ...
    Back to IEEE-754. There seems quite a difference between the 1985 and 2008 versions. AFAICT the former gives no meaning to mantissa digits greater than 17 in the case of double precision. It's a problem for those who relied on 'smart' people to think for them because now they're presented with different standards, different committees, different thinking.


    You are still compliant with the standard if you support 17 digit input
    and output *and* use only round to nearest, despite the updated
    recommendation that the number of decimal digits be unbounded. There is backwards compatibility in the standard.

    --
    KM

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hans Bezemer@the.beez.speaks@gmail.com to comp.lang.forth on Wed Oct 28 19:54:57 2026
    From Newsgroup: comp.lang.forth

    On 27-10-2026 11:59, marcel hendrix wrote:
    On 10/27/2026 11:02 AM, Hans Bezemer wrote:
    [..]
    But -- if this should be a covert threat towards me -- see how much I
    care :-) But remember, I can post all kinds of stuff to your posts,
    and you'll never know why people are laughing at you!

    You're way out of line.

    I always call out threats. Period. Either do it -- or shut up.

    Hans Bezemer

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Thu Oct 29 13:33:19 2026
    From Newsgroup: comp.lang.forth

    On 28/10/2026 10:45 pm, Krishna Myneni wrote:
    On 10/27/26 10:40 PM, dxf wrote:
    ...

    I don't believe I am smarter than the IEEE 754 committee, which is why I made the effort to read the standard and try to understand what it says.
    ...

    The standard says different things depending upon which version one reads. >>
    ...
    Back to IEEE-754.-a There seems quite a difference between the 1985 and 2008 >> versions.-a AFAICT the former gives no meaning to mantissa digits greater than
    17 in the case of double precision.-a It's a problem for those who relied on >> 'smart' people to think for them because now they're presented with different
    standards, different committees, different thinking.


    You are still compliant with the standard if you support 17 digit input and output *and* use only round to nearest, despite the updated recommendation that the number of decimal digits be unbounded. There is backwards compatibility in the standard.

    Compliance is the last thing. Rationale comes first. I believe the rationale behind the 1985 requirement (even if not expressly stated) was extracting the last
    bit of usable data, cost not considered. Has IEEE-754 2008 posted a rationale for
    their extension? Because nothing I've seen posted here suggests a benefit - quite
    the opposite.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Thu Oct 29 20:01:02 2026
    From Newsgroup: comp.lang.forth

    On 29/10/2026 1:33 pm, dxf wrote:
    On 28/10/2026 10:45 pm, Krishna Myneni wrote:
    On 10/27/26 10:40 PM, dxf wrote:
    ...

    I don't believe I am smarter than the IEEE 754 committee, which is why I made the effort to read the standard and try to understand what it says.
    ...

    The standard says different things depending upon which version one reads. >>>
    ...
    Back to IEEE-754.-a There seems quite a difference between the 1985 and 2008
    versions.-a AFAICT the former gives no meaning to mantissa digits greater than
    17 in the case of double precision.-a It's a problem for those who relied on
    'smart' people to think for them because now they're presented with different
    standards, different committees, different thinking.


    You are still compliant with the standard if you support 17 digit input and output *and* use only round to nearest, despite the updated recommendation that the number of decimal digits be unbounded. There is backwards compatibility in the standard.

    Compliance is the last thing. Rationale comes first. I believe the rationale
    behind the 1985 requirement (even if not expressly stated) was extracting the last
    bit of usable data, cost not considered. Has IEEE-754 2008 posted a rationale for
    their extension? Because nothing I've seen posted here suggests a benefit - quite
    the opposite.

    Reading 5.12.2 again it's not clear to me that the standard is entitling anyone to
    print more than 17 significant digits in the case of binary64. Rather it lets the
    implementer specify a limit on number of digits for conversion. I've used forths
    where entering more than 20 digits makes them go haywire.

    As previously mentioned it makes no sense that one can output more significant digits
    than one can input - in anyone's universe. Whatever GCC is printing - it's not what
    the user entered.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Thu Oct 29 09:18:53 2026
    From Newsgroup: comp.lang.forth

    dxf <dxforth@gmail.com> writes:
    Whatever GCC is printing - it's not what
    the user entered.

    GCC prints the things you ask it to, usually not FP numbers, but,
    e.g., compiler warnings and error messages.

    But as for printing what the user entered, here's what Gforth does:

    .1000000000000000055511151231257827021181583404541015625e e.exact

    outputs

    .1000000000000000055511151231257827021181583404541015625e

    Admittedly, there are a lot of numbers around that cannot be
    represented exactly as binary64 number, and for those the cycle decimal->binary64->decimal (using >FLOAT and E.EXACT based on a recent
    glibc release) does not print what is input, but the rounding happens
    at decimal->binary64 stage, not on the output.

    Does it look any better for, e.g., E. or 17 e.p? Consider

    .90000000000000007e

    E. prints

    .9e

    17 E.P prints

    .90000000000000002e

    Note that none of these numbers has more than 17 decimal digits.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Thu Oct 29 12:08:38 2026
    From Newsgroup: comp.lang.forth

    On 10/29/2026 10:01 AM, dxf wrote:
    As previously mentioned it makes no sense that one can output more significant digits
    than one can input - in anyone's universe.

    No doubt about that.

    Whatever GCC is printing - it's not what
    the user entered.

    I do that sometimes when I don't know what the hardware/software details
    of the machine/language are, but do know what I want it to approximate
    as best as possible, if not exactly.

    That does not mean that I wouldn't be surprised if .90000000000000007e
    e. comes back as 9.0000000000000007000e-1 but .90000000000000000076e e.
    shows 9.0000000000000000098e-1. ( Unless I now the hardware and software details of the machine. )

    However, shouldn't we then also do something about
    1000000000000000000 7 / . 142857142857142857 vs
    1000000000000000000000 7 / . 553688574240601819 ?

    -marcel

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Thu Oct 29 16:06:49 2026
    From Newsgroup: comp.lang.forth

    marcel hendrix <mhx@iae.nl> writes:
    However, shouldn't we then also do something about
    1000000000000000000 7 / . 142857142857142857 vs
    1000000000000000000000 7 / . 553688574240601819 ?

    Or, more obviously:

    1000000000000000000000 . 3875820019684212736 ok

    Interestingly, I have hardly seen any complaints about that.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Thu Oct 29 17:46:34 2026
    From Newsgroup: comp.lang.forth

    On 10/29/2026 5:06 PM, Anton Ertl wrote:
    1000000000000000000000 7 / .

    Or this one on, e.g., VFX Forth 64 :-)
    1000000000000 7 / . 555555555555 ok

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Thu Oct 29 17:14:35 2026
    From Newsgroup: comp.lang.forth

    marcel hendrix <mhx@iae.nl> writes:
    Or this one on, e.g., VFX Forth 64 :-)
    1000000000000 7 / . 555555555555 ok

    Hmm?

    [~:173093] vfx64
    VFX Forth 64 5.43 [build 0199] 2023-11-09 for Linux x64
    -- MicroProcessor Engineering Ltd, 1998-2023

    1000000000000 7 / . 142857142857 ok

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From marcel hendrix@mhx@iae.nl to comp.lang.forth on Thu Oct 29 22:52:35 2026
    From Newsgroup: comp.lang.forth

    On 10/29/2026 6:14 PM, Anton Ertl wrote:
    marcel hendrix <mhx@iae.nl> writes:
    Or this one on, e.g., VFX Forth 64 :-)
    1000000000000 7 / . 555555555555 ok

    Hmm?

    [~:173093] vfx64
    VFX Forth 64 5.43 [build 0199] 2023-11-09 for Linux x64
    -- MicroProcessor Engineering Ltd, 1998-2023

    1000000000000 7 / . 142857142857 ok

    - anton

    When BASE is 36 ?

    -marcel
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Fri Oct 30 11:11:28 2026
    From Newsgroup: comp.lang.forth

    On 29/10/2026 8:18 pm, Anton Ertl wrote:
    dxf <dxforth@gmail.com> writes:
    Whatever GCC is printing - it's not what
    the user entered.

    GCC prints the things you ask it to, usually not FP numbers, but,
    e.g., compiler warnings and error messages.

    But as for printing what the user entered, here's what Gforth does:

    .1000000000000000055511151231257827021181583404541015625e e.exact

    outputs

    .1000000000000000055511151231257827021181583404541015625e

    3.14159265358979323846264338327
    3.14159265358979311599796346854

    0.66666666666666666666666666666
    0.666666666666666629659232512495

    What the user expects/wanted to see?

    Admittedly, there are a lot of numbers around that cannot be
    represented exactly as binary64 number, and for those the cycle decimal->binary64->decimal (using >FLOAT and E.EXACT based on a recent
    glibc release) does not print what is input, but the rounding happens
    at decimal->binary64 stage, not on the output.

    Does it look any better for, e.g., E. or 17 e.p? Consider

    .90000000000000007e

    E. prints

    .9e

    17 E.P prints

    .90000000000000002e

    Note that none of these numbers has more than 17 decimal digits.

    It's not clear to me that IEEE even talks in terms of 'representable' numbers which leads to the junk that GCC et al print out:

    5.1 Overview

    "Each of the computational operations that return a numeric result specified by
    this standard shall be performed as if it first produced an intermediate result
    correct to infinite precision and with unbounded range, and then rounded that
    intermediate result, if necessary, to fit in the destinationrCOs format"

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Fri Oct 30 06:47:08 2026
    From Newsgroup: comp.lang.forth

    dxf <dxforth@gmail.com> writes:
    It's not clear to me that IEEE even talks in terms of 'representable' numbers >which leads to the junk that GCC et al print out:

    5.1 Overview

    "Each of the computational operations that return a numeric result specified by
    this standard shall be performed as if it first produced an intermediate result
    correct to infinite precision and with unbounded range, and then rounded that
    intermediate result, if necessary, to fit in the destinationrCOs format"

    This already says it: "if necessary". When the result is
    representable in the destination's format, rounding is not necessary.
    When the destination format is a string buffer with enough digits,
    rounding is not necessary, and the exact value can be shown.

    OTOH, almost all (as in "all but finitely many") numbers do not fit in binary64, so for almost all numbers that you might convert from a
    decimal string to a binary64 FP number, rounding happens on the
    conversion. The exceptions are notable, though, e.g., all integers
    <=2^53.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Sat Oct 31 13:30:58 2026
    From Newsgroup: comp.lang.forth

    On 29/10/2026 10:08 pm, marcel hendrix wrote:
    On 10/29/2026 10:01 AM, dxf wrote:
    As previously mentioned it makes no sense that one can output more significant digits
    than one can input - in anyone's universe.

    No doubt about that.

    Whatever GCC is printing - it's not what
    the user entered.

    I do that sometimes when I don't know what the hardware/software details of the machine/language are, but do know what I want it to approximate as best as possible, if not exactly.

    That does not mean that I wouldn't be surprised if .90000000000000007e e. comes back as 9.0000000000000007000e-1 but .90000000000000000076e e. shows 9.0000000000000000098e-1. ( Unless I now the hardware and software details of the machine. )

    However, shouldn't we then also do something about
    1000000000000000000 7 / . 142857142857142857-a vs
    1000000000000000000000 7 / . 553688574240601819 ?

    I doubt programmers are surprised by arithmetic overflow. Occasionally I've run into entered literals being too large and not noticing. Whether the compiler detects it appears to depend upon on the language and its conventions. When I looked, C compilers (like Forth) didn't but Pascal did.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From dxf@dxforth@gmail.com to comp.lang.forth on Sat Oct 31 15:20:42 2026
    From Newsgroup: comp.lang.forth

    On 30/10/2026 5:47 pm, Anton Ertl wrote:
    dxf <dxforth@gmail.com> writes:
    It's not clear to me that IEEE even talks in terms of 'representable' numbers
    which leads to the junk that GCC et al print out:

    5.1 Overview

    "Each of the computational operations that return a numeric result specified by
    this standard shall be performed as if it first produced an intermediate result
    correct to infinite precision and with unbounded range, and then rounded that
    intermediate result, if necessary, to fit in the destinationrCOs format"

    This already says it: "if necessary". When the result is
    representable in the destination's format, rounding is not necessary.
    When the destination format is a string buffer with enough digits,
    rounding is not necessary, and the exact value can be shown.

    1/1, 2/1 can be represented in one digit without rounding. So what? It's everything that can't that is the issue. The example I gave - 2/3 to infinity 'correctly rounded' - starts failing at the 17th digit when stored in binary64. If folks printing junk digits are claiming IEEE 2008 entitles them, they need to show it beyond reasonable doubt. I'm not saying yes or no. I'm curious - just not enough investigate myself as it won't be changing my practice.

    OTOH, almost all (as in "all but finitely many") numbers do not fit in binary64, so for almost all numbers that you might convert from a
    decimal string to a binary64 FP number, rounding happens on the
    conversion. The exceptions are notable, though, e.g., all integers
    <=2^53.

    - anton

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From anton@anton@mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.forth on Sat Oct 31 07:30:59 2026
    From Newsgroup: comp.lang.forth

    dxf <dxforth@gmail.com> writes:
    On 30/10/2026 5:47 pm, Anton Ertl wrote:
    dxf <dxforth@gmail.com> writes:
    It's not clear to me that IEEE even talks in terms of 'representable' numbers
    which leads to the junk that GCC et al print out:

    5.1 Overview

    "Each of the computational operations that return a numeric result specified by
    this standard shall be performed as if it first produced an intermediate result
    correct to infinite precision and with unbounded range, and then rounded that
    intermediate result, if necessary, to fit in the destinationrCOs format" >>
    This already says it: "if necessary". When the result is
    representable in the destination's format, rounding is not necessary.
    When the destination format is a string buffer with enough digits,
    rounding is not necessary, and the exact value can be shown.
    ...
    The example I gave - 2/3 to infinity
    'correctly rounded' - starts failing at the 17th digit when stored in binary64.

    The value 2/3 cannot be represented with finitely many decimal digits,
    nor with finitely many binary digits, and certainly not in binary64.

    So when you do, say

    2e 3e f/ e.exact

    on Gforth (with, e.g., glibc 2.36), what happens is:

    2e is converted to binary64, which can be done exactly, so no
    rounding is necessary.

    3e likewise.

    f/ produces a result that cannot be represented exactly in
    binary64, so rounding is necessary, and happens. If you want
    to call anything "junk" because of lack of exactness, it should
    be the result of F/.

    e.exact prints the number it finds on the stack, exactly.

    Given that we know how 2/3 should look in decimal, the output of
    E.EXACT is useful for seeing how the result of F/ differs from the
    exact value. If you have no use for such information, use a different
    FP printing word, e.g., E.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
    --- Synchronet 3.22a-Linux NewsLink 1.2