Short Single?

General FreeBASIC programming questions.
deltarho[1859]
Posts: 4305
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: Short Single?

Post by deltarho[1859] »

dodicat wrote:Going the other way, it looks like the crt double has one more place than the fb double.
Interesting. 1/7 is good for testing because it is 0.142857', that is 142857 is repeated indefinitely.

Code: Select all

Exact:      0.142857 142857 142857 142857 142857 142857 ......
number:     0.142857 142857 1429
crt number: 0.142857 142857 14285
crt has indeed one more place, but rounds down.

I should like to nominate you as FreeBASIC's library innards guru. Image
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: Short Single?

Post by angros47 »

Looks like there is a C++ class to do that:

https://stackoverflow.com/questions/180 ... -in-c?rq=1

I guess it could be ported to FreeBasic
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Short Single?

Post by marcov »

deltarho[1859] wrote:
dodicat wrote:Going the other way, it looks like the crt double has one more place than the fb double.
Interesting. 1/7 is good for testing because it is 0.142857', that is 142857 is repeated indefinitely.

Code: Select all

Exact:      0.142857 142857 142857 142857 142857 142857 ......
number:     0.142857 142857 1429
crt number: 0.142857 142857 14285
The question is what is the closest /binary/ number.
Post Reply