\
Hi ....
I realise that Floating Point in Chapel is work in progress but it is
still pretty good . So I will raise some points for discussion.
Background
==========
I am looking at among other things, ways to improve the numerical quality
of the module 'Norm' which I would like to bring up to at least the level
of robustness of the BLAS equivalents, and maybe improve accuracy at the
expense of speed.
Assumptions
===========
This discussion assumes that I am talking floating point numbers, where
'r'
is some floating point number.
Disclaimer
==========
One can argue that much of what I am trying to do is ask for, or provide,
a massively expanded version of the functions like
proc min(Type t) param
and
proc max(Type t) param
(see http://chapel.cray.com/docs/latest/modules/standard/Types.html).
In that event, this discussion may belong in 'chapel-developers', and not
here in 'chapel-users'. So apologies if this is in the wrong place but I
know nothing about implementing anything to do with 'predefined types' so
I put it here. If it really belongs there, I could be way outside of my
comfort zone and skill base.
My Question
===========
Has anybody looked at, and if so, would like to share, elegant ways to
* Extract/Manipulate Mantissa/Exponent
------------------------------------
`
(sign, exponent, mantissa) = r.ieeesplit()
(sign, exponent, mantissa) = r.ieeesplitraw()
rnomantissa = r.ieeemantissaonly(a)
where I realise that the first case is largely covered by an existing C
function 'frexp', but the latter two simply pull a floating point number
apart, the value of the number returned in 'mantissa' in the second case
is a number pretty close to underflow because the bits in the exponent
field of the resultant floating point number is all zeros.
The last of these simply returns a number which is a copy of the exponent
only of the number 'r'.
You need a way put those back together again but let's omit that from this
email.
* Provide a Rough Reciprocal
--------------------------
var t = r.roughreciprocal()
i.e.
t = 1.0 / r.ieemantissonly() // see above
There are also really slick ways to scale by such a number which do
not involve floating point operations. Whether you want to do that is
another question.
* Specify Floating Point Constants
--------------------------------
Is there an equivalent to the C header <float.h>, not that I necessarily
think that one should simple provide a one-to-one equivalent. There must
be a better way to do that within the limitations of C.
Additionally, it would be nice to be able to provide numbers such as
HS = r.safelarge()
hs = 1.0 / HS // or hs = HS.reciprocal() is such a method exists
where the first of these is the largest number such
that HS * HS does not overflow and (maybe) 1.0/(HS*HS)
does not underflow.
AND
TS = r.safesmall()
ts = 1.0 / TS // or hs = HS.reciprocal() is such a method exists
where the first of these is the smallest number such
that TS * TS does not underflow nd (maybe) 1/(TS*TS)
does not overflow.
One can argue that a single number will work for what I want, i.e. having
some method such that
s = r.safe()
where s*s does not overflow and 1.0/(s*s) does not underflow.
There are definitely a few others but let's leave it at this for now.
In the style of min/max above, and talking way outside my expertise level,
I am guessing you could and have in 'Predefined Types'
proc ieeesafe(Type t) param
but I leave that for others better qualified than me to discuss.
Other Questions
===============
* Absolute Value Mechanism
------------------------
Does 'abs' as defined within 'Math.html' defines a real function, rather
than some method always done 'in-line' that simply kills off the sign bit.
Regards - Damian
Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users