NO

Recent Posts

Pages: [1] 2 3 ... 10
1
Beginner questions / Re: atof
« Last post by Grincheux on Yesterday at 06:18:01 pm »
There are too many numbers after the decimal point!


Thank You Frankie & Timo I will use the library
2
Beginner questions / Re: atof
« Last post by frankie on Yesterday at 12:10:27 am »
What about transforming in two 64 bits numbers.
Than You Frankie for your help.
I would avoid to to reinvent the wheel and write your own math library.
You can use the QD library ported by Timovjl.
I also found another quad precision float library that seems interesting: the HPALIB (High Precision Arithmetic library).
The IEEE 754 2008 binary128 uses 1 bit for sign, 15bits for exponent and 113bits for mantissa. 113bits means 33 significant digits. This means that you can work i.e. with numbers of 16 digits before decimal dot and 16 digits after without precision loss.
4
Beginner questions / Re: atof
« Last post by Grincheux on November 23, 2020, 08:28:50 pm »
A good thing and impressive calculator!
I also have found LibBF and GNU MPFR but there is no Windows Version!
It is possible using MinGW but too complicated for me.
5
Beginner questions / Re: atof
« Last post by MrBcx on November 23, 2020, 08:22:15 pm »

I have read too that a programmer gave numbers in the form of a string.
 

I have ugly code that I wrote in 1992 that creates 3 functions -- fpAdd, fpSub, and fpMul.
Each takes 2 string arguments.  The BASIC code was written for MSDOS but compiles with Pelles
when converted using my BCX translator.

Examples:

PRINT fpAdd$ ("999.123456789","100")

PRINT fpSub$ ("500.987654321","100")

PRINT fpMul$ ("999999999999999999.123456789","999999999999999999.123456789")


OUTPUT

1099.123456789
400.987654321
999999999999999998246913578000000000.768328000750190521


Impressively, the fpMul result matches the result obtained here:

https://keisan.casio.com/calculator

6
Beginner questions / Re: atof
« Last post by Grincheux on November 23, 2020, 06:33:14 pm »
I have read something about what you told.
I have read too that a programmer gave numbers in the form of a string.
What about transforming in two 64 bits numbers.
Than You Frankie for your help.
7
General discussions / Re: SDL2 with PellesC 10
« Last post by Griffin on November 22, 2020, 09:28:03 pm »
Never mind... it helps to use the 32-bit variant when compiling in win32 mode...  :-X
8
General discussions / SDL2 with PellesC 10
« Last post by Griffin on November 22, 2020, 07:38:39 pm »
I'm trying to revive an old project that I once built based on SDL. Want it to update to the latest and greatest SDL2 for windows. How do I solve this?

Output from the build-phase:

Building main.obj.
C:\projects\issconfig\SDL2-2.0.12\include\SDL_atomic.h(123): warning #2195: Unrecognized intrinsic function: '_ReadWriteBarrier'.
Building util.obj.
Building issconfig.exe.
POLINK: error: Unresolved external symbol '_SDL_SetMainReady' - referenced from 'C:\projects\issconfig\output\main.obj'.
POLINK: error: Unresolved external symbol '_SDL_Quit' - referenced from 'C:\projects\issconfig\output\main.obj'.
POLINK: error: Unresolved external symbol '_SDL_Init' - referenced from 'C:\projects\issconfig\output\main.obj'.
POLINK: error: Unresolved external symbol '_SDL_CreateWindow' - referenced from 'C:\projects\issconfig\output\main.obj'.
POLINK: fatal error: 4 unresolved external(s).
*** Error code: 1 ***
Done.

