Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

Asynchronous inputs are at the root of our race problems. -- D. Winker and F. Prosser


programming / alt.lang.asm / Re: The Truth about Corona Virus Situation and what every person should know.

Subject: Re: The Truth about Corona Virus Situation and what every person should know.
From: skybuck2...@hotmail.com
Newsgroups: alt.lang.asm
Date: Sun, 22 Mar 2020 06:29 UTC
References: 1 2
X-Received: by 2002:aed:2ee1:: with SMTP id k88mr16330678qtd.268.1584858576467;
Sat, 21 Mar 2020 23:29:36 -0700 (PDT)
X-Received: by 2002:a25:f20f:: with SMTP id i15mr16677537ybe.364.1584858576184;
Sat, 21 Mar 2020 23:29:36 -0700 (PDT)
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Sat, 21 Mar 2020 23:29:35 -0700 (PDT)
In-Reply-To: <r51nlb$hth$1@gioia.aioe.org>
Complaints-To: groups-abuse@google.com
Injection-Info: google-groups.googlegroups.com; posting-host=84.25.116.141; posting-account=np6u_wkAAADxbE7UBGUIOm-csir6aX02
NNTP-Posting-Host: 84.25.116.141
References: <fe6113b1-4b35-457c-8d82-36949e148347@googlegroups.com> <r51nlb$hth$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c31fd335-1859-4ab2-bc3a-1e906686da53@googlegroups.com>
Subject: Re: The Truth about Corona Virus Situation and what every person
should know.
From: skybuck2...@hotmail.com
Injection-Date: Sun, 22 Mar 2020 06:29:36 +0000
Content-Type: text/plain; charset="UTF-8"
View all headers
On Friday, March 20, 2020 at 7:25:49 AM UTC+1, wolfgang kern wrote:
On 19.03.2020 09:19, skybuck2000@hotmail.com wrote:
...
Now a realistic calculation of how this virus / corona / situation will develop in the coming days from March 19 (month 3) 2020:

Day   Date        Known Infections              ICU:
1     19/3/2020    2051.00 * 1.3 =   2666.30     171.00 * 1.3 =   222.30
2     20/3/2020    2666.30 * 1.3 =   3466.19     222.30 * 1.3 =   288.99
3     21/3/2020    3466.19 * 1.3 =   4506.05     288.99 * 1.3 =   375.68
4     22/3/2020    4506.05 * 1.3 =   5857.86     375.68 * 1.3 =   488.39
5     23/3/2020    5857.86 * 1.3 =   7615.21     488.39 * 1.3 =   634.91
6     24/3/2020    7615.21 * 1.3 =   9899.78     634.91 * 1.3 =   825.38
7     25/3/2020    9899.78 * 1.3 =  12869.72     825.38 * 1.3 =  1072.99
8     26/3/2020   12869.72 * 1.3 =  16730.63    1072.99 * 1.3 =  1394.89
9     27/3/2020   16730.63 * 1.3 =  21749.82    1394.89 * 1.3 =  1813.36
10    28/3/2020   21749.82 * 1.3 =  28274.77    1813.36 * 1.3 =  2357.38
11    29/3/2020   28274.77 * 1.3 =  36757.20    2357.38 * 1.3 =  3064.59
12    30/3/2020   36757.20 * 1.3 =  47784.37    3064.59 * 1.3 =  3983.97
13    31/3/2020   47784.37 * 1.3 =  62119.68    3983.97 * 1.3 =  5179.16
14     1/4/2020   62119.68 * 1.3 =  80755.58    5179.16 * 1.3 =  6732.91
15     2/4/2020   80755.58 * 1.3 = 104982.26    6732.91 * 1.3 =  8752.78
16     3/4/2020  104982.26 * 1.3 = 136476.94    8752.78 * 1.3 = 11378.62
17     4/4/2020  136476.94 * 1.3 = 177420.03   11378.62 * 1.3 = 14792.21
18     5/4/2020  177420.03 * 1.3 = 230646.03   14792.21 * 1.3 = 19229.87
19     6/4/2020  230646.03 * 1.3 = 299839.85   19229.87 * 1.3 = 24998.83
20     7/4/2020  299839.85 * 1.3 = 389791.80   24998.83 * 1.3 = 32498.48
21     8/4/2020  389791.80 * 1.3 = 506729.34   32498.48 * 1.3 = 42248.03

