Recent Posts

Pages: [1] 2 3 ... 10
1
Examples / Re: Release version FP calculator
« Last post by TimoVJL on Today at 01:30:32 AM »
Timo,

What I will do is add a setting so that the user has the choice, its a bit messy but I think it can be done. What I don't know yet is if the VC runtime conversion I am using will accept "," rather than ".".  I can change it on the fly both ways but it would be no joy to do.
use
Code: [Select]
setlocale(LC_NUMERIC, "");and with sprintf(tmp, "%f", 1.2) you can verify that decimal separator, that you need for edit control subclassing.
2
Examples / Re: Release version FP calculator
« Last post by AW on Today at 01:09:08 AM »
It is interesting that in Windows (8.1 and 10, does not work in Windows 7 and below) we can have UTF-32 decimal separators. However, neither Calculator, nor Excel are able to render it when we press the VK_DECIMAL button on the NumPad - Shame!   :dazzled:. Probably they will do it in Windows 11.  :biggrin:

I post here a demo where an edit box prints the Mizaru (the wize monkey that covers his head) Unicode symbol when we press the VK_DECIMAL button on the NumPad. I include only the .exe and leave this a challenge for someone to elaborate on the subject (UTF-32, after BMP - Basic Multilingual Plane).

The demo saves the existing decimal separator character and sets Mizaru as decimal separator. When closing the application the original decimal separator is restored - so it is clean.
BTW, the demo is a little sized because was developed in Pascal for speed.



BTW, this SMF forum board does not accept as well posts with UTF-32 characters - this explains the problems I had yesterday.
3
The Laboratory / Re: Hyperthreading - Revisited
« Last post by johnsa on Today at 12:42:24 AM »

From my testing I found that the improvement gain from hyper-threading really depends on A) your workload and B) how well optimised your code is.

The basic idea is that execution units are shared / although they're exposed is 2 separate logical processors.

If you are under normal user conditions and running several different applications simultaneously, the HT'ed core can yield up to 60% of a real core in optimal conditions.
If you're writing your own multi-thread code, for example breaking up a job in N threads where all threads are mapped to separate logical cores and are basically executing the same code it comes down to
instruction level pairing and how many execution units you can max out. If for example your code is purely simd, or purely gp and you've reached a point where all the execution units are constantly saturated, then HT can actually degrade performance. One way to help the HT if you're keeping it on during intense multi-threaded loops is to try and balance the code between different execution units if possible and try to re-arrange it so that any stalls are grouped, that way core A can focus on part 1 then stall while core B can execute the other independant portion.

In 90% of cases I've not found having HT on to cause me any problems, and I usually get about 30-40% extra from having them included.
For example, I get N from using 4 real cores, then another (0.3*N) from the remaining 4 HT cores.
4
The Campus / Re: How to test and run assembly programs without Visual Studio
« Last post by AW on October 18, 2018, 10:26:04 PM »
It can happen with the paid versions of VS Studio.
But I was thinking on the free VS Community editions, you need to register with a free Microsoft account after 30 days but a free of charge obligation is usually not an issue.
5
The Campus / Re: How to test and run assembly programs without Visual Studio
« Last post by hutch-- on October 18, 2018, 09:00:38 PM »
I have seen that happen a long time ago, when a demo runs out of time it just stops working. Trick is to extract the binaries you want from it and then completely remove it.
6
The Campus / Re: How to test and run assembly programs without Visual Studio
« Last post by AW on October 18, 2018, 08:38:31 PM »
Quote
my computer tried opening up Visual Studio (and of course, my trial expired, so I didn't get a chance to view the output of my program)
Very weird, never happened to me.
7
The Workshop / Re: A question about what are useful constants.
« Last post by hutch-- on October 18, 2018, 01:03:29 PM »
Thanks Rui,

Most of the maths are very simple in the calculator, the difficult part was making an interface that displayed the symbols properly. There are a number of conversions that are worth having but it will require a different interface to do it and that would be a completely new app.
8
The Workshop / Re: A question about what are useful constants.
« Last post by RuiLoureiro on October 18, 2018, 08:32:46 AM »
Hi Hutch,
             I never need to know more than you already know. The calculators define only pi because they use functions e^x, sqr(x), etc. But a good idea was given by Siekmanski: converter factors.
I would say that you may try to implement a simple function as sqr(x)- i dont know if it is easy to you or easy to implement in your calculator.
My TheCalculator only uses 2 constants: pi and e. But we may get "e" typing "e" or e^1 because it does e^z (z is any complex number a+ib). It doesnt need converter factors because we may use functions sin or sind, cos or cosd, arcsin, arcsind, etc. And if we need we define typing a=180/pi or b=pi/180 and then we may use a or b.
I am answering now because i saw this topic now. I am sorry.



9
The Workshop / Floyd's triangle
« Last post by jj2007 on October 18, 2018, 07:49:56 AM »
https://rosettacode.org/wiki/Floyd%27s_triangle
Quote
Task
Write a program to generate and display here the first n lines of a Floyd triangle.
(Use n=5 and n=14 rows).
Ensure that when displayed in a mono-space font, the numbers line up in vertical columns as shown and that only one space separates numbers of the last row.

include \masm32\MasmBasic\MasmBasic.inc         ; download
  SetGlobals rows, columns, ct, maxrows=4
  Init
  .Repeat
        For_ rows=0 To maxrows
                For_ columns=0 To rows
                                inc ct
                                Print Str$("%__i", ct)
                                .if columns>6
                                        Print " "
                                .endif
                Next
                Print
        Next
        Print
        Clr ct
        add maxrows, 9          ; 4+9=13
  .Until maxrows>13
  Inkey
EndOfCode


Code: [Select]
  1
  2  3
  4  5  6
  7  8  9 10
 11 12 13 14 15

  1
  2  3
  4  5  6
  7  8  9 10
 11 12 13 14 15
 16 17 18 19 20 21
 22 23 24 25 26 27 28
 29 30 31 32 33 34 35 36
 37 38 39 40 41 42 43 44  45
 46 47 48 49 50 51 52 53  54  55
 56 57 58 59 60 61 62 63  64  65  66
 67 68 69 70 71 72 73 74  75  76  77  78
 79 80 81 82 83 84 85 86  87  88  89  90  91
 92 93 94 95 96 97 98 99 100 101 102 103 104 105
10
Examples / Re: Release version FP calculator
« Last post by TimoVJL on October 18, 2018, 07:40:05 AM »
Example to switch numpad comma to period.
Code: [Select]
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, szDes, 4);
...
LRESULT CALLBACK NewEditProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg) {
case WM_CHAR:
if (wParam == ',') return 0;
break;
case WM_KEYUP:
if (wParam == VK_DECIMAL) {
if (uMsg == WM_KEYUP && szDes[0] != '.')
PostMessage(hWnd, WM_CHAR, '.', 0);
return 0;
}
break;
}
return OldEditProc(hWnd, uMsg, wParam, lParam);
}

EDIT: that msvcrt locale issue for user language:
Code: [Select]
setlocale(LC_NUMERIC, "");but then the constants needs to fix.
Pages: [1] 2 3 ... 10