Post Reply 
(42, all flavours) Integer Division - how?
12-16-2020, 03:30 PM (This post was last modified: 12-17-2020 12:35 AM by Albert Chan.)
Post: #32
RE: (42, all flavours) Integer Division - how?
(12-13-2020 07:43 PM)Thomas Okken Wrote:  
(12-13-2020 06:41 PM)Albert Chan Wrote:  It would be nice if Free42 exposed FMA(a,b,c) to the user ...

Noted...

Free42 FMA already work in progress ! Smile
https://github.com/thomasokken/free42

With FMA, idiv simplified to this. (code optimized for speed, and removed b>0 requirement)
PHP Code:
function idiv5(a,b)
    
local c a/b
    local q 
floor(c)
    if 
0 then b=-else a=-a end
    
if == and fma(q,b,a) < 0 then return q-1 end
    
return q
end 
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (42, all flavours) Integer Division - how? - Albert Chan - 12-16-2020 03:30 PM



User(s) browsing this thread: 1 Guest(s)