Project

General

Profile

Actions

Bug #15544

closed

sprintf returns an unexpected string

Added by areman01 (André Kullmann) over 5 years ago. Updated over 5 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
[ruby-core:91142]

Description

Hello,

I've a little problem with the sprintf function. It returns unexpected results ( in my opinion )

sprintf("%.16g", 8.78)
# returns "8.779999999999999"
# my expected result is "8.78"

Can somebody explain this behavior to me ?

Best Begards

Actions

Also available in: Atom PDF

Like0
Like0Like0