flat assembler
Message board for the users of flat assembler.
Index
> Main > transcendental functions 
Author 

revolution 14 Jan 2022, 00:53
Are you aware of fptan?
It doesn't give the full four quadrant result. Some extra processing is required if you need that. 

14 Jan 2022, 00:53 

Hrstka 14 Jan 2022, 08:51
You can take a look at the SLEEF Vectorized Math Library, if that's what you mean.


14 Jan 2022, 08:51 

Ville 14 Jan 2022, 11:13
SLEEF is also available in Menuet64 in assembly.
System call 151. http://menuetos.net/syscalls.txt http://www.menuetos.net/sc151.html 

14 Jan 2022, 11:13 

sylware 14 Jan 2022, 15:21
@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/handcompilation 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. 

14 Jan 2022, 15:21 

donn 20 Jan 2022, 05:53
If you're looking to test out some transcendental functions, I made a couple a while ago just for my own purposes. They're not optimized and were only meant for me to get answers that matched a calculator to a certain precision.
If you are familiar with Calculus, Gregory's Series, Maclaurin's Series, they are just derived from that, and I could definitely explain them. Think arctan contains a comment of the formula it's modelling. https://github.com/hpdporg/datap/blob/master/src/main/asm/Numeric/Transcendental.inc 

20 Jan 2022, 05:53 

sylware 23 Jan 2022, 17:41
well, I am looking for the following proofs: the proof of the numerical stability of their approximant of tan/log transcendental functions and the proof of their accuracy at a specific precision.
Since those proofs do not seem to be provided, I was expecting those as common knowledge then easy to find on internet. Well, I am wrong or bad at searching because I am unable to find those. 

23 Jan 2022, 17:41 

donn 23 Jan 2022, 18:34
OK, so not so much 'how calculating transcendental functions work,' but more 'prove to me their accuracy and error.'
Taking just the Taylor Series and related variants i.e. Maclaurin, you have a convergent series, and the error is pretty obvious if you calculate separately by hand, there are obvious decimal places which differ. The accuracy will noticably increase as you add more terms in the infinite expansion. So, proofs to calculate the error and precision analytically can be found by searching things like 'convergence of taylor series:' Last page, 'Estimating the Remainder': https://users.math.msu.edu/users/gnagy/teaching/12spring/mth133/L34133.pdf Page 21 Proof of Taylor Series: https://sam.nitk.ac.in/courses/MA111/Convergence%20of%20Taylor%20Series.pdf Similar proofs of Chebyshev should be searchable. In practice, there are ways to speed up the calculations by doing things like caching values, using lookups. This diverges a bit from the pure mathematical theory and yeah, is harder to find. More pure math theory answers may be easier to obtain on physicsforums if there are particulars you are trying to understand. Not sure if they answer pure math questions, but they're pretty good and responsive on analytic physics of any subject.


23 Jan 2022, 18:34 

sylware 23 Jan 2022, 21:12
This is the proof of the mathematical pure taylor series convergence, this is not what I have been looking for.
I am talking about proofs about their approximant using floating point numbers. Namely, proof that their approximant is numericaly stable, and proof about the accuracy of their approximant towards the original transcendental function. Those proofs are probably specific to each math lib because most math libs do their own thing. In other words: Proof that, for all floating point numbers in "this" range (range reduction), "this" very polynomial, with those _floating point coefficients_, will provide an approximant of "this" transcendental function for a floating point number in our "range" to the "best" "this" floating point format can do. 

23 Jan 2022, 21:12 

donn 23 Jan 2022, 23:48
Scanning over your questions, thought you were asking for precision of "raw Taylor." Trigonometric functions can be directly derived from this series as I sent previously.
Quote: 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"). If you want more efficient algorithms, the GNU Scientific Library provides their list of references: https://www.gnu.org/software/gsl/doc/html/specfunc.html#referencesandfurtherreading Which contains a link to a book that has Matlab of trigonometric functions: W.J. Thompson, Atlas for Computing Mathematical Functions, John Wiley & Sons, New York (1997). https://www.amazon.com/exec/obidos/ASIN/0471181714/acmorg20 With extensive references and indexing, this integrated package is superbly designed and easy to useideal for anyone who works with special functions. Contents include: * Elementary Transcendental Functions Math functions are calculated from theory. If you're looking for an even more tailored explanation of an implementation's precision: https://www.mpfr.org/algorithms.pdf And further efficiency gains: https://fredrikj.net/blog/2017/09/fasterexpsinandcosathighprecision/ 

