| |
| Posted by H. S. Teoh in reply to pascal111 | PermalinkReply |
|
H. S. Teoh
Posted in reply to pascal111
| On Thu, Jul 28, 2022 at 03:10:19PM +0000, pascal111 via Digitalmars-d-learn wrote:
> On Thursday, 28 July 2022 at 15:03:34 UTC, H. S. Teoh wrote:
> > On Thu, Jul 28, 2022 at 02:30:38PM +0000, pascal111 via Digitalmars-d-learn wrote: [...]
> > > Of-course D has a built in "sgn" function, but I like to do it with my hands to be sure of code, I'm some doubtful and don't trust alien works.
> >
> > Just use the source, Luke! Phobos is open source for a reason.
> >
> > https://github.com/dlang/phobos/blob/8280b1e7de6cca4dc9a593431591054a5b3aa288/std/math/traits.d#L694
[...]
> I think Phobos is the big library of D, is it the same one with gdc compiler too? I'm using gdc compiler.
AFAIK, all D compilers ship with full Phobos source code. On my installation, it's in /usr/lib/gcc/x86_64-linux-gnu/11/include/d/*. You can probably find yours in a similar (or the same) location. Under that directory, just look into std/math/*.d for the std.math functions. For example, .sgn is in std/math/traits.d.
In general, all 3 D compilers ship with the same Phobos sources, except perhaps in a few places where some compiler-specific fixes were needed. Generally, though, I think the idea is to merge all such changes upstream under version() blocks so that we can use the same Phobos sources for all compilers.
T
--
What's the difference between a 4D tube and an overweight Dutchman? One is a hollow spherinder, and the other is a spherical Hollander.
|