hi Charles
do you have in your assembler "repertoire" a function that converts 10 byte floats to an ascii string ?
I'm sure i can do it self but why if you have a working version.
Joshy
This is the candidate thinCoreFB. It still has a few differences from the PB version as well as the additions but it is much easier to maintain than the previous one.
I have included your EXT code directly.
You are welcome to improve it, Joshy
Charles
hi Charles
do you have in your assembler "repertoire" a function that converts 10 byte floats to an ascii string ?
I'm sure i can do it self but why if you have a working version.
Joshy
(Sorry about my bad English.)
Hi Joshy,
Converting float to ascii is a dragon I have yet to conquer! It is one of those beasts which are a lot harder than they first appear, taking all the possible outputs into consideration. I think it will take me about 2 days, but if you can do it faster or find ready-made code then please go ahead
Charles
Phew! That was hard work.
I studied the MASM FPU code to get the correct power scaling code, and wrote it in Oxygen first before porting to FreeBasic, so it looks a bit unusual. It was much easier to do it this way with block structured programming.
My code will support +0 -0 #INF #-INF #qNAN #sNAN. You can also control the decimal places and scientific notation etc.
I have patched it into your EXT operator set, Joshy.
Charles
PS: See attachment further on
hi Charles
"That was hard work." yes but a good job
dim as ext a=1,b=3
dim as ext c=a/b
do you know why EXTended data type gives you only 16 decimal places ?
this are the same places as you would use double 1.0/3.0
Joshy
(Sorry about my bad English.)
The final 2 digits are unreliable, and change as variable A is scaled 1 .. 1E+100 etc.
But I think it might also be cumulative errors inherent in FBSTP
you can see the last digits by setting num.dp to 17, which I have done below
Charles
PS: this Zip has been corrected (1 asm bug). I have withdrawn the previous one.
Charles far be it for me to give advice to master, but I wrote an FtoA function long ago and it reliably gives 18 digit output, one thing I got wrong was in checking for NaN's, I would post code but it's a mess and looking at the code I don't understand how some parts work (it's been a long time since i wrote it).
one thought though, why not just output the maximum digits and use cast to double if you want less digits?
I know it will only work as long as the extended is within the range of double, so it coud be a problem.
Hi Jack,
Yes there is something strange going on. With the Oxygen version, I get an accurate 0.333333333333333. But with large powers, say 1e+200 / 3 the final 2 digits are out: 3.33333333333333320E+19.
I'll keep on experimenting.
Could you try running some big thirds and see what results you get with your code?
Charles
I lost all my old thinbasic module source codes and can't remember how I called a thinBasic script callback sub with one long param ?
Can anyone explain it again please.sub MyCallBack(byval StreamID as long) ' ... end sub
thank you
Joshy
USES FreeSound dim hStream as long = CreateNewMP3Stream("intro_music.mp3") MP3StreamSetEndCallback(hStream, "MyCallBack") StartMP3Stream(hStream) ' ... sub MyCallBack(byval StreamID as long) ' <--- how call it with one long param ? printl "end of MP3 stream !" + str$(StreamID) end sub
Last edited by D.J.Peters; 19-05-2013 at 14:53.
(Sorry about my bad English.)
I know how to parse the name of the callback sub
and how i call it from module.
But how I can set the long param before i made the call ?
Would be really great if someone can give me the right hint.
By the way exist source code from a module that use callbacks with params ?
My curent work is interrupted without your help.
Joshy
Last edited by D.J.Peters; 20-05-2013 at 04:02.
(Sorry about my bad English.)
Bookmarks