[Jprogramming] Overflow, underflow, floats

Erling Hellenäs erling at erlinghellenas.se
Thu Sep 21 11:25:15 UTC 2017


Hi all !

Well, some of calculations with _ and __ which have valid results seem 
OK, some seem questionable.

We don't know if these numbers really mean infinity or if they mean 
overflow. Calculations following the overflow can then mean the correct 
value is anything. Then we still see them as infinity or negative 
infinity and calculate with them as such. Can we even know if their 
correct value is positive or negative? I think not. This means we should 
only allow calculations with them to result in a valid number if these 
calculations would give this valid number regardless of the correct 
value of the infinite number.

The fact that a zero can also have a correct value of anything after an 
underflow and consecutive operations further complicates the situation?

I think we should at least be able to optionally trap the exceptions.

Cheers,

Erling


Den 2017-09-21 kl. 12:41, skrev Erling Hellenäs:
> Hi all !
>
> As I see it letting calculations with _ and __ return a zero means you 
> risk getting random results. I question if this is really an improvement.
>
> If you can not force an exception instead of a loss of precision you 
> risk getting random results? These exceptions are a compulsory part of 
> the standard for a reason?
>
> Cheers,
>
> Erling
>
>
> Den 2017-09-20 kl. 23:22, skrev Henry Rich:
>> No; see
>>
>> http://code.jsoftware.com/wiki/Vocabulary/under  Details
>>
>> http://code.jsoftware.com/wiki/Vocabulary/percent#dyadic Details
>>
>> It would perhaps be better if 0 * _5 gave -0, but it doesn't. The other
>> deviations are improvements added by J.
>>
>> Henry Rich
>>
>> On Wed, Sep 20, 2017 at 10:51 AM, Erling Hellenäs 
>> <erling at erlinghellenas.se>
>> wrote:
>>
>>> Hi all !
>>>
>>> Here is part of the standard. Required exception handling. Things I
>>> discuss in my post. Is it implemented in J? 
>>> https://en.wikipedia.org/wiki/
>>> IEEE_754#Exception_handling
>>> The floating point standard is obviously used in environments where the
>>> users can not afford random results, so there must be solutions to the
>>> problems I mention, which we also can see in this wikipedia article.
>>>
>>> Cheers,
>>> Erling
>>>
>>>
>>> Den 2017-09-20 kl. 16:27, skrev Erling Hellenäs:
>>>
>>>> I hope others want to read my post even if Raul discards it as not 
>>>> worthy
>>>> of comments. /Erling
>>>>
>>>>
>>>> Den 2017-09-20 kl. 12:25, skrev Raul Miller:
>>>>
>>>>> This isn't just J - this is the IEEE-754 floating point standard.
>>>>>
>>>>> It would be really nice if computers could deal with infinities,
>>>>> instantly, at no cost. Sadly, though, that's not going to happen.
>>>>>
>>>>> FYI,
>>>>>
>>>>>
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



More information about the Programming mailing list