flat assembler
Message board for the users of flat assembler.

Index > Main > transcendental functions

Author
Thread Post new topic Reply to topic
sylware



Joined: 23 Oct 2020
Posts: 91
Location: Marseille/France
sylware
Hi,

I am into natural logarithm and trigonometric tan function approximations for normal f64 numbers, assembly implemented ofc (probably AVX2 FMAs for polynomial calculations).

I had a look at glibc libm, and IBM(redhat) did so bad at documenting it, I would like to avoid to reverse engineer their maths from the source (their tan is scary, and I prefer not to talk about their abuse of GNU symbol versioning).

Is there an international "something " which maintains the "best" way to approximate transcendental functions for normal f64 numbers? IEEE does not do that for their number formats???

I may end-up hand-compiling parts of mpfr and/or parts of libbf(bellard) namely go multiprecision with a f64 conv at the end.
Post 13 Jan 2022, 21:34
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18256
Location: In your JS exploiting you and your system
revolution
Are you aware of fptan?

It doesn't give the full four quadrant result. Some extra processing is required if you need that.
Post 14 Jan 2022, 00:53
View user's profile Send private message Visit poster's website Reply with quote
Hrstka



Joined: 05 May 2008
Posts: 30
Location: Czech republic
Hrstka
You can take a look at the SLEEF Vectorized Math Library, if that's what you mean.
Post 14 Jan 2022, 08:51
View user's profile Send private message Reply with quote
Ville



Joined: 17 Jun 2003
Posts: 238
Ville
SLEEF is also available in Menuet64 in assembly.

System call 151.
http://menuetos.net/syscalls.txt
http://www.menuetos.net/sc151.html
Post 14 Jan 2022, 11:13
View user's profile Send private message Reply with quote
sylware



Joined: 23 Oct 2020
Posts: 91
Location: Marseille/France
sylware
@revolution: yeah, range reduction. It seems IBM is doing many range reductions in their glibc/libm tan over [0,PI/2[. For trigonometric functions, no worries, but for the natural logarithm I guess I may need to find papers about good range reductions. I try to move away from x87.

@hrstka,@villeBut: menuet64 is "close" source then is their assembly port of SLEEF.

I would like to be able to "check" their maths, namely double check the proof of their precision ("ulp" related).
Namely for each approx methods: Chebychev(Remez), Padé, raw Taylor, arithmetic/geometric mean, I would need to get my eyes on papers on proof of their precisions ("ulp"). I think it is more maths than assembly, but to see explicitely those maths applied for some code, you know, to understand where it comes from. I recall vaguely in the case of raw Taylor, the "remainder" theorem which allows to do just that.

Why such important stuff is so hard to find on internet???

Yep, after furter investigation, before going assembly port/hand-compilation of the code of a tan/log approximant, I need to double check their "ulp" mathematical proof. Getting my hands on sleef to see if I can do just that: for the moment, sleef documentation is the less worse I could read, but it still throws a lot at our face. It seems there is no proof, just "good enough"/empirical polynomial coefficients computed via many points over a "reduced" range using the simplex (linear programming) algorithm to minimize the relative error to the output of very high precision numbers from mpfr.
It seems to explain why many math libs are doing "their own thing".
The elephant in the room is they are doing a huge mistake by being very dependant on the worst part of optimizing compilers. This project should be pure assembly for each targeted arch with at best a generic simple C89 with benign bits of c99/c11 implementation.
ofc, I did forget about the numerical stability discussion of their approximant, nowhere to be found... wild guess: this is "common knowledge" in the numerical analysis field.
Post 14 Jan 2022, 15:21
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.