Abel Soares Siqueira · @abelsiqueira
90 followers · 40 posts · Server mathstodon.xyz

A very common question in many forums is why some languages, such as , doesn't compute 0.1 + 0.2 - 0.3 correctly. Check abelsiqueira.com/blog/2023-08- for my latest video and post on the subject.

#floatingpoint #scientificcomputing #julialang

Last updated 1 year ago

Marc B. Reynolds · @mbr
270 followers · 416 posts · Server mastodon.gamedev.place

I have some thoughts I'm attempting to write up WRT that quadratic paper (1) shared by @fatlimey. But anyway since probably most peeps seeing this are interested in single precision results....handling that case (if you can promote to doubles) is almost no work (2) at all. (Of course it's all moot if spurious over/underflows aren't a concern)

1) mastodon.gamedev.place/@fatlim

2) gist.github.com/Marc-B-Reynold

#floatingpoint #Quadratic

Last updated 1 year ago

Stewart Russell · @scruss
240 followers · 1622 posts · Server xoxo.zone

I've found a decent working approximation of π for

/pi 0.001 sin 2 div 360000 mul def

Accurate to 7 decimal places. The language uses single-precision floating point, and all its trig routines work in degrees.

This calculates π using the area of a unit radius n-gon, with n=360000

A = ½n⋅sin(360°÷n)

One of Ramanujan's approximations

π ≅ 9801÷(2206⋅√2)

is about as accurate but opaque.

#postscript #mathematics #pi #approximation #floatingpoint

Last updated 1 year ago

Jitse Niesen · @jitseniesen
60 followers · 127 posts · Server mathstodon.xyz

Today I learned that what NumPy calls float128 is not the same as what IEEE calls binary128 and what I call quad precision. Sad.

Instead, NumPy's float128 is what I call extended precision (80 bits).

#numericalanalysis #numpy #floatingpoint

Last updated 1 year ago

· @frederic
13 followers · 327 posts · Server mastodon.cloud

Why does 2**(-1022-53) get rounded to 2**(-1022-52) (the smallest subnormal 64-bit floating point number) in Python , whereas it gets rounded to 0 in node.js ?

According to the IEEE 754 standard it should get rounded to 0 as the closest representable number with an even digit in the last position. So node.js is conforming to the IEEE 754 standard, while Python isn't.

Or am i making a mistake?

#ieee754 #javascript #nodejs #python #floatingpoint

Last updated 1 year ago

· @frederic
13 followers · 302 posts · Server mastodon.cloud
Felix LeClair (Wants a job😊) · @fclc
381 followers · 960 posts · Server mast.hpc.social

Has anyone managed to get an Asic for Posits fabbed yet?

If so, what did they implement? “Simple” mul/add/sub/div?

Going to try and power through the littérature and get a design ready for Monday

Keep finding littérature references to FPGAs, but little to no references to ASICS

#posits #hpc #floatingpoint

Last updated 2 years ago

JohnMoyer · @johnmoyer
21 followers · 140 posts · Server okla.social

@steve
For those confused about NaN in the responses. NaN is not a number. One may get a NaN by 0/0 while 1/0 is infinity.
perso.ens-lyon.fr/jean-michel.
What Every Computer Scientist Should Know About
Floating-Point Arithmetic
DAVID GOLDBERG

#nan #ieee768 #floatingpoint

Last updated 2 years ago

Felix LeClair (Wants a job😊) · @fclc
379 followers · 907 posts · Server mast.hpc.social

Not sure if there’s a proper metric for Posit numbers yet, but can we please call them pops? Posit operations per second?

The idea of saying “this system can do 150 TPops” seems *really* fun

(Not to mention the audio folks can talk about how quickly they process Kpops 😝)

#posits #floatingpoint #hpc

Last updated 2 years ago

David Zaslavsky · @diazona
163 followers · 1908 posts · Server techhub.social

@stylus You're taking a negative number to a fractional power, that's why it's complex. Note that the same thing happens without any trig:

