> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/d/decimal_floating_point_number_to_binary.md).

# Decimal floating point number to binary

```ruby
func dec2bin(String n) {
    Num(Num(n, 10).base(2), 10)
}
 
func bin2dec(String n) {
    Num(Num(n, 10).base(10), 2)
}
 
with("23.34375")   { |s| say ("  #{s} => ", dec2bin(s)) }
with("1011.11101") { |s| say (  "#{s} => ", bin2dec(s)) }
```

#### Output:

```
  23.34375 => 10111.01011
1011.11101 => 11.90625
```
