# Converting a signed float into unsigned float

**URL:** <https://www.ruby-forum.com/t/converting-a-signed-float-into-unsigned-float/76051>\
**Category:** Ruby\
**Created:** [November 15, 2006, 4:17pm UTC](https://www.ruby-forum.com/t/converting-a-signed-float-into-unsigned-float/76051 "2006-11-15T16:17:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dipeshbatheja](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b19c9b/32.png) [@dipeshbatheja](https://www.ruby-forum.com/u/dipeshbatheja)\
**Post date:** [November 15, 2006, 4:17pm UTC](https://www.ruby-forum.com/t/converting-a-signed-float-into-unsigned-float/76051/1 "2006-11-15T16:17:00Z")

</div>

I know this is simple, but i am unable to find how to do this. I have an  
floating number and i want to convert it to unsigned floating number.  
What do i have t do.

---

<div class="post-metadata">

**Author:** ![dipeshbatheja](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b19c9b/32.png) [@dipeshbatheja](https://www.ruby-forum.com/u/dipeshbatheja)\
**Post date:** [November 15, 2006, 4:30pm UTC](https://www.ruby-forum.com/t/converting-a-signed-float-into-unsigned-float/76051/2 "2006-11-15T16:30:30Z")

</div>

Dipesh B. wrote:

> I know this is simple, but i am unable to find how to do this. I have an  
> floating number and i want to convert it to unsigned floating number.  
> What do i have t do.

irb(main):001:0\> (-3.14).abs  
=\> 3.14  
irb(main):002:0\> 2.7.abs  
=\> 2.7

---

<div class="post-metadata">

**Author:** ![dipeshbatheja](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b19c9b/32.png) [@dipeshbatheja](https://www.ruby-forum.com/u/dipeshbatheja)\
**Post date:** [November 16, 2006, 8:31pm UTC](https://www.ruby-forum.com/t/converting-a-signed-float-into-unsigned-float/76051/3 "2006-11-16T20:31:16Z")

</div>

----- Original Message -----  
From: “Dipesh B.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Newsgroups: comp.lang.ruby  
To: “ruby-talk ML” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Wednesday, November 15, 2006 10:17 AM  
Subject: converting a signed float into unsigned float

> I know this is simple, but i am unable to find how to do this. I have an  
> floating number and i want to convert it to unsigned floating number.  
> What do i have t do.

fl\_num = -1.456  
fl\_num = fl\_num.abs
