food for thought - swift 5 released - bottom types, string interpolation, and stuff.
Walter Bright
newshound2 at digitalmars.com
Mon Apr 15 07:44:19 UTC 2019
On 4/14/2019 5:13 AM, Timon Gehr wrote:
>> BTW, did you know that Phobos used to contain secant() and cosecant()
>> functions? I removed them :-)
>
> That seems like a bad idea even assuming your criteria. `sec(x)` rounds once (if
> implemented correctly) while `1/cos(x)` rounds twice.
Of course, they were implemented simply as reciprocals.
> Phobos also contains `sin` and `cos` functions. Please don't remove either of them.
Not likely. Those functions are rather difficult to implement correctly, and so
are perfect candidates for library functions. Even as recently as just 5 years
ago, some C compilers got them wrong. (The D phobos test suite would fail on them.)
Phobos was pretty much forced to provide its own implementations of many math
functions because of erratic behavior of many C compiler library versions. It
turns out that being good at writing compilers has no relevance to competence at
the intricacies of implementing math functions :-)
More information about the Digitalmars-d
mailing list