# float ops and _controlfp_s

- Thread: https://externals.io/message/44263
- Original archive: https://news-web.php.net/php.internals/44263
- Started by Pierre Joye on 2009-06-13T17:51:57+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #44263 — Pierre Joye — 2009-06-13T17:51:57+00:00

URL: https://externals.io/message/44263#44263

hi Christian,

There is still a significant performance impact due to _controlfp_s
usage. I would like to remove it, but before I would also like to know
why you introduced it in the 1st place. The tests pass with or without
changing the fp on almost each fp ops (sigh :).

Can you explain why we need it and what tests are affected by this
change please?

Cheers,
-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

---

## #44265 — Christian Seiler — 2009-06-13T18:01:29+00:00

URL: https://externals.io/message/44263#44265 · In reply to: #44263

Hi Pierre,

(Btw. you got the wrong Christian as CC. ;-))

> There is still a significant performance impact due to _controlfp_s
> usage.

Huh? After the modification I made this should only called once (!) at
PHP startup Or did we miss something? Anyway, calling it once should not
cause any performance problems at all.

> Can you explain why we need it and what tests are affected by this
> change please?

This ensures that FPUs on x86 systems are definitely in double precision
mode. The default situation on Windows with MSVC is that the FPU is
already in double precision setting as far as I've tested it - however
there are situations (PHP embedded into a webserver for example) where
this may not be true.

Could you please provide some details for "significant performance impact"?

Regards,
Christian

PS: My package arrived a while ago and I remember I didn't say thanks
yet - so here it goes: Thanks a lot!

---

## #44266 — Pierre Joye — 2009-06-13T18:04:46+00:00

URL: https://externals.io/message/44263#44266 · In reply to: #44265

hi,



> This ensures that FPUs on x86 systems are definitely in double precision
> mode. The default situation on Windows with MSVC is that the FPU is
> already in double precision setting as far as I've tested it - however
> there are situations (PHP embedded into a webserver for example) where
> this may not be true.

Should it not be a configure option then?

> Could you please provide some details for "significant performance impact"?

I will push the numbers online on Monday.

Cheers,
--
Pierre

http://blog.thepimp.net | http://www.libgd.org

---

## #44288 — Garrett Serack — 2009-06-15T19:21:59+00:00

URL: https://externals.io/message/44263#44288 · In reply to: #44265

Hey Christian, 

Uh, my fault.... false alarm. 

The fix that went in a while back did indeed fix the problem.

Garrett

-----Original Message-----
From: Christian Seiler [mailto:chris_se@gmx.net] 
Sent: Saturday, June 13, 2009 11:01 AM
To: Pierre Joye
Cc: php-dev List
Subject: Re: [PHP-DEV] float ops and _controlfp_s

Hi Pierre,

(Btw. you got the wrong Christian as CC. ;-))

> There is still a significant performance impact due to _controlfp_s
> usage.

Huh? After the modification I made this should only called once (!) at
PHP startup Or did we miss something? Anyway, calling it once should not
cause any performance problems at all.

> Can you explain why we need it and what tests are affected by this
> change please?

This ensures that FPUs on x86 systems are definitely in double precision
mode. The default situation on Windows with MSVC is that the FPU is
already in double precision setting as far as I've tested it - however
there are situations (PHP embedded into a webserver for example) where
this may not be true.

Could you please provide some details for "significant performance impact"?

Regards,
Christian

PS: My package arrived a while ago and I remember I didn't say thanks
yet - so here it goes: Thanks a lot!
