Skip to content

Commit

Permalink
added fma and muladd
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj authored and jakebolewski committed May 12, 2015
1 parent f64958f commit 2583c38
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ Currently, the `@compat` macro supports the following syntaxes:

* `keytype` and `valtype`, which return key and value type of Associative type, can be used in julia 0.3.

* `fma(x,y,z)` and `muladd(x,y,z)` can be used in Julia 0.3 for `x*y+z`.

## Renamed functions

* `itrunc`, `iround`, `iceil`, `ifloor` are now accessed via `trunc(T, x)`, etc. [#9133](https://github.com/JuliaLang/julia/pull/9133)
Expand Down
10 changes: 10 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -390,4 +390,14 @@ if VERSION < v"0.4.0-dev+4603"
export Cstring, Cwstring
end

if VERSION < v"0.4.0-dev+2823"
fma(x::Number,y::Number,z::Number) = x*y + z
export fma
end

if VERSION < v"0.4.0-dev+2861"
muladd(x::Number,y::Number,z::Number) = x*y + z
export muladd
end

end # module
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,6 @@ let s = "foo", w = wstring("foo")
@test reinterpret(Ptr{Cchar}, Compat.unsafe_convert(Cstring, s)) == pointer(s)
@test reinterpret(Ptr{Cwchar_t}, Compat.unsafe_convert(Cwstring, w)) == pointer(w)
end

# fma and muladd
@test fma(3,4,5) == 3*4+5 == muladd(3,4,5)

0 comments on commit 2583c38

Please sign in to comment.