Page 2 of 2

Re: TypeConversions from FP16 to FP

Posted: Fri Nov 08, 2024 5:45 pm
by mnfisher
Will have a play - over the weekend.

The App developer - the use supplementary code option doesn't seem to work :-( so can't use the previous code...

It's odd that some values are different too (1/3 for example)

Martin

Re: TypeConversions from FP16 to FP

Posted: Fri Nov 08, 2024 5:59 pm
by Steve-Matrix
PC Developer doesn't use C code and so cannot use any supplementary code.

Re: TypeConversions from FP16 to FP

Posted: Sat Nov 09, 2024 8:46 am
by mnfisher
PC Developer doesn't use C code and so cannot use any supplementary code.
- There is a (disabled) check box in the build options. Maybe coming soon (and which language :-) )

Is it possible to call an external program?

The issue with the conversion seems to be with the high order bit of the exponent - so 1 works (00x3C00) but 2 doesn't (0x4000). I'd found some other code as well - but this mornings 'googlings' aren't working so well :-(


Martin

Re: TypeConversions from FP16 to FP

Posted: Sat Nov 09, 2024 10:48 am
by Steve-Matrix
mnfisher wrote:
Sat Nov 09, 2024 8:46 am
Is it possible to call an external program?
There is an Inbuilt Function to call external DLLs which can be used in PC Developer.

Re: TypeConversions from FP16 to FP

Posted: Sat Nov 09, 2024 4:23 pm
by mnfisher
Okay - an app version....

I cheated (?) - I asked ChatGPT to do fp16 to fp32 in C and converted the result.

I also cheated in that I just return 0.0 for NaN, and Infinity.

But it seems to work AOK - I just used simulation to step through it and checked the value of '.r'

Martin

Re: TypeConversions from FP16 to FP

Posted: Mon Nov 11, 2024 7:51 am
by stefan.erni
Hi Martin, Hi Steve

I have added Martin's macro to my program. It works perfectly in the App. Very good, thank you Martin.
App:
FP16_to_dez_App_post1.fcsx
(90.91 KiB) Downloaded 195 times
Result:

Re: TypeConversions from FP16 to FP

Posted: Mon Nov 11, 2024 9:01 am
by mnfisher
Cool!

Should be easy to look up the bit patterns for NaN and +/- infinity and add those too for completion.

Martin