Relative roundoff error in the simple precision.












0












$begingroup$


I am struggling with a simple problem from the computer arithmetics. The goal is to find $|(fl(0.1)-0.1)/0.1|$. I have computed the binary representation of $0.1$, which is $(1.1001)_{2}times2^{-4}$, where the $1001$ after the decimal point is periodic. I know that $fl(0.1)$ is rounding the $0.1$ up, so we get $(1.1001...101)_{2}times2^{-4}$, where the last digit is on the $-23$rd position. But I don't know how to compute the relative error. Thank you for any help.










share|cite|improve this question











$endgroup$












  • $begingroup$
    Yes, thank you, I edited
    $endgroup$
    – Vwann
    Jan 4 at 20:35
















0












$begingroup$


I am struggling with a simple problem from the computer arithmetics. The goal is to find $|(fl(0.1)-0.1)/0.1|$. I have computed the binary representation of $0.1$, which is $(1.1001)_{2}times2^{-4}$, where the $1001$ after the decimal point is periodic. I know that $fl(0.1)$ is rounding the $0.1$ up, so we get $(1.1001...101)_{2}times2^{-4}$, where the last digit is on the $-23$rd position. But I don't know how to compute the relative error. Thank you for any help.










share|cite|improve this question











$endgroup$












  • $begingroup$
    Yes, thank you, I edited
    $endgroup$
    – Vwann
    Jan 4 at 20:35














0












0








0





$begingroup$


I am struggling with a simple problem from the computer arithmetics. The goal is to find $|(fl(0.1)-0.1)/0.1|$. I have computed the binary representation of $0.1$, which is $(1.1001)_{2}times2^{-4}$, where the $1001$ after the decimal point is periodic. I know that $fl(0.1)$ is rounding the $0.1$ up, so we get $(1.1001...101)_{2}times2^{-4}$, where the last digit is on the $-23$rd position. But I don't know how to compute the relative error. Thank you for any help.










share|cite|improve this question











$endgroup$




I am struggling with a simple problem from the computer arithmetics. The goal is to find $|(fl(0.1)-0.1)/0.1|$. I have computed the binary representation of $0.1$, which is $(1.1001)_{2}times2^{-4}$, where the $1001$ after the decimal point is periodic. I know that $fl(0.1)$ is rounding the $0.1$ up, so we get $(1.1001...101)_{2}times2^{-4}$, where the last digit is on the $-23$rd position. But I don't know how to compute the relative error. Thank you for any help.







numerical-methods computer-arithmetic






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jan 4 at 20:35







Vwann

















asked Jan 4 at 20:16









VwannVwann

225




225












  • $begingroup$
    Yes, thank you, I edited
    $endgroup$
    – Vwann
    Jan 4 at 20:35


















  • $begingroup$
    Yes, thank you, I edited
    $endgroup$
    – Vwann
    Jan 4 at 20:35
















$begingroup$
Yes, thank you, I edited
$endgroup$
– Vwann
Jan 4 at 20:35




$begingroup$
Yes, thank you, I edited
$endgroup$
– Vwann
Jan 4 at 20:35










1 Answer
1






active

oldest

votes


















0












$begingroup$

Just plug into the formula. You have $fl(0.1)$ and $0.1$ so now subtract. Starting from the last position in your $fl(0.1)$ the true value continues $011 001 100ldots$ so if we subtract we get (about) $001$ with the first $0$ matching the last $1$ in $fl(0.1)$. That is $22$ places to the right of the radix point, so the difference is $2^{-4}cdot 2^{-22}cdot 2^{-2}=2^{-28}$ where the first factor is from the exponent of $fl(0.1)$, the second is from all the places to the right of the radix point, and the third is the two places the $1$ in the error is to the right of the end of $fl(0.1)$. The relative error is then $frac {2^{-28}}{0.1}approx 3.7cdot 10^{-8}$



If you want the exact answer, you need the exact value of $fl(0.1)$. I asked Alpha and got $frac {6710885}{16cdot4194304}$. Then the relative error is $10(frac {6710885}{16cdot4194304}-frac 1{10})=-frac 7{33554432}$






share|cite|improve this answer











$endgroup$













  • $begingroup$
    I have a slightly different answer
    $endgroup$
    – Vwann
    Jan 4 at 21:16










  • $begingroup$
    For the absolute error I get 1/10×2^(-26)
    $endgroup$
    – Vwann
    Jan 4 at 21:17










  • $begingroup$
    And relative is therefore 2^(-26)
    $endgroup$
    – Vwann
    Jan 4 at 21:18










  • $begingroup$
    My computation of $fl(0.1)-0.1$ was not exact. Usually we are only interested in the magnitude of errors like this. $2^{-26}$ is not correct because that is the whole value of the last $1$ in your expression, but $0.1$ is greater than your expression with the last $1$ changed to a $0$.
    $endgroup$
    – Ross Millikan
    Jan 4 at 21:18












  • $begingroup$
    Well, not in this case. The question is about the precise value. Thank you anyway
    $endgroup$
    – Vwann
    Jan 4 at 21:19











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3062055%2frelative-roundoff-error-in-the-simple-precision%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0