I calculated this with the calculator in windows. I can also write a computer program for it that calculates this automatically and so that the factor can be changed if it changes in the near future.

I'd calculate it shorter:
2051 * 1.3^21 = 506729.34
171  * 1.3^21 =  42248.03

How is this shorter ? LOL... you typing ^21 characters additional, more error prone too with the power function on calculator.

Remember this has to be calculated for each day to show politicians how it evolves, in that case this notation is not shorter cause you would have to repeat it every time, hence why I did not do it that way, it got annoying fast.

Only for calculating last day might it be more efficient, at least on the calculator, power and instruction wise on cpu not so sure if it would be a 21 for loop.

On the calculator doing it my way is way more efficient as follows:

2051*1.3=... result.

Then just press the = button on windows calculator and it will automatically perform the next multiplication.

Thus after the initial formula is typed into the calculator I only have to press 21 equal buttons ! =D Do have to count it in my head or note it on paper.

Almost error proof, unless = is repeated to quickly haha.

Also computational in programming languages:

Power function in delphi:

function Power(const Base, Exponent: Extended): Extended;
{$IFNDEF X86ASM}
begin
  FClearExcept;
  if Exponent = 0.0 then
    Result := 1.0               { n**0 = 1 }
  else if (Base = 0.0) and (Exponent > 0.0) then
    Result := 0.0               { 0**n = 0, n > 0 }
  else if (Frac(Exponent) = 0.0) and (Abs(Exponent) <= MaxInt) then
    Result := IntPower(Base, Integer(Trunc(Exponent)))
  else if Base < 0 then
  begin
    Error(reInvalidOp);
    Result := 0; // avoid warning W1035 Return value of function '%s' might be undefined
  end
  else
    Result := Exp(Exponent * Ln(Base));
  FCheckExcept;
end;
{$ELSE X86ASM}
(* ***** BEGIN LICENSE BLOCK *****
 *
 * The function Power is licensed under the CodeGear license terms.
 *
 * The initial developer of the original code is Fastcode
 *
 * Portions created by the initial developer are Copyright (C) 2002-2004
 * the initial developer. All Rights Reserved.
 *
 * Contributor(s): John O'Harrow
 *
 * ***** END LICENSE BLOCK ***** *)
{$IF     defined(CPUX86) and defined(IOS)} // iOS/Simulator
const
  Max  : Double = MaxInt;
var
  IntExp : Integer;
begin
  FClearExcept;
  asm // StackAlignSafe
    fld     tbyte ptr Exponent
    fld     st             {copy to st(1)}
    fabs                   {abs(exp)}
{$IFDEF PIC}
    push    ebx
    call    GetGOT
    pop     ebx
    fld     qword ptr [eax].Max
{$ELSE !PIC}
    fld     Max
{$ENDIF !PIC}
    fcompp                 {leave exp in st(0)}
    fstsw   ax
    sahf
    jb      @@RealPower    {exp > MaxInt}
    fld     st             {exp in st(0) and st(1)}
    frndint                {round(exp)}
    fcomp                  {compare exp and round(exp)}
    fstsw   ax
    sahf
    jne     @@RealPower
    fistp   IntExp
    mov     eax, IntExp    {eax=Trunc(Exponent)}
    mov     ecx, eax
    cdq
    fld1                   {Result=1}
    xor     eax, edx
    sub     eax, edx       {abs(exp)}
    jz      @@Exit
    fld     tbyte ptr Base
    jmp     @@Entry
@@Loop:
    fmul    st, st         {Base * Base}
@@Entry:
    shr     eax, 1
    jnc     @@Loop
    fmul    st(1), st      {Result * X}
    jnz     @@Loop
    fstp    st
    cmp     ecx, 0
    jge     @@Exit
    fld1
    fdivrp                 {1/Result}
    jmp     @@Exit
@@RealPower:
    fld     tbyte ptr Base
    ftst
    fstsw   ax
    sahf
    jz      @@Done
    fldln2
    fxch
    fyl2x
    fxch
    fmulp   st(1), st
    fldl2e
    fmulp   st(1), st
    fld     st(0)
    frndint
    fsub    st(1), st
    fxch    st(1)
    f2xm1
    fld1
    faddp   st(1), st
    fscale
