Intel Decimal Floating-Point Math Library

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
srvaldez
Posts: 2635
Joined: Sep 25, 2005 21:54

Intel Decimal Floating-Point Math Library

Postby srvaldez » Feb 19, 2021 21:16

compiled for win32/64 https://software.intel.com/content/www/ ... brary.html
this decimal math library includes the types decimal32, decimal64 and decimal128
the library includes the elementary transcendental functions like trig and exponential
also included is a rudimentary overload bi to make it easy to use, download from https://drive.google.com/file/d/19b1J7x ... sp=sharing
Last edited by srvaldez on Feb 26, 2021 12:06, edited 4 times in total.
hhr
Posts: 12
Joined: Nov 29, 2019 10:41

Re: Intel Decimal Floating-Point Math Library

Postby hhr » Feb 20, 2021 8:07

Something seems to be wrong...

Code: Select all

#include "libbid.bi"

Using quad_dec

Dim As Decimal128 x

Print 4*Atn(1)
Print " 3.141592653589793238462643383279502884"

x=4*Atn(1)
Print x

x=2*Asin(1)
Print x

Print

Print " 1,4142135623730950488016887242097"

x=Sqr(2)
Print x

Sleep
hhr
Posts: 12
Joined: Nov 29, 2019 10:41

Re: Intel Decimal Floating-Point Math Library

Postby hhr » Feb 20, 2021 10:28

My mistake, arguments must be of type Decimal128. Thank you.

Code: Select all

#include "libbid.bi"

Using quad_dec

Dim As Decimal128 x,i

Print 4*Atn(1)
Print 2*Asin(1)
Print 2*Acos(0)
Print Acos(-1)
Print " 3.141592653589793238462643383279502884"

i=1
x=4*Atn(i)
Print x

x=2*Asin(i)
Print x

i=0
x=2*Acos(i)
Print x

Print Acos(Decimal128(-1))

Print

Print Sqr(2)
Print " 1,414213562373095048801688724209698"

i=2
x=Sqr(i)
Print x

Print

Print x*x
Print x^2
Print Exp(2*Log(x))
Print Exp(Log(x)+Log(x))
Sleep
srvaldez
Posts: 2635
Joined: Sep 25, 2005 21:54

Re: Intel Decimal Floating-Point Math Library

Postby srvaldez » Feb 22, 2021 1:47

I polished up the bi, a bit closer to complete
one thing to keep in mind is that if you assign a double value to a decimal variable the value will most likely on be accurate to double precision
unless the double is an integer that fits in a double or it's an integer or fractional power of 2, for example 0.5 is ok but 0.1 is not but x="0.1" is ok
srvaldez
Posts: 2635
Joined: Sep 25, 2005 21:54

Re: Intel Decimal Floating-Point Math Library

Postby srvaldez » Feb 22, 2021 4:57

fixed a copy/paste mistake in unary -
<edit> in retropect, instead of the Namespace quad_dec I should have used Namespace BID, in case one doesn't want to Using BID one can use the relatively short prefix BID

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 5 guests