$begingroup$

Just plug into the formula. You have $fl(0.1)$ and $0.1$ so now subtract. Starting from the last position in your $fl(0.1)$ the true value continues $011 001 100ldots$ so if we subtract we get (about) $001$ with the first $0$ matching the last $1$ in $fl(0.1)$. That is $22$ places to the right of the radix point, so the difference is $2^{-4}cdot 2^{-22}cdot 2^{-2}=2^{-28}$ where the first factor is from the exponent of $fl(0.1)$, the second is from all the places to the right of the radix point, and the third is the two places the $1$ in the error is to the right of the end of $fl(0.1)$. The relative error is then $frac {2^{-28}}{0.1}approx 3.7cdot 10^{-8}$



If you want the exact answer, you need the exact value of $fl(0.1)$. I asked Alpha and got $frac {6710885}{16cdot4194304}$. Then the relative error is $10(frac {6710885}{16cdot4194304}-frac 1{10})=-frac 7{33554432}$






share|cite|improve this answer











$endgroup$













  • $begingroup$
    I have a slightly different answer
    $endgroup$
    – Vwann
    Jan 4 at 21:16










  • $begingroup$
    For the absolute error I get 1/10×2^(-26)
    $endgroup$
    – Vwann
    Jan 4 at 21:17










  • $begingroup$
    And relative is therefore 2^(-26)
    $endgroup$
    – Vwann
    Jan 4 at 21:18










  • $begingroup$
    My computation of $fl(0.1)-0.1$ was not exact. Usually we are only interested in the magnitude of errors like this. $2^{-26}$ is not correct because that is the whole value of the last $1$ in your expression, but $0.1$ is greater than your expression with the last $1$ changed to a $0$.
    $endgroup$
    – Ross Millikan
    Jan 4 at 21:18












  • $begingroup$
    Well, not in this case. The question is about the precise value. Thank you anyway
    $endgroup$
    – Vwann
    Jan 4 at 21:19
















0












$begingroup$

Just plug into the formula. You have $fl(0.1)$ and $0.1$ so now subtract. Starting from the last position in your $fl(0.1)$ the true value continues $011 001 100ldots$ so if we subtract we get (about) $001$ with the first $0$ matching the last $1$ in $fl(0.1)$. That is $22$ places to the right of the radix point, so the difference is $2^{-4}cdot 2^{-22}cdot 2^{-2}=2^{-28}$ where the first factor is from the exponent of $fl(0.1)$, the second is from all the places to the right of the radix point, and the third is the two places the $1$ in the error is to the right of the end of $fl(0.1)$. The relative error is then $frac {2^{-28}}{0.1}approx 3.7cdot 10^{-8}$



If you want the exact answer, you need the exact value of $fl(0.1)$. I asked Alpha and got $frac {6710885}{16cdot4194304}$. Then the relative error is $10(frac {6710885}{16cdot4194304}-frac 1{10})=-frac 7{33554432}$






share|cite|improve this answer











$endgroup$













  • $begingroup$
    I have a slightly different answer
    $endgroup$
    – Vwann
    Jan 4 at 21:16










  • $begingroup$
    For the absolute error I get 1/10×2^(-26)
    $endgroup$
    – Vwann
    Jan 4 at 21:17










  • $begingroup$
    And relative is therefore 2^(-26)
    $endgroup$
    – Vwann
    Jan 4 at 21:18










  • $begingroup$
    My computation of $fl(0.1)-0.1$ was not exact. Usually we are only interested in the magnitude of errors like this. $2^{-26}$ is not correct because that is the whole value of the last $1$ in your expression, but $0.1$ is greater than your expression with the last $1$ changed to a $0$.
    $endgroup$
    – Ross Millikan
    Jan 4 at 21:18












  • $begingroup$
    Well, not in this case. The question is about the precise value. Thank you anyway
    $endgroup$
    – Vwann
    Jan 4 at 21:19














0












0








0





$begingroup$

Just plug into the formula. You have $fl(0.1)$ and $0.1$ so now subtract. Starting from the last position in your $fl(0.1)$ the true value continues $011 001 100ldots$ so if we subtract we get (about) $001$ with the first $0$ matching the last $1$ in $fl(0.1)$. That is $22$ places to the right of the radix point, so the difference is $2^{-4}cdot 2^{-22}cdot 2^{-2}=2^{-28}$ where the first factor is from the exponent of $fl(0.1)$, the second is from all the places to the right of the radix point, and the third is the two places the $1$ in the error is to the right of the end of $fl(0.1)$. The relative error is then $frac {2^{-28}}{0.1}approx 3.7cdot 10^{-8}$



