P
P
Pi-3142014-02-27 10:46:49
Search Engine Optimization
Pi-314, 2014-02-27 10:46:49

How to quickly calculate the function exp(x)?

I'll make a reservation right away - I'm not a programmer, but the need in the form of the need for a numerical solution of the system of equations of mathematical physics pushed me with Free Pascal / Lazarus.
The code is written, the numerical scheme works, but the task of speeding up the program execution is complicated by the slow operation of the built-in FPC function for calculating exp(x).
I googled the question, I did not find any solutions for Pascal, please help.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Pi-314, 2014-02-28
@Pi-314

I answer to myself: I
found an article on the topic ( www.rsdn.ru/?article/alg/fastpow.xml ), I'm studying the issue, most likely, I need to expand the solution proposed there to negative values ​​of the argument, it's clear how to do this in Pasal, but maybe who can finalize ASM right away? )) Ay, assembler gods!
It follows from the article that if Free Pascal was to some extent based on the Borland libraries - the exp (x) problem is an old Pascal / Delphi disease ...

I
Ivan Starkov, 2014-02-28
@icelaba

Sometimes in the equations of mathematical physics, the accuracy of some operations on most of the iterations is not so important, so it can put the pre-calculated values ​​of e^x into the array at fairly small intervals, and use them in the algorithm until some point while error_value > N
And only on the last part of the iterations use the "true" value
(I mean that the inaccurate value of e^x will somehow increase the error, but this increase compared to the error in the initial iterations of the calculation is insignificant)

I
Ivan Starkov, 2014-02-28
@icelaba

In general, it's not really a joke that in wartime Pi can be equal to three or even four, for some tasks this accuracy is enough

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question