>>> (-1) ** (1/100**100)
(1+3.141592653589793e-200j)

And the real component of the true result differs from 1 by so little that a floating-point number doesn't have the precision to represent it. If you try it with some larger exponents, you'll notice that the real component differs from 1 by roughly the imaginary component squared:

>>> 1 - ((-1) ** (1/100**2))
(4.9348021557982236e-08-0.00031415926019126653j)
>>> 1 - ((-1) ** (1/100**3))
(4.934830322156358e-12-3.141592653584625e-06j)
>>> 1 - ((-1) ** (1/100**4))
(4.440892098500626e-16-3.1415926535897924e-08j)

Extending the pattern, the real component in your result would be something like 1 - (something)e-400, and you would need roughly a 1350-bit floating point data type to accurately represent that. Otherwise it just rounds to 1.

#floatingpoint

Last updated 2 years ago

Stylus 🦉 · @stylus
208 followers · 1715 posts · Server octodon.social

Can someone explain this to me? How did I get a complex number? how is the magnitude strictly above 1? (python3 on amd64 linux)

cos(9) ** (1 / 100**100.)
(1+3.141592653589793e-200j)

#python #mathishard #floatingpoint

Last updated 2 years ago

Edward Betts · @edward
604 followers · 323 posts · Server octodon.social

Whoops! Did somebody represent a price as a float?

#ocado #floatingpoint #roundofferror

Last updated 2 years ago

Jorge Stolfi · @JorgeStolfi
309 followers · 1602 posts · Server mas.to

On a hunch, I went back and checked some 2000 C source files that I wrote over 30+years for instances of 'abs' that should have been 'fabs'. To my embarrassment, found more than 20 instances.

That could explain quite a few frustrating experiences with numerical software, such as improper stopping of iterations.

They could have been detected with the gcc -Wfloat-conversion switch, but it took me a decade or two to learn about it...

☹️

#languagedesign #clibrary #floatingpoint #programming

Last updated 2 years ago

Corbin · @corbin
10 followers · 98 posts · Server defcon.social

I had a weird line of thought yesterday. Consider sine or cosine. These functions are periodic, and both the average value and integral of each period are zero.

So, if we consider inexact floating-point arithmetic (any experts out there?) then big inputs should return small outputs, because an inexact big input covers a large range, and both the average and integral on that range are (probably) near zero.

#floatingpoint

Last updated 2 years ago

aegilops :github::microsoft: · @aegilops
118 followers · 416 posts · Server fosstodon.org

@steve that would "correct" zero real-world issues.

I'd never heard the term "mantissa" before seeing its use in FP - I've never needed to use a logarithm lookup table! They are obsolete.

Terms in mathematics and computer science are often appropriated by analogy, and that's all that happened here. It seems like you object to this?

Please don't spend effort on something that "solves" a non-problem and would lead to more confusion.

#Mantissa #floatingpoint #pedantry

Last updated 2 years ago

Beej · @beejjorgensen
66 followers · 177 posts · Server mastodon.sdf.org

Toggle bits in IEEE 754 floating point format and see what comes out.

evanw.github.io/float-toy/

#programming #ieee754 #floatingpoint

Last updated 2 years ago

lagomoof · @lagomoof
2 followers · 12 posts · Server mastodon.social

For x = 4776508211, √x - ln(x) is so close to an (69090) that (IEEE754 binary64) can't tell the difference.

#integer #c #double #arithmetic #floatingpoint #math #maths

Last updated 2 years ago

vitaut 🤍❤️🤍 🇺🇦 · @vitaut
702 followers · 704 posts · Server mastodon.social

Thanks to Junekey Jeon {fmt} now uses a faster algorithm when formatting floating point numbers with a given precision github.com/fmtlib/fmt/pull/326

#programming #floatingpoint

Last updated 2 years ago

George Macon · @gmacon
3 followers · 12 posts · Server indieweb.social
Beej · @beejjorgensen
47 followers · 103 posts · Server mastodon.sdf.org