If you want the exact answer, you need the exact value of $fl(0.1)$. I asked Alpha and got $frac {6710885}{16cdot4194304}$. Then the relative error is $10(frac {6710885}{16cdot4194304}-frac 1{10})=-frac 7{33554432}$






share|cite|improve this answer











$endgroup$



Just plug into the formula. You have $fl(0.1)$ and $0.1$ so now subtract. Starting from the last position in your $fl(0.1)$ the true value continues $011 001 100ldots$ so if we subtract we get (about) $001$ with the first $0$ matching the last $1$ in $fl(0.1)$. That is $22$ places to the right of the radix point, so the difference is $2^{-4}cdot 2^{-22}cdot 2^{-2}=2^{-28}$ where the first factor is from the exponent of $fl(0.1)$, the second is from all the places to the right of the radix point, and the third is the two places the $1$ in the error is to the right of the end of $fl(0.1)$. The relative error is then $frac {2^{-28}}{0.1}approx 3.7cdot 10^{-8}$



If you want the exact answer, you need the exact value of $fl(0.1)$. I asked Alpha and got $frac {6710885}{16cdot4194304}$. Then the relative error is $10(frac {6710885}{16cdot4194304}-frac 1{10})=-frac 7{33554432}$







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Jan 4 at 21:29

























answered Jan 4 at 20:42









Ross MillikanRoss Millikan

298k24200373




298k24200373












  • $begingroup$
    I have a slightly different answer
    $endgroup$
    – Vwann
    Jan 4 at 21:16










  • $begingroup$
    For the absolute error I get 1/10×2^(-26)
    $endgroup$
    – Vwann
    Jan 4 at 21:17










  • $begingroup$
    And relative is therefore 2^(-26)
    $endgroup$
    – Vwann
    Jan 4 at 21:18










  • $begingroup$
    My computation of $fl(0.1)-0.1$ was not exact. Usually we are only interested in the magnitude of errors like this. $2^{-26}$ is not correct because that is the whole value of the last $1$ in your expression, but $0.1$ is greater than your expression with the last $1$ changed to a $0$.
    $endgroup$
    – Ross Millikan
    Jan 4 at 21:18












  • $begingroup$
    Well, not in this case. The question is about the precise value. Thank you anyway
    $endgroup$
    – Vwann
    Jan 4 at 21:19


















  • $begingroup$
    I have a slightly different answer
    $endgroup$
    – Vwann
    Jan 4 at 21:16










  • $begingroup$
    For the absolute error I get 1/10×2^(-26)
    $endgroup$
    – Vwann
    Jan 4 at 21:17










  • $begingroup$
    And relative is therefore 2^(-26)
    $endgroup$
    – Vwann
    Jan 4 at 21:18










  • $begingroup$
    My computation of $fl(0.1)-0.1$ was not exact. Usually we are only interested in the magnitude of errors like this. $2^{-26}$ is not correct because that is the whole value of the last $1$ in your expression, but $0.1$ is greater than your expression with the last $1$ changed to a $0$.
    $endgroup$
    – Ross Millikan
    Jan 4 at 21:18












  • $begingroup$
    Well, not in this case. The question is about the precise value. Thank you anyway
    $endgroup$
    – Vwann
    Jan 4 at 21:19
















$begingroup$
I have a slightly different answer
$endgroup$
– Vwann
Jan 4 at 21:16




$begingroup$
I have a slightly different answer
$endgroup$
– Vwann
Jan 4 at 21:16












$begingroup$
For the absolute error I get 1/10×2^(-26)
$endgroup$
– Vwann
Jan 4 at 21:17




$begingroup$
For the absolute error I get 1/10×2^(-26)
$endgroup$
– Vwann
Jan 4 at 21:17












$begingroup$
And relative is therefore 2^(-26)
$endgroup$
– Vwann
Jan 4 at 21:18




$begingroup$
And relative is therefore 2^(-26)
$endgroup$
– Vwann
Jan 4 at 21:18












$begingroup$
My computation of $fl(0.1)-0.1$ was not exact. Usually we are only interested in the magnitude of errors like this. $2^{-26}$ is not correct because that is the whole value of the last $1$ in your expression, but $0.1$ is greater than your expression with the last $1$ changed to a $0$.
$endgroup$
– Ross Millikan
Jan 4 at 21:18






$begingroup$
My computation of $fl(0.1)-0.1$ was not exact. Usually we are only interested in the magnitude of errors like this. $2^{-26}$ is not correct because that is the whole value of the last $1$ in your expression, but $0.1$ is greater than your expression with the last $1$ changed to a $0$.
$endgroup$
– Ross Millikan
Jan 4 at 21:18














$begingroup$
Well, not in this case. The question is about the precise value. Thank you anyway
$endgroup$
– Vwann
Jan 4 at 21:19




$begingroup$
Well, not in this case. The question is about the precise value. Thank you anyway
$endgroup$
– Vwann
Jan 4 at 21:19


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3062055%2frelative-roundoff-error-in-the-simple-precision%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Quarter-circle Tiles

build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

Mont Emei