Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Haskell: abs: Get the absolute value of a number


Haskell provides abs function, which returns the absolute value of a number. Following is the signature of abs function.
Prelude> :t abs
abs :: Num a => a -> a


As you see the signature, abs takes any value which is of number type and return the absolute value.
Prelude> abs 10
10
Prelude> abs (-10)
10
Prelude> abs 10.01
10.01
Prelude> abs (-10.01)
10.01



Previous                                                 Next                                                 Home


This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here

Share the post

Haskell: abs: Get the absolute value of a number

×

Subscribe to Java Tutorial : Blog To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×