www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - floating point stuff in std.math

reply Berni44 <someone somemail.com> writes:
We are currently at splitting std.math into sub modules [1]. 
There the question arose, how to handle the floating point stuff, 
that's in there: Functions like feqrel, nextDown, isClose but 
also IeeeFlags and FloatingPointControl.

Some ideas:

a) IeeeFlags and FloatingPointControl goes into std.math.hardware 
and all else into std.math.floats.

b) The same, but std.math.floats is split into two modules, e.g. 
std.math.comparison (feqrel, isClose, ...) and 
std.math.floatmanip (nextDown, ilogb, ...)

c) Moving everything out of std.math and into it's own module, 
e.g. std.floats.

Any opinions or ideas on this?

[1] https://github.com/dlang/phobos/pull/7924
Mar 30 2021
parent jmh530 <john.michael.hall gmail.com> writes:
On Tuesday, 30 March 2021 at 15:04:28 UTC, Berni44 wrote:
 We are currently at splitting std.math into sub modules [1]. 
 There the question arose, how to handle the floating point 
 stuff, that's in there: Functions like feqrel, nextDown, 
 isClose but also IeeeFlags and FloatingPointControl.

 Some ideas:

 a) IeeeFlags and FloatingPointControl goes into 
 std.math.hardware and all else into std.math.floats.

 b) The same, but std.math.floats is split into two modules, 
 e.g. std.math.comparison (feqrel, isClose, ...) and 
 std.math.floatmanip (nextDown, ilogb, ...)

 c) Moving everything out of std.math and into it's own module, 
 e.g. std.floats.

 Any opinions or ideas on this?

 [1] https://github.com/dlang/phobos/pull/7924
You might find interesting mir-core's structure [1].It has mir.math.common, mir.math.constant, and mir.math.ieee. mir-algorithm [2] has some other math functions. [1] http://mir-core.libmir.org/mir_math.html [2] http://mir-algorithm.libmir.org/
Mar 30 2021