{"id":627,"date":"2012-08-20T11:57:01","date_gmt":"2012-08-20T09:57:01","guid":{"rendered":"https:\/\/d-mueller.de\/blog\/?p=627"},"modified":"2012-08-21T23:04:26","modified_gmt":"2012-08-21T21:04:26","slug":"mysql-spass-mit-float","status":"publish","type":"post","link":"https:\/\/d-mueller.de\/blog\/mysql-spass-mit-float\/","title":{"rendered":"MySQL: Spa\u00df mit float"},"content":{"rendered":"<p>Man nehme folgenden Code:<\/p>\n<pre data-enlighter-language=\"mysql\" class=\"EnlighterJSRAW\">\r\nDROP DATABASE IF EXISTS test;\r\nCREATE DATABASE test;\r\nUSE test;\r\nDROP TABLE IF EXISTS test;\r\nCREATE TABLE test (number_double DOUBLE, number_float FLOAT);\r\nINSERT INTO test VALUES (1000000000000000, 1000000000000000);\r\nSELECT number_double, number_float FROM test;\r\n<\/pre>\n<div id=\"attachment_628\" style=\"width: 493px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/08\/exponent.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-628\" src=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/08\/exponent.png\" alt=\"Exponentendarstellung\" title=\"Exponentendarstellung\" width=\"483\" height=\"139\" class=\"size-full wp-image-628\" srcset=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/08\/exponent.png 483w, https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/08\/exponent-300x86.png 300w\" sizes=\"auto, (max-width: 483px) 100vw, 483px\" \/><\/a><p id=\"caption-attachment-628\" class=\"wp-caption-text\">Exponentendarstellung<\/p><\/div>\n<p>Okay, soweit noch keine Sensation. Wenn man nun aber MySQL dazu zwingt, den konkreten und exponentenfreien Wert rauszur\u00fccken, indem man folgenderma\u00dfen selektiert:<\/p>\n<pre data-enlighter-language=\"mysql\" class=\"EnlighterJSRAW\">\r\nSELECT number_double * 1, number_float * 1 FROM test;\r\n<\/pre>\n<p>offenbart sich:<\/p>\n<div id=\"attachment_629\" style=\"width: 564px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/08\/exakt.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-629\" src=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/08\/exakt.png\" alt=\"Exakter Wert\" title=\"Exakter Wert\" width=\"554\" height=\"129\" class=\"size-full wp-image-629\" srcset=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/08\/exakt.png 554w, https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/08\/exakt-300x69.png 300w\" sizes=\"auto, (max-width: 554px) 100vw, 554px\" \/><\/a><p id=\"caption-attachment-629\" class=\"wp-caption-text\">Exakter Wert<\/p><\/div>\n<p>Gleiches Spiel selbstverst\u00e4ndlich, wenn ich den Wert per PHP aus der Datenbank heraushole.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Man nehme folgenden Code: DROP DATABASE IF EXISTS test; CREATE DATABASE test; USE test; DROP TABLE IF EXISTS test; CREATE TABLE test (number_double DOUBLE, number_float FLOAT); INSERT INTO test VALUES (1000000000000000, 1000000000000000); SELECT number_double, number_float FROM test; Okay, soweit noch &hellip; <a href=\"https:\/\/d-mueller.de\/blog\/mysql-spass-mit-float\/\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,9,3],"tags":[],"class_list":["post-627","post","type-post","status-publish","format-standard","hentry","category-php","category-datenbanken","category-webdev"],"_links":{"self":[{"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/posts\/627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/comments?post=627"}],"version-history":[{"count":0,"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/posts\/627\/revisions"}],"wp:attachment":[{"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/media?parent=627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/categories?post=627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/tags?post=627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}