Re: [racket-users] printing decimals

2019-03-15 Thread Laurent
You're probably looking for `real->decimal-string`.

Also take a look at ~r instead of ~a, as the former is only for numbers.

On Fri, Mar 15, 2019 at 5:57 PM  wrote:

> Hi all,
>
> I've been looking through the docs for a way to print decimals to a
> defined precision.
>
> I can get close to what I want using something like ~a and giving it a set
> width without having to build a function to do so. I mean I can build a
> function to do as its just a bit of string manip but it feels really odd
> that there doesn't seem to be a built in way to do so even though we try to
> keep all the decimals in fractional notation to maintain precision as long
> as possible in racket.
>
> any ideas anyone or am I just being blind and its right there in the docs
> somewhere?
>
> thanks,
> Scott
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] printing decimals

2019-03-15 Thread sdgudeman
sigh good greif I was being blind its all of a page or so below ~a 
thank you Jon

On Friday, March 15, 2019 at 12:58:58 PM UTC-5, Jon Zeppieri wrote:
>
>
> https://docs.racket-lang.org/reference/strings.html?q=~r#%28def._%28%28lib._racket%2Fformat..rkt%29._~7er%29%29
>
> On Fri, Mar 15, 2019 at 1:57 PM > wrote:
>
>> Hi all,
>>
>> I've been looking through the docs for a way to print decimals to a 
>> defined precision.
>>
>> I can get close to what I want using something like ~a and giving it a 
>> set width without having to build a function to do so. I mean I can build a 
>> function to do as its just a bit of string manip but it feels really odd 
>> that there doesn't seem to be a built in way to do so even though we try to 
>> keep all the decimals in fractional notation to maintain precision as long 
>> as possible in racket.
>>
>> any ideas anyone or am I just being blind and its right there in the docs 
>> somewhere?
>>
>> thanks,
>> Scott
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] printing decimals

2019-03-15 Thread Jon Zeppieri
https://docs.racket-lang.org/reference/strings.html?q=~r#%28def._%28%28lib._racket%2Fformat..rkt%29._~7er%29%29

On Fri, Mar 15, 2019 at 1:57 PM  wrote:

> Hi all,
>
> I've been looking through the docs for a way to print decimals to a
> defined precision.
>
> I can get close to what I want using something like ~a and giving it a set
> width without having to build a function to do so. I mean I can build a
> function to do as its just a bit of string manip but it feels really odd
> that there doesn't seem to be a built in way to do so even though we try to
> keep all the decimals in fractional notation to maintain precision as long
> as possible in racket.
>
> any ideas anyone or am I just being blind and its right there in the docs
> somewhere?
>
> thanks,
> Scott
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] printing decimals

2019-03-15 Thread sdgudeman
Hi all,

I've been looking through the docs for a way to print decimals to a defined 
precision.

I can get close to what I want using something like ~a and giving it a set 
width without having to build a function to do so. I mean I can build a 
function to do as its just a bit of string manip but it feels really odd 
that there doesn't seem to be a built in way to do so even though we try to 
keep all the decimals in fractional notation to maintain precision as long 
as possible in racket.

any ideas anyone or am I just being blind and its right there in the docs 
somewhere?

thanks,
Scott

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.