I enabled verbose output on the linker and the lib is actually scanned, so it should've worked. The library itself actually seems to contain these symbols, and polink doesn't complain the library is broken.
9
Beginner questions / Re: atof
« Last post by frankie on November 22, 2020, 01:22:06 pm »
Thank You Frankie I expected an other solution, but with your post it is clear I must change something. Perhaps I could multiply by 100 so there will be only five numbers after the decimal point.
I don't think it will solve your problem.
Multiplying by 100 moves the decimal point, but don't change the total number of digit figures of the number, ergo the whole digits that make up your number still can't be enclosed in the 54 bits (53 real plus an implicit bit), and can't be represented without approximations.
When approximations comes in all the issues, explained in the paper reported by Pelle, start to play.
In very plain words: if you need high precision calculations without any tricky approximation, be sure that all your numbers, removing the decimal point, are less than 2^54-1.
In your case you can find convenient to work with quadruple precision float, standard "IEEE 754 2008 binary128", that use 128bits.
Many free libraries are available, among them you can try QPFloat (C++) this in C.
10
Beginner questions / Re: atof
« Last post by Grincheux on November 21, 2020, 04:06:56 pm »
Here are examples
Quote
2466285.687500000, A.D. 2040-May-11 04:30:00.0000,  1.556590248345051E+09,  2.709382709369094E+08, -8.836233844876927E+07, -7.653652678628662E+00,  3.833227168750318E+01, -4.593642982153394E-01,  5.278527865450719E+03,  1.582462843404964E+09, -9.398838110390882E-01,
2466285.708333333, A.D. 2040-May-11 05:00:00.0000,  1.556576462563047E+09,  2.710072669242373E+08, -8.836316353478888E+07, -7.663882752316741E+00,  3.832993585150521E+01, -4.573979376624084E-01,  5.278522195719391E+03,  1.582461143662273E+09, -9.487191675119203E-01,
2466285.729166667, A.D. 2040-May-11 05:30:00.0000,  1.556562658367611E+09,  2.710762587037903E+08, -8.836398508131553E+07, -7.674112045828995E+00,  3.832759637718574E+01, -4.554315282629915E-01,  5.278516472939437E+03,  1.582459428016004E+09, -9.575544522874865E-01,
2466285.750000000, A.D. 2040-May-11 06:00:00.0000,  1.556548835760150E+09,  2.711452462690158E+08, -8.836480308826166E+07, -7.684340557115283E+00,  3.832525326549152E+01, -4.534650705151737E-01,  5.278510697111295E+03,  1.582457696466289E+09, -9.663896636982247E-01,
2466285.770833333, A.D. 2040-May-11 06:30:00.0000,  1.556534994742076E+09,  2.712142296133627E+08, -8.836561755554067E+07, -7.694568284329571E+00,  3.832290651737497E+01, -4.514985649057817E-01,  5.278504868235410E+03,  1.582455949013259E+09, -9.752248002768448E-01,
2466285.791666667, A.D. 2040-May-11 07:00:00.0000,  1.556521135314799E+09,  2.712832087302955E+08, -8.836642848306687E+07, -7.704795225828729E+00,  3.832055613379973E+01, -4.495320119136608E-01,  5.278498986312236E+03,  1.582454185657053E+09, -9.840598607536791E-01,
2466285.812500000, A.D. 2040-May-11 07:30:00.0000,  1.556507257479735E+09,  2.713521836132668E+08, -8.836723587075542E+07, -7.715021380166704E+00,  3.831820211575668E+01, -4.475654120184007E-01,  5.278493051342231E+03,  1.582452406397807E+09, -9.928948440483559E-01,
2466285.833333333, A.D. 2040-May-11 08:00:00.0000,  1.556493361238303E+09,  2.714211542557307E+08, -8.836803971852225E+07, -7.725246746101247E+00,  3.831584446427977E+01, -4.455987657079348E-01,  5.278487063325862E+03,  1.582450611235662E+09, -1.001729749272952E+00,
2466285.854166667, A.D. 2040-May-11 08:30:00.0000,  1.556479446591923E+09,  2.714901206511572E+08, -8.836884002628440E+07, -7.735471322605457E+00,  3.831348318045865E+01, -4.436320734841406E-01,  5.278481022263600E+03,  1.582448800170757E+09, -1.010564575740471E+00,
2466285.875000000, A.D. 2040-May-11 09:00:00.0000,  1.556465513542015E+09,  2.715590827930046E+08, -8.836963679395960E+07, -7.745695108875569E+00,  3.831111826544660E+01, -4.416653358663005E-01,  5.278474928155919E+03,  1.582446973203236E+09, -1.019399322971638E+00,
2466285.895833333, A.D. 2040-May-11 09:30:00.0000,  1.556451562090006E+09,  2.716280406747333E+08, -8.837043002146657E+07, -7.755918104349613E+00,  3.830874972045784E+01, -4.396985533885100E-01,  5.278468781003298E+03,  1.582445130333242E+09, -1.028233990713471E+00,
2466285.916666667, A.D. 2040-May-11 10:00:00.0000,  1.556437592237315E+09,  2.716969942898195E+08, -8.837121970872520E+07, -7.766140308727367E+00,  3.830637754675538E+01, -4.377317265922063E-01,  5.278462580806210E+03,  1.582443271560917E+09, -1.037068578961048E+00,
2466285.937500000, A.D. 2040-May-11 10:30:00.0000,  1.556423603985368E+09,  2.717659436317282E+08, -8.837200585565612E+07, -7.776361721981864E+00,  3.830400174563097E+01, -4.357648560154441E-01,  5.278456327565135E+03,  1.582441396886405E+09, -1.045903087973520E+00,
2466285.958333333, A.D. 2040-May-11 11:00:00.0000,  1.556409597335591E+09,  2.718348886939266E+08, -8.837278846218090E+07, -7.786582344376431E+00,  3.830162231837438E+01, -4.337979421764349E-01,  5.278450021280551E+03,  1.582439506309848E+09, -1.054737518296720E+00,
Pages: [1] 2 3 ... 10