Casting fraction number to decimal throws Arithmetic overflow error

I have a table called AssignmentMarks that stores Student’s assignment marks for different subjects. This table has a column called Marks varchar(10) which stores the marks. The marks can be like 1, 2, and also it can be +, - or -+ which represents each sign a specific marks.

Note: + is 1 mark, - is -1 and -+ is 0.5

While getting a student marks from the table I am facing the Arithmetic Overflow error which I don’t know what is the cause of this error.

The query is as follow:

SELECT SUM(    CAST(       CASE         WHEN a.Marks IS NULL OR a.Marks = '' THEN 0        WHEN a.Marks = '+' THEN 1        WHEN a.Marks = '-' THEN -1        WHEN a.Marks = '-+' THEN 0.5        ELSE a.Marks       END AS DECIMAL(5,2)    ) ) FROM AssignmentMarks AS a WHERE a.StudentID=10 AND a.SubjectID=1 

After Executing the above query I get the following error.

Msg 8115, Level 16, State 8, Line 7

Arithmetic overflow error converting varchar to data type numeric.

Any idea what is the main cause of this error?

Computing continued fraction

I want to build this infinite continued fraction

$ $ F_{n}(x)= \frac{1}{1-x\frac{(n+1)^2}{4(n+1)^2-1}F_{n+1}(x)} $ $

which gives for $ n=0$

$ $ F_{0}(x)=\dfrac{1}{1-\dfrac{(1/3)x}{1-\dfrac{(4/15)x}{1-\dfrac{(9/35)x}{1-\ddots}}}}$ $ I took inspiration from this Post (@Michael E2), the problem is that when I transform it as a list representation

{b0,{a1, b1},{a2, b2},...}  Clear[F2,iF2];  iF2[0]=0; iF2[1]={1,1}; iF2[2]={-x/3,1}; iF2[n_]:={-x(n+1)^2/(4(n+1)^2-1),1}; F2[n_]:=Table[iF2[k],{k,0,n}]; 

I can’t find all the terms, so I find for 5 terms

Block[{n=5},F2[n]] (*{0,{1,1},{-x/3,1},{-16x/63,1},{-25x/99,1},{-36x/143,1}}*) 

it lacks after {$ -x/3,1$ } the terms {$ -4x/15,1$ } and {$ -9x/35,1$ }

What is wrong please?

Divergent Series & Continued Fraction (from Gauss’ Mathematical Diary)

I’ve asked that question before on History of Science and Mathematics but haven’t received an answer

Does someone have a reference or further explanation on Gauß’ entry from May 24, 1796 in his mathematical diary (Mathematisches Tagebuch, full scan available via https://gdz.sub.uni-goettingen.de/id/DE-611-HS-3382323) on page 3 regarding the divergent series $ $ 1-2+8-64…$ $ in relation to the continued fraction $ $ \frac{1}{1+\frac{2}{1+\frac{2}{1+\frac{8}{1+\frac{12}{1+\frac{32}{1+\frac{56}{1+128}}}}}}}$ $

He states also – if I read it correctly – Transformatio seriei which could mean series transformation, but I don’t see how he transforms from the series to the continued fraction resp. which transformation or rule he applied.

The OEIS has an entry (https://oeis.org/A014236) for the sequence $ 2,2,8,12,32,56,128$ , but I don’t see the connection either.

My question: Can anyone help or clarify the relationship that Gauss’ used?

Torsten Schoeneberg remarked rightfully in the original question that the term in the series are $ (-1)^n\cdot 2^{\frac{1}{2}n(n+1)}$ and Gerald Edgar conjectures it might be related to Gauss’ Continued Fraction.

Why we need size of the page table should be some fraction of virtual address space

The Page Table should have all virtual page number which are in its logical address space, Why it’s the case?

  1. Is it because we want to access Page Table entry fast just like an array where key is virtual page number i.e. constant time?

Or

  1. Is it due to structure of the process? (I mean Our program uses whole logical space; In general at address 0 we have Code and at address Max we have stack which is variable. Which means can point to any address of logical address space)

Algorithm for Egyptian Fraction

An Egyptian fraction was written as a sum of unit fractions, meaning the numerator is always 1; further, no two denominators can be the same. As easy way to create an Egyptian fraction is to repeatedly take the largest unit fraction that will fit, subtract to find what remains, and repeat until the remainder is a unit fraction, for example:

  1. 7 divided by 15 is less than 1/2 but more than 1/3, so the first unit fraction is 1/3 and the first remainder is 2/15.

  2. Then 2/15 is less than 1/7 but more than 1/8, so the second unit fraction is 1/8 and the second remainder is 1/120.

  3. That’s in unit form, so we are finished: 7 ÷ 15 = 1/3 + 1/8 + 1/120

I’m trying to solve the egyptian fraction problem where I’m using the below greedy method:

def egyptianFraction(nr, dr):   print("The Egyptian Fraction " +       "Representation of {0}/{1} is".              format(nr, dr), end="\n")   # empty list ef to store  # denominator  ef = []   # while loop runs until   # fraction becomes 0 i.e,  # numerator becomes 0  while nr != 0:       # taking ceiling      x = math.ceil(dr / nr)       # storing value in ef list      ef.append(x)       # updating new nr and dr      nr = x * nr - dr      dr = dr * x   # printing the values  for i in range(len(ef)):      if i != len(ef) - 1:          print(" 1/{0} +" .                   format(ef[i]), end = " ")      else:          print(" 1/{0}" .                  format(ef[i]), end = " ")  egyptianFraction(6, 14)  

I need to build an algorithm that guarantees a maximum number of terms or a minimum largest denominator; for instance,

5 ÷ 121 = 1/25 + 1/757 + 1/763309 + 1/873960180913 +  1/1527612795642093418846225  but a simpler rendering of the same number is  1/33 + 1/121 + 1/363. 

I need to convert fraction to hex but there is perhaps a mask [on hold]

I get the following values from a machine. I type the hex value in and it sets the machine to a decimal with two places after the point.

Machine setting hex value
0.1 3DCCCCCD
0.11 3DE147AE
0.12 3DF5C28F
0.13 3E051EB8
0.25 3E800000
0.5 3F000000
0.75 3F400000
1 3F800000
2 40000000

I take 0.31 and I work it out to 0.4F5C28F6 but the machine says 0.31=3E9EB852 How do I get from 0.4F5C28F6 to 3E9EB852 is there some mask I need to apply?