@@Done:
    fstp    st(1)
@@Exit:
    fstp    tbyte ptr Result
  end;
  FCheckExcept;
end;
{$ELSE}
const
  Max  : Double = MaxInt;
var
  IntExp : Integer;
asm // StackAlignSafe
  fld     tbyte ptr Exponent
  fld     st             {copy to st(1)}
  fabs                   {abs(exp)}
{$IFDEF PIC}
  push    ebx
  call    GetGOT
  pop     ebx
  fld     qword ptr [eax].Max
{$ELSE !PIC}
  fld     Max
{$ENDIF !PIC}
  fcompp                 {leave exp in st(0)}
  fstsw   ax
  sahf
  jb      @@RealPower    {exp > MaxInt}
  fld     st             {exp in st(0) and st(1)}
  frndint                {round(exp)}
  fcomp                  {compare exp and round(exp)}
  fstsw   ax
  sahf
  jne     @@RealPower
  fistp   IntExp
  mov     eax, IntExp    {eax=Trunc(Exponent)}
  mov     ecx, eax
  cdq
  fld1                   {Result=1}
  xor     eax, edx
  sub     eax, edx       {abs(exp)}
  jz      @@Exit
  fld     tbyte ptr Base
  jmp     @@Entry
@@Loop:
  fmul    st, st         {Base * Base}
@@Entry:
  shr     eax, 1
  jnc     @@Loop
  fmul    st(1), st      {Result * X}
  jnz     @@Loop
  fstp    st
  cmp     ecx, 0
  jge     @@Exit
  fld1
  fdivrp                 {1/Result}
  jmp     @@Exit
@@RealPower:
  fld     tbyte ptr Base
  ftst
  fstsw   ax
  sahf
  jz      @@Done
  fldln2
  fxch
  fyl2x
  fxch
  fmulp   st(1), st
  fldl2e
  fmulp   st(1), st
  fld     st(0)
  frndint
  fsub    st(1), st
  fxch    st(1)
  f2xm1
  fld1
  faddp   st(1), st
  fscale
@@Done:
  fstp    st(1)
@@Exit:
end;
{$ENDIF}
{$ENDIF X86ASM}

function Power(const Base, Exponent: Double): Double; overload;
{$IFNDEF X86ASM}
begin
  FClearExcept;
  if Exponent = 0.0 then
    Result := 1.0               { n**0 = 1 }
  else if (Base = 0.0) and (Exponent > 0.0) then
    Result := 0.0               { 0**n = 0, n > 0 }
  else if (Frac(Exponent) = 0.0) and (Abs(Exponent) <= MaxInt) then
    Result := IntPower(Base, Integer(Trunc(Exponent)))
  else if Base < 0 then
  begin
    Error(reInvalidOp);
    Result := 0; // avoid warning W1035 Return value of function '%s' might be undefined
  end
  else
    Result := Exp(Exponent * Ln(Base));
  FCheckExcept;
end;
{$ELSE X86ASM}
{$IF     defined(CPUX86) and defined(IOS)} // iOS/Simulator
const
  Max  : Double = MaxInt;
var
  IntExp : Integer;
begin
  FClearExcept;
  asm // StackAlignSafe
    fld     Exponent
    fld     st             {copy to st(1)}
    fabs                   {abs(exp)}
{$IFDEF PIC}
    push    ebx
    call    GetGOT
    pop     ebx
    fld     qword ptr [eax].Max
{$ELSE !PIC}
    fld     Max
{$ENDIF !PIC}
    fcompp                 {leave exp in st(0)}
    fstsw   ax
    sahf
    jb      @@RealPower    {exp > MaxInt}
    fld     st             {exp in st(0) and st(1)}
    frndint                {round(exp)}
    fcomp                  {compare exp and round(exp)}
    fstsw   ax
    sahf
    jne     @@RealPower
    fistp   IntExp
    mov     eax, IntExp    {eax=Trunc(Exponent)}
    mov     ecx, eax
    cdq
    fld1                   {Result=1}
    xor     eax, edx
    sub     eax, edx       {abs(exp)}
    jz      @@Exit
    fld     Base
    jmp     @@Entry
@@Loop:
    fmul    st, st         {Base * Base}
@@Entry:
    shr     eax, 1
    jnc     @@Loop
    fmul    st(1), st      {Result * X}
    jnz     @@Loop
    fstp    st
    cmp     ecx, 0
    jge     @@Exit
    fld1
    fdivrp                 {1/Result}
    jmp     @@Exit
@@RealPower:
    fld     Base
    ftst
    fstsw   ax
    sahf
    jz      @@Done
    fldln2
    fxch
    fyl2x
    fxch
    fmulp   st(1), st
    fldl2e
    fmulp   st(1), st
    fld     st(0)
    frndint
    fsub    st(1), st
    fxch    st(1)
    f2xm1
    fld1
    faddp   st(1), st
    fscale
@@Done:
    fstp    st(1)
@@Exit:
    fstp    Result
  end;
  FCheckExcept;
end;
{$ELSE}
const
  Max  : Double = MaxInt;
var
  IntExp : Integer;
asm // StackAlignSafe
  fld     Exponent
  fld     st             {copy to st(1)}
  fabs                   {abs(exp)}
{$IFDEF PIC}
  push    ebx
  call    GetGOT
  pop     ebx
  fld     qword ptr [eax].Max
{$ELSE !PIC}
  fld     Max
{$ENDIF !PIC}
  fcompp                 {leave exp in st(0)}
  fstsw   ax
  sahf
  jb      @@RealPower    {exp > MaxInt}
  fld     st             {exp in st(0) and st(1)}
  frndint                {round(exp)}
  fcomp                  {compare exp and round(exp)}
  fstsw   ax
  sahf
  jne     @@RealPower
  fistp   IntExp
  mov     eax, IntExp    {eax=Trunc(Exponent)}
  mov     ecx, eax
  cdq
  fld1                   {Result=1}
  xor     eax, edx
  sub     eax, edx       {abs(exp)}
  jz      @@Exit
  fld     Base
  jmp     @@Entry
@@Loop:
  fmul    st, st         {Base * Base}
@@Entry:
  shr     eax, 1
  jnc     @@Loop
  fmul    st(1), st      {Result * X}
  jnz     @@Loop
  fstp    st
  cmp     ecx, 0
  jge     @@Exit
  fld1
  fdivrp                 {1/Result}
  jmp     @@Exit
@@RealPower:
  fld     Base
  ftst
  fstsw   ax
  sahf
  jz      @@Done
  fldln2
  fxch
  fyl2x
  fxch
  fmulp   st(1), st
  fldl2e
  fmulp   st(1), st
  fld     st(0)
  frndint
  fsub    st(1), st
  fxch    st(1)
  f2xm1
  fld1
  faddp   st(1), st
  fscale
@@Done:
  fstp    st(1)
@@Exit:
end;
{$ENDIF}
{$ENDIF X86ASM}

function Power(const Base, Exponent: Single): Single; overload;
{$IFNDEF X86ASM}
begin
  FClearExcept;
  if Exponent = 0.0 then
    Result := 1.0               { n**0 = 1 }
  else if (Base = 0.0) and (Exponent > 0.0) then
    Result := 0.0               { 0**n = 0, n > 0 }
  else if (Frac(Exponent) = 0.0) and (Abs(Exponent) <= MaxInt) then
    Result := IntPower(Base, Integer(Trunc(Exponent)))
  else if Base < 0 then
  begin
    Error(reInvalidOp);
    Result := 0; // avoid warning W1035 Return value of function '%s' might be undefined
  end
  else
    Result := Exp(Exponent * Ln(Base));
  FCheckExcept;
end;
{$ELSE X86ASM}
{$IF     defined(CPUX86) and defined(IOS)} // iOS/Simulator
const
  Max : Double = MaxInt;
var
  IntExp : Integer;
