1. pEU

Are Euphoria's floating-point functions unfortuitously fraught (with)...
'fragilities' ?
Does this mean I'll have to scrap my sense of value()'s altogether ?
Has the ATOM finally been smashed ?

-- chuckle.ex --
function chucklevalue(sequence integerString)
--lest we forget value() for integerstringthings
integer Tiny, Pos
atom Big, Inc  -- damn'd in-accurate ?
  Big=0
  Pos=length(integerString)
  Inc=1
  for round=1 to length(integerString) do
    if integerString[Pos]='0' then Tiny=0
    elsif integerString[Pos]='1' then Tiny=1
    elsif integerString[Pos]='2' then Tiny=2
    elsif integerString[Pos]='3' then Tiny=3
    elsif integerString[Pos]='4' then Tiny=4
    elsif integerString[Pos]='5' then Tiny=5
    elsif integerString[Pos]='6' then Tiny=6
    elsif integerString[Pos]='7' then Tiny=7
    elsif integerString[Pos]='8' then Tiny=8
    elsif integerString[Pos]='9' then Tiny=9 end if
    Big=Big + (Tiny * Inc)
    Inc=Inc * 10
    Pos=Pos-1
  end for
return Big
end function

? chucklevalue("1387987657865432190879787876487964354327890989098")
-- end chuckle.ex --
...sorrrry, folks...  Wolf

new topic     » topic index » view message » categorize

2. Re: pEU

wolfgang fritz wrote:

>Are Euphoria's floating-point functions unfortuitously fraught (with)...
>'fragilities' ?
>Does this mean I'll have to scrap my sense of value()'s altogether ?
>Has the ATOM finally been smashed ?
>
>-- chuckle.ex --
>function chucklevalue(sequence integerString)
>--lest we forget value() for integerstringthings
>integer Tiny, Pos
>atom Big, Inc  -- damn'd in-accurate ?
>  Big=0
>  Pos=length(integerString)
>  Inc=1
>  for round=1 to length(integerString) do
>    if integerString[Pos]='0' then Tiny=0
>    elsif integerString[Pos]='1' then Tiny=1
>    elsif integerString[Pos]='2' then Tiny=2
>    elsif integerString[Pos]='3' then Tiny=3
>    elsif integerString[Pos]='4' then Tiny=4
>    elsif integerString[Pos]='5' then Tiny=5
>    elsif integerString[Pos]='6' then Tiny=6
>    elsif integerString[Pos]='7' then Tiny=7
>    elsif integerString[Pos]='8' then Tiny=8
>    elsif integerString[Pos]='9' then Tiny=9 end if
>    Big=Big + (Tiny * Inc)
>    Inc=Inc * 10
>    Pos=Pos-1
>  end for
>return Big
>end function
>
>? chucklevalue("1387987657865432190879787876487964354327890989098")
>-- end chuckle.ex --
>...sorrrry, folks...  Wolf

Okay, there are several interesting things about this. One, it turns to a float
without a decimal. It obviously turns into a float64 because of the size of the
exponent. Apparently, though, the display part of "?" extracts the ten digits
that would be the contents of a 32 bit atom and then prints that as the
significant part of the number along with the exponent. If it would actually
print the significant part of a float64, all sixteen or however many digits it
actually is would display. Oh what tangled webs we weave when first we
practice to deceive. The Great Oz's posterior is protruding from behind the
curtain.

Back to an earlier post. The big difference between Euphoria and C on this
count is that C's behavior has been "thoroughly" and rigorously documented
where Euphoria's loosely descriptive manual is in no way rigorous and
leaves great stretches of territory to be discovered by the user. The only
problem is that the author has promised that we can't and don't really need
to know the internal behavior while giving us no precise external behavior
to depend on...except for the obvious...whatever happens when we try it.
Who knows how many special cases there are in the code and how those
will change as the code is altered. Languages with hidden internals
desperately need rigorous external descriptions.The problem is that only
RDS can provide that. Trial and error from the outside is not a very promising
method.

Everett L.(Rett) Williams
rett at gvtc.com

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu