# SRFI 48: is it possible to get rid of the decimal point?

**URL:** <https://racket.discourse.group/t/srfi-48-is-it-possible-to-get-rid-of-the-decimal-point/2836>\
**Category:** Questions & Answers\
**Created:** [March 25, 2024, 7:59am UTC](https://racket.discourse.group/t/srfi-48-is-it-possible-to-get-rid-of-the-decimal-point/2836 "2024-03-25T07:59:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyrn](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/tyrn/32/1731_2.png) [@Tyrn](https://racket.discourse.group/u/Tyrn)\
**Post date:** [March 25, 2024, 7:59am UTC](https://racket.discourse.group/t/srfi-48-is-it-possible-to-get-rid-of-the-decimal-point/2836/1 "2024-03-25T07:59:21Z")

</div>

Hi,

I've got this:

```scheme
"helpers.rkt"> (format "~0,0F" 1.22)
"1."
"helpers.rkt"> (format "~0,0F" 1.55)
"2."

```

I'd be satisfied with the same without the decimal point. Is there a way?

---

<div class="post-metadata">

**Author:** ![shawnw](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/shawnw/32/1031_2.png) [@shawnw](https://racket.discourse.group/u/shawnw)\
**Post date:** [March 25, 2024, 5:05pm UTC](https://racket.discourse.group/t/srfi-48-is-it-possible-to-get-rid-of-the-decimal-point/2836/3 "2024-03-25T17:05:06Z")

</div>

The decimal point is always added when `~F` renders a number, even if it's an exact integer; this seems to be the traditional behavior; Common Lisp's `format` does it, as do functions like SRFI-48's that are influenced by it.

You can use [`~r`](https://docs.racket-lang.org/reference/strings.html#%28def._%28%28lib._racket%2Fformat..rkt%29._~7er%29%29) from the [`racket/format`](https://docs.racket-lang.org/reference/strings.html#%28part._format%29) module instead:

```scheme
> (~r 1.23 #:precision 0)
"1"
> (~r 1.55 #:precision 0)
"2"

```

---

<div class="post-metadata">

**Author:** ![Tyrn](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/tyrn/32/1731_2.png) [@Tyrn](https://racket.discourse.group/u/Tyrn)\
**Post date:** [March 25, 2024, 5:16pm UTC](https://racket.discourse.group/t/srfi-48-is-it-possible-to-get-rid-of-the-decimal-point/2836/4 "2024-03-25T17:16:43Z")

</div>

Thanks! Do I have to use it with `format` like this?

```scheme
(format "~a~a" (~r qt #:precision 0) unit)

```

---

<div class="post-metadata">

**Author:** ![shawnw](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/shawnw/32/1031_2.png) [@shawnw](https://racket.discourse.group/u/shawnw)\
**Post date:** [March 25, 2024, 6:20pm UTC](https://racket.discourse.group/t/srfi-48-is-it-possible-to-get-rid-of-the-decimal-point/2836/5 "2024-03-25T18:20:00Z")

</div>

`~r` returns a string, so you can use `display`, [`write-string`](https://docs.racket-lang.org/reference/Byte_and_String_Output.html#%28def._%28%28quote._~23~25kernel%29._write-string%29%29), [`printf`](https://docs.racket-lang.org/reference/Writing.html#%28def._%28%28quote._~23~25kernel%29._printf%29%29), SRFI-48 `format`, etc. to print it. Lots of options.

* * *

Aside/blatent self-promotion: I suggest [my Racket port](https://docs.racket-lang.org/slib-format/index.html) of the Scheme version of Common Lisp `format` from SLIB instead of SRFI-48 for anything complicated as it supports far more functionality.

---

<div class="post-metadata">

**Author:** ![robby](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/robby/32/7_2.png) [@robby](https://racket.discourse.group/u/robby)\
**Post date:** [March 25, 2024, 6:32pm UTC](https://racket.discourse.group/t/srfi-48-is-it-possible-to-get-rid-of-the-decimal-point/2836/6 "2024-03-25T18:32:22Z")

</div>

> [@Tyrn](#):
>
> Thanks! Do I have to use it with `format` like this?
> 
> `(format "~a~a" (~r qt #:precision 0) unit)`

You can also use the `~a` function:

```scheme
(~a (~r qt #:precision 0) unit)

```
