Warning: Constant WPLANG already defined in /var/www/blog/wp-config.php on line 84

Warning: Cannot modify header information - headers already sent by (output started at /var/www/blog/wp-config.php:84) in /var/www/blog/wp-content/plugins/wc-captcha/includes/class-cookie-session.php on line 46

Warning: Cannot modify header information - headers already sent by (output started at /var/www/blog/wp-config.php:84) in /var/www/blog/wp-content/plugins/wc-captcha/includes/class-cookie-session.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /var/www/blog/wp-config.php:84) in /var/www/blog/wp-content/plugins/wc-captcha/includes/class-cookie-session.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /var/www/blog/wp-config.php:84) in /var/www/blog/wp-content/plugins/wc-captcha/includes/class-cookie-session.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /var/www/blog/wp-config.php:84) in /var/www/blog/wp-content/plugins/wc-captcha/includes/class-cookie-session.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /var/www/blog/wp-config.php:84) in /var/www/blog/wp-content/plugins/wc-captcha/includes/class-cookie-session.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /var/www/blog/wp-config.php:84) in /var/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /var/www/blog/wp-config.php:84) in /var/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /var/www/blog/wp-config.php:84) in /var/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /var/www/blog/wp-config.php:84) in /var/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /var/www/blog/wp-config.php:84) in /var/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /var/www/blog/wp-config.php:84) in /var/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /var/www/blog/wp-config.php:84) in /var/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /var/www/blog/wp-config.php:84) in /var/www/blog/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":593,"date":"2015-01-06T16:48:02","date_gmt":"2015-01-06T15:48:02","guid":{"rendered":"http:\/\/www.hauweele.net\/~gawen\/blog\/?p=593"},"modified":"2015-01-06T16:48:02","modified_gmt":"2015-01-06T15:48:02","slug":"fp-comparison-in-shell","status":"publish","type":"post","link":"https:\/\/hauweele.net\/~gawen\/blog\/?p=593","title":{"rendered":"FP comparison in Shell"},"content":{"rendered":"

People tend to not like Shell. But I do!
\nHere is a simple example, try this floating point comparison:<\/p>\n

$ [ 0.1 -gt 0.01 ]\r\n[: 0.1: bad number\r\n<\/pre>\n

The shell itself cannot use float.
\nBut there are multiple workarounds.\u00a0Here is the one I prefer:<\/p>\n

if rpnc \"$a\" \"$b\" - | grep \"^-\" > \/dev\/null\r\nthen\r\n  echo \"a < b\"\r\nfi\r\n<\/pre>\n

Although you may not have the rpnc<\/em> command,\u00a0so here is another one:<\/p>\n

if [ $(echo \"$a < $b\" | bc) -eq 1 ]\r\nthen\r\n  echo \"a < b\"\r\nfi<\/pre>\n","protected":false},"excerpt":{"rendered":"

People tend to not like Shell. But I do! Here is a simple example, try this floating point comparison: $ [ 0.1 -gt 0.01 ] [: 0.1: bad number The shell itself cannot use float. But there are multiple workarounds.\u00a0Here … Continue reading →<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[534,532,530,529,535,531,533,30],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts\/593"}],"collection":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=593"}],"version-history":[{"count":0,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts\/593\/revisions"}],"wp:attachment":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}