fmath icon indicating copy to clipboard operation
fmath copied to clipboard

`exp(89.0f)` is NaN

Open reunanen opened this issue 1 year ago • 4 comments

A comment in the header states: exp(88.722839f) = inf ; 0x42b17218

This is indeed the result I'm seeing.

However, at least on my machine exp(89.0f) is NaN and not inf, and that's causing a problem in my use case.

reunanen avatar Aug 30 '24 09:08 reunanen

NB: I'm not using Xbyak.

reunanen avatar Aug 30 '24 09:08 reunanen

I think the problem is that here, limit is the input value (x) rounded to an integer (such as 89), and it's compared to 0x42b00000 that is a very large integer (so basically we never go to the clamping code guarded by this if statement). I think it's quite clear that this is an apples-to-oranges comparison... I think I understand what the general intent here has been, but to me it seems that there's just a simple bug.

reunanen avatar Aug 30 '24 10:08 reunanen

Thank you for the report. I will merge the patches, but I'm busy at work now, so please wait a moment.

herumi avatar Sep 02 '24 00:09 herumi

Yeah, no rush from my side!

reunanen avatar Sep 02 '24 05:09 reunanen

I'm sorry for the long delay. The new version fixes this. However, it is not backward compatible with previous versions.

herumi avatar Jan 10 '25 04:01 herumi