TypeConversions from FP16 to FP

Post here to discuss any new features, components, chips, etc, that you would like to see in Flowcode.
mnfisher
Valued Contributor
Posts: 1453
http://meble-kuchenne.info.pl
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 135 times
Been thanked: 707 times

Re: TypeConversions from FP16 to FP

Post 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

Steve-Matrix
Matrix Staff
Posts: 1465
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 204 times
Been thanked: 347 times

Re: TypeConversions from FP16 to FP

Post by Steve-Matrix »

PC Developer doesn't use C code and so cannot use any supplementary code.

mnfisher
Valued Contributor
Posts: 1453
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 135 times
Been thanked: 707 times

Re: TypeConversions from FP16 to FP

Post 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

Steve-Matrix
Matrix Staff
Posts: 1465
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 204 times
Been thanked: 347 times

Re: TypeConversions from FP16 to FP

Post 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.

mnfisher
Valued Contributor
Posts: 1453
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 135 times
Been thanked: 707 times

Re: TypeConversions from FP16 to FP

Post 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
Attachments
fp16gpt.fcsx
(12.78 KiB) Downloaded 116 times

stefan.erni
Valued Contributor
Posts: 997
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 190 times
Been thanked: 217 times

Re: TypeConversions from FP16 to FP

Post 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:
Attachments
2024-11-11_08-43-01.PNG
2024-11-11_08-43-01.PNG (409.75 KiB) Viewed 4437 times

mnfisher
Valued Contributor
Posts: 1453
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 135 times
Been thanked: 707 times

Re: TypeConversions from FP16 to FP

Post by mnfisher »

Cool!

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

Martin

Post Reply