begin
  FClearExcept;
  asm // StackAlignSafe
    fld     Exponent
    fld     st             {copy to st(1)}
    fabs                   {abs(exp)}
{$IFDEF PIC}
    push    ebx
    call    GetGOT
    pop     ebx
    fld     qword ptr [eax].Max
{$ELSE !PIC}
    fld     Max
{$ENDIF !PIC}
    fcompp                 {leave exp in st(0)}
    fstsw   ax
    sahf
    jb      @@RealPower    {exp > MaxInt}
    fld     st             {exp in st(0) and st(1)}
    frndint                {round(exp)}
    fcomp                  {compare exp and round(exp)}
    fstsw   ax
    sahf
    jne     @@RealPower
    fistp   IntExp
    mov     eax, IntExp    {eax=Integer(Exponent)}
    mov     ecx, eax
    cdq
    fld1                   {Result=1}
    xor     eax, edx
    sub     eax, edx       {abs(exp)}
    jz      @@Exit
    fld     Base
    jmp     @@Entry
@@Loop:
    fmul    st, st         {Base * Base}
@@Entry:
    shr     eax, 1
    jnc     @@Loop
    fmul    st(1), st      {Result * X}
    jnz     @@Loop
    fstp    st
    cmp     ecx, 0
    jge     @@Exit
    fld1
    fdivrp                 {1/Result}
    jmp     @@Exit
@@RealPower:
    fld     Base
    ftst
    fstsw   ax
    sahf
    jz      @@Done
    fldln2
    fxch
    fyl2x
    fxch
    fmulp   st(1), st
    fldl2e
    fmulp   st(1), st
    fld     st(0)
    frndint
    fsub    st(1), st
    fxch    st(1)
    f2xm1
    fld1
    faddp   st(1), st
    fscale
@@Done:
    fstp    st(1)
@@Exit:
    fstp    Result
  end;
  FCheckExcept;
end;
{$ELSE}
const
  Max : Double = MaxInt;
var
  IntExp : Integer;
asm // StackAlignSafe
  fld     Exponent
  fld     st             {copy to st(1)}
  fabs                   {abs(exp)}
{$IFDEF PIC}
  push    ebx
  call    GetGOT
  pop     ebx
  fld     qword ptr [eax].Max
{$ELSE !PIC}
  fld     Max
{$ENDIF !PIC}
  fcompp                 {leave exp in st(0)}
  fstsw   ax
  sahf
  jb      @@RealPower    {exp > MaxInt}
  fld     st             {exp in st(0) and st(1)}
  frndint                {round(exp)}
  fcomp                  {compare exp and round(exp)}
  fstsw   ax
  sahf
  jne     @@RealPower
  fistp   IntExp
  mov     eax, IntExp    {eax=Integer(Exponent)}
  mov     ecx, eax
  cdq
  fld1                   {Result=1}
  xor     eax, edx
  sub     eax, edx       {abs(exp)}
  jz      @@Exit
  fld     Base
  jmp     @@Entry
@@Loop:
  fmul    st, st         {Base * Base}
@@Entry:
  shr     eax, 1
  jnc     @@Loop
  fmul    st(1), st      {Result * X}
  jnz     @@Loop
  fstp    st
  cmp     ecx, 0
  jge     @@Exit
  fld1
  fdivrp                 {1/Result}
  jmp     @@Exit
@@RealPower:
  fld     Base
  ftst
  fstsw   ax
  sahf
  jz      @@Done
  fldln2
  fxch
  fyl2x
  fxch
  fmulp   st(1), st
  fldl2e
  fmulp   st(1), st
  fld     st(0)
  frndint
  fsub    st(1), st
  fxch    st(1)
  f2xm1
  fld1
  faddp   st(1), st
  fscale
@@Done:
  fstp    st(1)
@@Exit:
end;
{$ENDIF}
{$ENDIF X86ASM}


That's a whole bunch of stuff needed, instead of just a simple for loop and a multiplication.

So no Sire, I won't get you away with bloody murder ! =D LOL.

I could do a typing test, but at this point I am not so interested in clock cycles...

Maybe later...

I don't know what the IntPower function does seems unfindeable could be something internal.

First breakfast, then maybe later some clock cycle measurements ! ;) =D

Now you know why testing is awesome, it leads to all kinds of efficiency discoveries ! ;) =D

Bye,
  Skybuck.


SubjectRepliesAuthor
o The Truth about Corona Virus Situation and what every person should kn

By: skybuck2000 on Thu, 19 Mar 2020

31skybuck2000
rocksolid light 0.7.2
clearneti2ptor