23 Jan 2022, 23:48 

sylware 24 Jan 2022, 16:02
Yep, I was refering to approximants based on raw Taylor series, not pure maths raw Taylor series. Good we are now on the same page.
I was already lurking on the GNU scientifc library and mpfr in order to get such approximants numerical stability and accuracy proofs. Usually, we get thrown at our face the approximant algorithms without any rigorous proofs or references to proofs. Going to have a look, hope I'll be able to easily find those (yes, it should be very ez). I don't want to hand compile approximant algorithms without those proofs, kind of obvious common sense I guess. [offtopic: I have been too often disappointed by the knowledge system based on physical books (very limiting, too few alternatives and astonishly expensive for a individual). Browsing PDF files (version max 1.4, 1.7, yes microsoft, them again, f****ed version 2.0 with script) with proper indexe(S) to search into, and noscript/basic (x)html web pages (aka wikipedia) is the way to go.] I started with mpfr proofs, 2nd paragraph, Exp not rigorously defined right away: you have to search the pdf to find 2 contradicting definitions (one is the right one). Missing explanations (bijection proof I guess) of the "exponent based value" of a nonzero x.This should not be that hard, but since *EVERYTHING* is based on that, it should have been explicit and accurately detailed immediatly in this paragraph. I am lucky to vaguely remember that from my maths lectures decades ago. Those 70 pages are probably going to be an accute pain to go thru, rigorously. 

24 Jan 2022, 16:02 

donn 26 Jan 2022, 04:56
OK, yeah I wasn't expecting them to list the performance and precision of their functions in this much detail. Projects like Blender seem to have very little documentation in their physics solvers, but maybe mpfr is more serious or the docs actually exist if I looked.
Definitely useful to understand, I might read up on these some day in the future (page 16): Quote:


26 Jan 2022, 04:56 

revolution 26 Jan 2022, 05:11
That looks similar to the CORDIC algorithm.


26 Jan 2022, 05:11 

sylware 04 Feb 2022, 14:01
Ok, I got back on mpfr paper of "proofs". This is probably mathematically correct but this is disgusting maths work. Some "proofs" are bluntly missing, not reasonably complete, or hidden behind an "obvious" ("obvious" is forbidden in a maths paper since something is "obvious" only with the same amount of practice and experience of this very math domain).


04 Feb 2022, 14:01 

donn 04 Feb 2022, 19:01
https://www.mpfr.org/#mpfrlinks
Mailinglist for users and developers. Note: to post to the list, you cannot use the web interface, just send a mail to mpfr at inria.fr (and please, for a new thread, do not reply to an existing message; changing the subject is not sufficient). They have a mailing list in link above. Not sure how active their list is, but maybe they can provide more info on certain topics of their proofs. Scanned through the mpfr doc, could have good info in it, hard to tell so far though. 

04 Feb 2022, 19:01 

sylware 04 Feb 2022, 19:13
Dunno what I going to do. I want to throw the baby with the water: I don't want to keep reading this paper. Maybe it is because I am too lazy/bad and this gives me an excuse not to reproove the very little maths they use.
At least, there is no "javascript only web page" to interact with them. Hope they don't use spamhaus block list and provide at least grey listing on their email server (as it should be). edit: I cannot do it. This piece of "work" disgusts me too much, my "lazy/bad at maths" me won. But I know that all maths teachers I had would send to hell such "paper". I guess I'll choose an implementation and trust it, that without a document of "explicitenoughforme" and clean maths proofs. 

04 Feb 2022, 19:13 

< Last Thread  Next Thread > 
Forum Rules:

Copyright © 19992023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.