Jump to content

Getting the number of decimal places: Difference between revisions

Added Easylang
m (→‎{{header|Wren}}: Changed to Wren S/H)
(Added Easylang)
Line 282:
12.34555555555555555555 has 20 decimals
1234500000000000060751116919315055127939946206157864960.000000 has 6 decimals
</pre>
 
=={{header|EasyLang}}==
<syntaxhighlight>
func ndec n .
while abs (n - floor (n + 1e-15)) > 1e-15
n *= 10
r += 1
.
return r
.
for i in [ 0.00000000000001 12.345 12.3450 1.1 0.1234567 ]
write ndec i & " "
.
</syntaxhighlight>
{{out}}
<pre>
14 3 3 1 7
</pre>
 
Line 298 ⟶ 316:
5
</pre>
 
=={{header|FreeBASIC}}==
<syntaxhighlight lang="freebasic">Function dec(n As Double) As Uinteger
2,063

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.