Hmm... Okay. Actually, I think I was confused with auto promotion of 
integer types. I was quite impressed that Clojure automatically add 'N' 
when I type big integer like '69487463928746987124659827635827'.
However, I was suprised when I type '6.9487463928746987124659827635827', 
because the result, '6.948746392874699', was truncated. '1e400' and 
'1e-400' was same. I hope '1e400M' and '1e-400M' to be printed, but it was 
just 'Infinity' and '0.0'.
And I was little bit disappointed after I used *' (asterisk-quote) 
function, which automatically promotes integer type. (*' 1e200 1e200) was 
not '1e400M' but 'Infinity'. Why the functions don't cover double type?

.......oh, I see. It's the matter of how often 
overflow/underflow/truncation occurs. Double type almost always truncates 
digits so auto-promoting function will be useless. And also, BigDecimal 
doesn't supports division well. For those reason floating point types 
doesn't act like integer types!

Thank everyone for answering!


On Wednesday, December 23, 2015 at 4:47:09 PM UTC+9, Mikera wrote:
>
> I personally think the current approach is right. Most people don't need 
> arbitrary precision decimals, so it makes sense to have the fastest 
> implementation used as the default. This also follows the "principle of 
> least surprise" for people who are coming from other languages.
>
> If someone really wants to use arbitrary precision decimals, they can ask 
> for it explicitly. But it wouldn't make sense to force this (quite 
> significant) overhead on people who don't want them (or don't even realise 
> the difference).
>
> On Tuesday, 22 December 2015 23:47:43 UTC, Gary Fredericks wrote:
>>
>> Am I missing something? I realize doubles are generally faster because of 
>> hardware implementations &c, but that seems orthogonal from the question of 
>> syntax. I've several times thought idealistically that it could be better 
>> to have the syntaxes switched (to reduce the amount of accidental floating 
>> point use), and the only downsides I know of are A) surprising people 
>> (especially people who think they can divide 2 by 3 without thinking about 
>> it), and B) needing to be more careful when you're trying to use doubles 
>> for performance. Maybe you were referring to B?
>>
>> Of course I do realize it's *way* too late to change it now ☺.
>>
>> Gary
>>
>> On Tuesday, December 22, 2015 at 9:23:43 AM UTC-6, Alex Miller wrote:
>>>
>>> It's done this way for performance.
>>
>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to