Usage of NOT having Fixed Point Arithmetic?
Hello!
SAP recommends to always do programs with Fixed Point Arithmetic attribute checked. Please don't explain here what is Fixed Point Arithmetic - I know this and it's is not my question.
The question is: why do we have it at all? Why aren't all programs simply fixed-point-arithmetic without attribute to activate or deactivate this?
I suppose that there are situations which require Fixed Point Arithmetic NOT being set, but I can't imagine any. Could anyone offer an explanation?
Thanks in advance!
Igor
Edited by: Igor Barbaric on Mar 21, 2008 9:30 AM
No replies - I'll try to bring the question to your attention once again:
Please, does anybody know the purpose of NOT having Fixed Point Arithmetic?
Please check if this helps u
This attribute defines, whether for numerical data objects of data type p (packed numbers) is the decimal point is relevant in calculations or assignments or if it is omitted. Normally, this attribute is always switched on and you might ask, why it can be switched off at all. Well, in very ancient times packed numbers had no real decimal point. It was taken into account only for presentation purposes. In order to stay downward compatible, for the introduction of fixed point arithmetic this switch was needed. In fact there are still programs that switch fixed point arithmetic off ¨C for example financial programs that calculate on the basis of cents instead of dollars.
Thanks Arjun
Similar Messages
-
Need arithmetic operation result in Fixed point arithmetic disabled prg
Hi,
I am writing an enhancement which is in standard SAP program which is not enabled for 'Fixed arithmetic' calculations.
I need to do some actual arithmetic operation involving packed numbers in my enhancement.
Say
p1 = '2.00'
p2 = '12.00'.
result = p1 * p2.
result coming is 2400.00. This is because Fixed point arithmetic is disabled in standard program.
I need a result of 24.00 . Is there any solution to this apart from dividing it with 100?
Regards,
Dhanabased on P1 and P2 values you need to divide the value with 100 or 1000 as per the number of decimals on P1 and P2
-
Division without Fixed Point Arithmetic
Hello,
I am trying to divide 1 by a decimal, i.e. 1 / 7.75027, in Include RV63A900 of Function Group V61A. Since the ' Fixed Point Arithmetic' checkbox is not checked, I am unable to get this calculation to work.
I have tried different scenarios of using a floating point field to receive the quotient but nothing has worked.
Any suggestions?
Thank you,
Chris MowlI use floating variable some thing like this :
data: v_f TYPE f,
v_c TYPE char12.
v_f = ( wa_komp_o-netwr / o_komp-mglme ).
* Due to decimal issues had to use Floating point value
* for calculation of condition base value
CALL FUNCTION 'FLTP_CHAR_CONVERSION'
EXPORTING
decim = 5
input = v_f
IMPORTING
flstr = v_c.
v_amount = v_c * 10. -
User Exit Fixed Point Arithmetic
Dear all,
I have developed some code on the user exit RV61AFZB and tried to change the value on the xkomv-kbetr. But, i found that the division result is wrong.
Example:
DATA: temp like xkomv-kbetr,
c_test LIKE xkomv-kbetr VALUE '152000.00',
c_qty like xkomv-kbetr value '3.00'.
temp = c_test / c_qty.
The value of temp became 506.67. Since, this is a user exit and i can't change program attribute "Fixed Point Arithmetic" .
Regards,
KitHello
Try this:
DATA: temp like xkomv-kbetr,
c_test LIKE xkomv-kbetr VALUE '152000.00',
c_qty like xkomv-kbetr value '3.00'.
data: temp1 type i.
temp = c_test / c_qty.
temp1 = temp. -
Inline functions in C, gcc optimization and floating point arithmetic issues
For several days I really have become a fan of Alchemy. But after intensive testing I have found several issues which I'd like to solve but I can't without any help.
So...I'm porting an old game console emulator written by me in ANSI C. The code is working on both gcc and VisualStudio without any modification or crosscompile macros. The only platform code is the audio and video output which is out of scope, because I have ported audio and video witin AS3.
Here are the issues:
1. Inline functions - Having only a single inline function makes the code working incorrectly (although not crashing) even if any optimization is enabled or not (-O0 or O3). My current workarround is converting the inline functions to macros which achieves the same effect. Any ideas why inline functions break the code?
2. Compiler optimizations - well, my project consists of many C files one of which is called flash.c and it contains the main and exported functions. I build the project as follows:
gcc -c flash.c -O0 -o flash.o //Please note the -O0 option!!!
gcc -c file1.c -O3 -o file1.o
gcc -c file2.c -O3 -o file2.o
... and so on
gcc *.o -swc -O0 -o emu.swc //Please note the -O0 option again!!!
mxmlc.exe -library-path+=emu.swc --target-player=10.0.0 Emu.as
or file in $( ls *.o ) //Removes the obj files
do
rm $file
done
If I define any option different from -O0 in gcc -c flash.c -O0 -o flash.o the program stops working correctly exactly as in the inline funtions code (but still does not crash or prints any errors in debug). flash has 4 static functions to be exported to AS3 and the main function. Do you know why?
If I define any option different from -O0 in gcc *.o -swc -O0 -o emu.swc the program stops working correctly exactly as above, but if I specify -O1, -O2 or O3 the SWC file gets smaller up to 2x for O3. Why? Is there a method to optimize all the obj files except flash.o because I suspect a similar issue as when compilling it?
3. Flating point issues - this is the worst one. My code is mainly based on integer arithmetic but on 1-2 places it requires flating point arithmetic. One of them is the conversion of 16-bit 44.1 Khz sound buffer to a float buffer with same sample rate but with samples in the range from -1.0 to 1.0.
My code:
void audio_prepare_as()
uint32 i;
for(i=0;i<audioSamples;i+=2)
audiobuffer[i] = (float)snd.buffer[i]/32768;
audiobuffer[i+1] = (float)snd.buffer[i+1]/32768;
My audio playback is working perfectly. But not if using the above conversion and I have inspected the float numbers - all incorrect and invalid. I tried other code with simple floats - same story. As if alchemy refuses to work with floats. What is wrong? I have another lace whre I must resize the framebuffer and there I have a float involved - same crap. Please help me?
Found the floating point problem: audiobuffer is written to a ByteArray and then used in AS. But C floats are obviously not the same as those in AS3. Now the floating point is resolved.
The optimization issues remain! I really need to speed up my code.
Thank you in advice!Dear Bernd,
I am still unable to run the optimizations and turn on the inline functions. None of the inline functions contain any stdli function just pure asignments, reads, simple arithmetic and bitwise operations.
In fact, the file containing the main function and those functions for export in AS3 did have memset and memcpy. I tried your suggestion and put the code above the functions calling memset and memcpy. It did not work soe I put the code in a header which is included topmost in each C file. The only system header I use is malloc.h and it is included topmost. In other C file I use pow, sin and log10 from math.h but I removed it and made the same thing:
//shared.h
#ifndef _SHARED_H_
#define _SHARED_H_
#include <malloc.h>
static void * custom_memmove( void * destination, const void * source, unsigned int num ) {
void *result;
__asm__("%0 memmove(%1, %2, %3)\n" : "=r"(result) : "r"(destination), "r"(source), "r"(num));
return result;
static void * custom_memcpy ( void * destination, const void * source, unsigned int num ) {
void *result;
__asm__("%0 memcpy(%1, %2, %3)\n" : "=r"(result) : "r"(destination), "r"(source), "r"(num));
return result;
static void * custom_memset ( void * ptr, int value, unsigned int num ) {
void *result;
__asm__("%0 memset(%1, %2, %3)\n" : "=r"(result) : "r"(ptr), "r"(value), "r"(num));
return result;
static float custom_pow(float x, int y) {
float result;
__asm__("%0 pow(%1, %2)\n" : "=r"(result) : "r"(x), "r"(y));
return result;
static double custom_sin(double x) {
double result;
__asm__("%0 sin(%1)\n" : "=r"(result) : "r"(x));
return result;
static double custom_log10(double x) {
double result;
__asm__("%0 log10(%1)\n" : "=r"(result) : "r"(x));
return result;
#define memmove custom_memmove
#define memcpy custom_memcpy
#define memset custom_memset
#define pow custom_pow
#define sin custom_sin
#define log10 custom_log10
#include "types.h"
#include "macros.h"
#include "m68k.h"
#include "z80.h"
#include "genesis.h"
#include "vdp.h"
#include "render.h"
#include "mem68k.h"
#include "memz80.h"
#include "membnk.h"
#include "memvdp.h"
#include "system.h"
#include "loadrom.h"
#include "input.h"
#include "io.h"
#include "sound.h"
#include "fm.h"
#include "sn76496.h"
#endif /* _SHARED_H_ */
It still behave the same way as if nothing was changed (works incorrectly - displays jerk which does not move, whereby the image is supposed to move)
As I am porting an emulator (Sega Mega Drive) I use manu arrays of function pointers for implementing the opcodes of the CPU's. Could this be an issue?
I did a workaround for the floating point problem but processing is very slow so I hear only bzzt bzzt but this is for now out of scope. The emulator compiled with gcc runs at 300 fps on a 1.3 GHz machine, whereby my non optimized AVM2 code compiled by alchemy produces 14 fps. The pure rendering is super fast and the problem lies in the computational power of AVM. The frame buffer and the enulation are generated in the C code and only the pixels are copied to AS3, where they are plotted in a BitmapData. On 2.0 GHz Dual core I achieved only 21 fps. Goal is 60 fps to have smooth audio and video. But this is offtopic. After all everything works (slow) without optimization, and I would somehow turn it on. Suggestions?
Here is the file with the main function:
#include "shared.h"
#include "AS3.h"
#define FRAMEBUFFER_LENGTH (320*240*4)
static uint8* framebuffer;
static uint32 audioSamples;
AS3_Val sega_rom(void* self, AS3_Val args)
int size, offset, i;
uint8 hardware;
uint8 country;
uint8 header[0x200];
uint8 *ptr;
AS3_Val length;
AS3_Val ba;
AS3_ArrayValue(args, "AS3ValType", &ba);
country = 0;
offset = 0;
length = AS3_GetS(ba, "length");
size = AS3_IntValue(length);
ptr = (uint8*)malloc(size);
AS3_SetS(ba, "position", AS3_Int(0));
AS3_ByteArray_readBytes(ptr, ba, size);
//FILE* f = fopen("boris_dump.bin", "wb");
//fwrite(ptr, size, 1, f);
//fclose(f);
if((size / 512) & 1)
size -= 512;
offset += 512;
memcpy(header, ptr, 512);
for(i = 0; i < (size / 0x4000); i += 1)
deinterleave_block(ptr + offset + (i * 0x4000));
memset(cart_rom, 0, 0x400000);
if(size > 0x400000) size = 0x400000;
memcpy(cart_rom, ptr + offset, size);
/* Free allocated file data */
free(ptr);
hardware = 0;
for (i = 0x1f0; i < 0x1ff; i++)
switch (cart_rom[i]) {
case 'U':
hardware |= 4;
break;
case 'J':
hardware |= 1;
break;
case 'E':
hardware |= 8;
break;
if (cart_rom[0x1f0] >= '1' && cart_rom[0x1f0] <= '9') {
hardware = cart_rom[0x1f0] - '0';
} else if (cart_rom[0x1f0] >= 'A' && cart_rom[0x1f0] <= 'F') {
hardware = cart_rom[0x1f0] - 'A' + 10;
if (country) hardware=country; //simple autodetect override
//From PicoDrive
if (hardware&8)
hw=0xc0; vdp_pal=1;
} // Europe
else if (hardware&4)
hw=0x80; vdp_pal=0;
} // USA
else if (hardware&2)
hw=0x40; vdp_pal=1;
} // Japan PAL
else if (hardware&1)
hw=0x00; vdp_pal=0;
} // Japan NTSC
else
hw=0x80; // USA
if (vdp_pal) {
vdp_rate = 50;
lines_per_frame = 312;
} else {
vdp_rate = 60;
lines_per_frame = 262;
/*SRAM*/
if(cart_rom[0x1b1] == 'A' && cart_rom[0x1b0] == 'R')
save_start = cart_rom[0x1b4] << 24 | cart_rom[0x1b5] << 16 |
cart_rom[0x1b6] << 8 | cart_rom[0x1b7] << 0;
save_len = cart_rom[0x1b8] << 24 | cart_rom[0x1b9] << 16 |
cart_rom[0x1ba] << 8 | cart_rom[0x1bb] << 0;
// Make sure start is even, end is odd, for alignment
// A ROM that I came across had the start and end bytes of
// the save ram the same and wouldn't work. Fix this as seen
// fit, I know it could probably use some work. [PKH]
if(save_start != save_len)
if(save_start & 1) --save_start;
if(!(save_len & 1)) ++save_len;
save_len -= (save_start - 1);
saveram = (unsigned char*)malloc(save_len);
// If save RAM does not overlap main ROM, set it active by default since
// a few games can't manage to properly switch it on/off.
if(save_start >= (unsigned)size)
save_active = 1;
else
save_start = save_len = 0;
saveram = NULL;
else
save_start = save_len = 0;
saveram = NULL;
return AS3_Int(0);
AS3_Val sega_init(void* self, AS3_Val args)
system_init();
audioSamples = (44100 / vdp_rate)*2;
framebuffer = (uint8*)malloc(FRAMEBUFFER_LENGTH);
return AS3_Int(vdp_rate);
AS3_Val sega_reset(void* self, AS3_Val args)
system_reset();
return AS3_Int(0);
AS3_Val sega_frame(void* self, AS3_Val args)
uint32 width;
uint32 height;
uint32 x, y;
uint32 di, si, r;
uint16 p;
AS3_Val fb_ba;
AS3_ArrayValue(args, "AS3ValType", &fb_ba);
system_frame(0);
AS3_SetS(fb_ba, "position", AS3_Int(0));
width = (reg[12] & 1) ? 320 : 256;
height = (reg[1] & 8) ? 240 : 224;
for(y=0;y<240;y++)
for(x=0;x<320;x++)
di = 1280*y + x<<2;
si = (y << 10) + ((x + bitmap.viewport.x) << 1);
p = *((uint16*)(bitmap.data + si));
framebuffer[di + 3] = (uint8)((p & 0x1f) << 3);
framebuffer[di + 2] = (uint8)(((p >> 5) & 0x1f) << 3);
framebuffer[di + 1] = (uint8)(((p >> 10) & 0x1f) << 3);
AS3_ByteArray_writeBytes(fb_ba, framebuffer, FRAMEBUFFER_LENGTH);
AS3_SetS(fb_ba, "position", AS3_Int(0));
r = (width << 16) | height;
return AS3_Int(r);
AS3_Val sega_audio(void* self, AS3_Val args)
AS3_Val ab_ba;
AS3_ArrayValue(args, "AS3ValType", &ab_ba);
AS3_SetS(ab_ba, "position", AS3_Int(0));
AS3_ByteArray_writeBytes(ab_ba, snd.buffer, audioSamples*sizeof(int16));
AS3_SetS(ab_ba, "position", AS3_Int(0));
return AS3_Int(0);
int main()
AS3_Val romMethod = AS3_Function(NULL, sega_rom);
AS3_Val initMethod = AS3_Function(NULL, sega_init);
AS3_Val resetMethod = AS3_Function(NULL, sega_reset);
AS3_Val frameMethod = AS3_Function(NULL, sega_frame);
AS3_Val audioMethod = AS3_Function(NULL, sega_audio);
// construct an object that holds references to the functions
AS3_Val result = AS3_Object("sega_rom: AS3ValType, sega_init: AS3ValType, sega_reset: AS3ValType, sega_frame: AS3ValType, sega_audio: AS3ValType",
romMethod, initMethod, resetMethod, frameMethod, audioMethod);
// Release
AS3_Release(romMethod);
AS3_Release(initMethod);
AS3_Release(resetMethod);
AS3_Release(frameMethod);
AS3_Release(audioMethod);
// notify that we initialized -- THIS DOES NOT RETURN!
AS3_LibInit(result);
// should never get here!
return 0; -
OBIEE 11g - Usage Tracking Not Working
Dear All,
I have enabled the usage Tracking in OBIEE 11g by using Setting up Usage Tracking in Oracle BI 11g guide.
Still i am getting the following error
Usage Tracking not started due to non-existent Usage Tracking table "12-Usage Tracking"."Usage Tracking Schema"."S_NQ_ACCT".
In my RPD,
Database Name : "12-Usage Tracking"
Physical Schema Name : "Usage Tracking Schema"
Physical Table Name : "S_NQ_ACCT"
This table reside under BIPLATFORM Schema in Oracle.
I have followed the steps mentioned in the Document, still unable to find why getting such error. Please point out if any mistake exists.
Please advice.Hi,
Good for you.
Maybe you can post the solution and how you solved your issue to help other users having the same problem and then close the thread (currently it's still This question is Not Answered.) -
I have a simple column chart grouping on 1 value on the category axis. For simplicity's sake, we are plotting $ amounts grouping by Month on the category axis. I right click on the data series and choose "Add calculated series...". I choose moving average. I want to move the average over at least 2 periods.
When I run the report, I get the error "Formula error - there are not enough data points for the period". The way the report is, I never have a guaranteed number of categories (there could be one or there could be 5). When there is 2 or more, the chart renders fine, however, when there is only 1 value, instead of suppressing the moving average line, I get that error and the chart shows nothing.
I don't think this is entirely acceptable for our end users. At a minimum, I would think the moving average line would be suppressed instead of hiding the entire chart. Does anyone know of any workarounds or do I have to enter another ms. connect bug/design consideration.
Thank you,
DanI was having the same error while trying to plot a moving average across 7 days. The work around I found was rather simple.
If you right click your report in the solution explorer and select "View Code" it will give you the underlying XML of the report. Find the entry for the value of your calculated series and enter a formula to dynamically create your periods.
<ChartFormulaParameter Name="Period">
<Value>=IIf(Count(Fields!Calls.Value) >= 7 ,7, (Count(Fields!Calls.Value)))</Value>
</ChartFormulaParameter>
What I'm doing here is getting the row count of records returned in the chart. If the returned rows are greater than or equal to 7 (The amount of days I want the average) it will set the points to 7. If not, it will set the number to the amount of returned rows. So far this has worked great. I'm probably going to add more code to handle no records returned although in my case that shouldn't happen but, you never know.
A side note:
If you open the calculated series properties in the designer, you will notice the number of periods is set to "0". If you change this it will overwrite your custom formula in the XML. -
I have WebLogic 32 bit installed on a Windows XP 32 bit platform. And CCB V2.2.0.
Upon startup in WebLogic, I get the following error message in the Domain Diagnostic Log file of Web Logic;
101162 User defined listener com.splwg.base.web.startup.SPLWebStartup failed: com.splwg.shared.common.LoggedException: The following stacked messages were reported as the LoggedException was rethrown: com.splwg.base.web.startup.PreloadLoginInfo.preloadFieldMetaData(PreloadLoginInfo.java:150): Unable to preload navigation keys and web pages com.splwg.base.support.context.SessionExecutable.doAsReadOnlyInCurrentSessionIfAvailable(SessionExecutable.java:54): Error caching field metainfo com.splwg.base.web.common.FieldMetaDataRepository$FieldRetriever.execute(FieldMetaDataRepository.java:99): Caught exception from SessionExecutable.execute() The root LoggedException was: Did not find base field 'EXT_REFERENCE_ID' pointed to by field 'C1_EXT_REFERENCE_ID'.
A user, ChesPlay, suggested that I install FrameWork Service Pack 10 from the Oracle MetaLink site. *(ChesPlay...thanks for your help!)*
I completed the install yesterday, but still get the same error.
First, I verified that I had already installed the Prerequisite Single Fixes 7195518. 7012092, 7284592 per SP10 install instructions.
Second, I installed the Prerequisite Single Fix 10124173 before installing Service Pack 10.
The following are the last few bug installations from Service Pack 10 and these are from my <SPLBASE>\etc\installed_fixes.txt file (I included these to show that SP10 installed OK);
10215923
10424723
10262588
10333081
11069455
10374823
10428564
11682732
9943861
9843154
10235499
I queried the ci_ut_instl database table to show the last few database updates that were installed from Service Pack 10;
10270627
9442145
8632929
10183805
8486799
9947280
10116686
ChesPlay, you asked if I had installed DB SP1, and I am thinking that this would be included inside the DB SP10 that I just installed. There was a database upgrade in FW SP10. I queried some defects that would have been corrected around the time we did the initial install and installed FW SP1, and those DB corrections are;
SR_NO
6089943
6320038
6508751
6690631
6732352
6741522
6746717
6752806
6753590
6762978
6769161
6769237
6779293
6779801
6781657
6818630
6823390
6849474
6852874
6870669
6906144
6939345
6941618
6979608
6995839
7003470
7014765
7026277
7381045
7381047
7381055
7381058
7382787
7384954
7388487
7391086
7391288
7407889
7413910
7418119
7428875
7438467
7441512
7448408
7456024
7462902
7484097
7493378
7494737
7500660
7503581
7509645
7527185
7534015
7568961
7569426
7582167
7588967
7592708
7594026
7599841
7599984
7613246
7616144
7624052
7633553
7635383
7649695
7677265
7679057
7026919
7037953
7111539
7233235
7256221
7293343
7310420
7322924
7332542
7357736
7503171
7503377
7510815
7520424
7568016
7593173
7594038
7671757
7827664
8251286
8260929
8268874
8273106
8291086
8392040
6937115
6979711
6999033
7041838
7109393
7175088
7176465
7189056
7189062
7189066
7228406
7240901
7247174
7247901
7253983
7254315
7259747
7263367
7275778
7277602
7279706
7281406
7281654
7286107
7288370
7298418
7316562
7316681
7323846
7332558
7332907
7344408
7346424
7353257
7356312
7357247
7359107
7375159
7381041
9300696
9309747
9340118
9395985
9400236
9492363
9526408
9647138
9654108
9664482
9698293
9709303
9712403
9825630
7679562
7687196
7687438
7687453
7710475
7774775
7811967
7831369
7911307
7924667
8206476
8226523
8235853
8256491
8273340
8280748
8284128
8289639
8292263
8301127
8307872
8321198
8339901
8344477
8350640
8350682
8403219
8426144
8426309
8443509
8445514
8445531
8484901
8490758
8496724
8503323
8532198
8546929
8568639
8569825
8572542
8574743
8593280
8595554
8596468
8603598
8603640
8619605
8628607
8631398
8654780
8676657
8710499
8734027
8743059
8743999
8811818
8958357
9017242
8738911
8754679
9006753
9032536
9104466
9110525
9124362
9131056
9211751
9213966
9267200
9280101
9290639
I am headed to MetaLink now for further research on the "Did not find EXT_REFERENCE_ID pointed to by field C1_EXT_REFERENCE_ID" message to see what else I might need to install. I'll update this thread if/when I figure out the problem.
Chesplay if you have another idea, or believe that there is a seperate DB SP1 on MetaLink, please advise. I was not able to find a seperate DB SP1 on MetaLink today. Thanks!For me even the issue was solved when i apply the db portion of patch 7009370. But when i log in to the application i could see ablank pages, the menus were not loading up and i was getting error:
SYSUSER - 313876-67-1 2011-03-05 23:12:11,721 [[ACTIVE] ExecuteThread: '2' for q
ueue: 'weblogic.kernel.Default (self-tuning)'] ERROR (web.dynamicui.NavMetaDataH
older) Error getting navigation info for navigation key userPortalPage
SYSUSER - 313876-67-1 2011-03-05 23:12:11,737 [[ACTIVE] ExecuteThread: '2' for q
ueue: 'weblogic.kernel.Default (self-tuning)'] ERROR (web.dynamicui.XSLTExtensio
nHelper) XSLT Extension error getting program component meta data for userPortal
Page
file:/C:/spl/CCBDEMO/splapp/servers/myserver/tmp/_WL_user/SPLWeb/yge362/war/WEB-
INF/uiXSL/tabMenu.xsl; Line #279; Column #116; com.splwg.shared.common.LoggedException:
The following stacked messages were reported as the LoggedException was rethrown
com.splwg.base.web.dynamicui.XSLTExtensionHelper.privateProgramComponentExtensio
n(XSLTExtensionHelper.java:66): XSLT Extension error getting program component m
eta data for userPortalPage
The root LoggedException was: Error getting navigation info for navigation key u
serPortalPage
file:/C:/spl/CCBDEMO/splapp/servers/myserver/tmp/_WL_user/SPLWeb/yge362/war/WEB-
INF/uiXSL/tabMenu.xsl; Line #279; Column #116; java.lang.NullPointerException
To overcome the above issue i applied the db portion of the patch 8608149 by following below steps:
1.
DELETE FROM CI_UT_INSTL WHERE SR_NO LIKE '8608149%';
DELETE FROM CI_UT_INSTL_DTL WHERE SCRIPT_FILE_NAME LIKE '8608149_RS1%';
COMMIT;
2.Apply the patch 8608149. -
In need of Fixed-point algorithm
hi peeps,
Im in need ( a very urgent need ) of a fix-point algorithm , with explanations if possible. Can anybody point me to the right direction?
thanks....See if this helps you,
To find a solution to p=g(p)given an initial approximation p0.
Input: Initial approximation p0; tolerance TOL; maximum number of
iterations N0.
Output: Approximate solution p or message of failure.
Step 1: Set i=1;
Step 2: While i<=N0 do Steps 3-6.
Step 3: Set p=g(p0). (Compute p.)
Step 4: If |p-p0| < TOL then
OUTPUT (p); (Procedure completed successfully.)
STOP.
Step 5: Set i=i+1.
Step 6: Set p0=p. (Update p0.)
Step 7: OUTPUT('Method failed after N0 iterations, N0=', N0);
(procedure completed unsuccessfully.)
STOP.
Fixed-Point Iteration Code in C Language
* Fixed-Point Iteration Code in C Language
* To find a solution to p = g(p) given an
* initial approximation p0
* INPUT: initial approximation; tolerance TOL;
* maximum number of iterations NO.
* OUTPUT: approximate solution p or
* a message that the method fails.
#include<stdio.h>
#include<math.h>
#define true 1
#define false 0
main()
double TOL,P0,P;
int I,NO,FLAG,OK;
FILE *OUP[1];
void INPUT(int *, double *, double *, int *);
void OUTPUT(FILE **, int *);
double absval(double);
double G(double );
INPUT(&OK, &P0, &TOL, &NO);
if (OK)
OUTPUT(OUP, &FLAG);
/* STEP 1 */
I = 1; OK = true;
/* STEP 2 */
while((I<=NO) && OK)
/* STEP 3 */
/* compute P(I) */
P = G(P0);
if (FLAG == 2)
fprintf(*OUP, "%3d %15.8e\n", I, P);
/* STEP 4 */
if (absval(P-P0) < TOL)
/* procedure completed successfully */
fprintf(*OUP, "\nApproximate solution P = %12.8f\n", P);
fprintf(*OUP, "Number of iterations = %3d", I);
fprintf(*OUP, " Tolerance = %14.8e\n",TOL);
OK = false;
else
/* STEP 5 */
I++;
/* STEP 6 */
/* update P0 */
P0 = P;
if (OK)
/* STEP 7 */
/* procedure completed unsuccessfully */
fprintf(*OUP, "\nIteration number %3d", NO);
fprintf(*OUP, " gave approximation %12.8f\n", P);
fprintf(*OUP, "not within tolerance %14.8e\n",TOL);
fclose(*OUP);
/* Change function G for a new problem */
double G(double X)
double g;
g = sqrt(10.0 / (4.0 + X));
return g;
void INPUT(int OK, double P0, double TOL, int NO)
char AA;
printf("This is the Fixed-Point Method.\n");
printf("Has the function G been created in the program immediately preceding\n");
printf("the INPUT function?\n");
printf("Enter Y or N\n");
scanf("%c",&AA);
if ((AA == 'Y') || (AA == 'y'))
*OK = false;
printf("Input initial approximation\n");
scanf("%lf",P0);
while(!(*OK))
printf("Input tolerance\n");
scanf("%lf", TOL);
if (*TOL <= 0.0)
printf("Tolerance must be positive\n");
else
*OK = true;
*OK = false;
while (!(*OK))
printf("Input maximum number of iterations - no decimal point\n");
scanf("%d", NO);
if (*NO <= 0)
printf("Must be positive integer\n");
else
*OK = true;
else
printf("The program will end so that the function G can be created\n");
*OK = false;
void OUTPUT(FILE **OUP, int *FLAG)
char NAME[30];
printf("Select output destination\n");
printf("1. Screen\n");
printf("2. Text file\n");
printf("Enter 1 or 2\n");
scanf("%d", FLAG);
if (*FLAG == 2)
printf("Input the file name in the form - drive:name.ext\n");
printf("For example: A:OUTPUT.DTA\n");
scanf("%s", NAME);
*OUP = fopen(NAME, "w");
else
*OUP = stdout;
printf("Select amount of output\n");
printf("1. Answer only\n");
printf("2. All intermeditate approximations\n");
printf("Enter 1 or 2\n");
scanf("%d", FLAG);
fprintf(*OUP, "FIXED-POINT METHOD\n");
if (*FLAG == 2)
fprintf(*OUP, " I P\n");
/* Absolute Value Function */
double absval(double val)
if (val >= 0)
return val;
else
return -val; -
Why is "x2^0" Displayed on Fixed point numbers in hex format
I have a requirement to display a fixed point value (unsigned 20bit value) in hex format. At present when I set the numeric indicator to display this I get a "x2^0" string attached to the end.
What is this and is there anyway of turning it off?
I am trying to give a display that replicated some old style hex mechanical switches, by selecting a fixed size font and limiting the display to only be big enough to display the five hex digits (minimum field length 5 with pad with zeros) I get almost what I want (the "X2^0" is hidden of right hand side)
However when I delete characters from the number (to say enter a new number) the "X2^0" part then shows. See attached jpg which shows the format string.
This is by no means a show stopper but just annoying, is there some where to turn this formatting string off?
Dave.
Attachments:
20 bit hex.JPG 52 KBIt is showing how many of those bits are for the decimal places. It is kind of important information.
But since you are dealing with an Unsigned Integer (20,20 means there is no fractional part), why not just use a U32. You can set the display of the indicator for that to be %05x to just display the lower 5 hex characters.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Cable accessory not supported fix
So I manage thousands and thousands of electronic devices for emergency services. We standardised apple products to make it easier. Then ios7 was released.
I had hundred of remote emergency crews unable to charge their phones. Or call in choppers or fire trucks. It was a disaster.
Luckily no one died and we had no major catastrophes while I was busy swapping. Out 70% of the apple products for gst' sand samsungs.
My question is this. Whenever I put a post up it gets removed.
I point out that, as a tech, I NEED to get their phones to work and charge. So I put in how to bypass the software block but all my posts get removed.
This seems to be a terrible move by apple. They didn't offer to replace the 2000 odd cables I would need and said I would simply need to replace them all with certified products....
But again when I mention anything about the problem on the forums as well the go to the point of blocking and deleting my posts!That should rest htc or samsung.
Anyhow the way I had to get power to crews was to courier them cables at at a cost of thousands of dollars
It was a nightmare. Luckily no major catastrophes happened otherwise it would have cost lives and we probably would have sued apple.
Now that most of our field phones are htc or samsung it's ok but it was a close call.
The ways I had to get around it were
A - tell them to force the phone to turn off and as the logo was spinning plug it in.
B - get them new cables
C - for those who know how to use computers, install the 3rd party software to make it work
But I should have had to do any of those things.
Apple plain ignored my requests for help and I went into the store with 40 odd cables and she made me feel like I was doing something 'illegal' by not having a certified cable. It was horrible then she told me I would have to buy literally thousands of cables to replace all the ones that were blocks. It was the turning point for me. I was made to feel like a criminal but I'm the one helping save lives and they keep blocking and deleting my posts for it!
Not a word from apple still on how they can help or any mods other than to delete these posts so I'll just keep asking for help I guess. I don't know how they can do this. -
Inspection task list usage is not picking automatically?
Hi all,
whenever I create inspection lot for source inspection (for PO) through Qi07, in the inspection lot, task usage assigned as a 6(goods issue), but i will assign 3 (universal) later on for the source inspection ( with respect to PO)in qa32 & later on i will proceed. But i want the system to assign the 3 (task list usage) automatically for all the inspection lots, how to enable the same?
regards,
SanjuHi
In the SPRO setting for inspection type, you can assign default usage. I am not having system access right now, so cant give you exact path. But approx. QCC0--insp lot creation-maintain insp type/default values for inspection type.
Try if this solves your issue. -
Impact of NOT having SSO Cluster
Hello Everyone,
I wanted to understand the below points about SSO Clustering.
* Impacts of NOT having SSO Cluster
* Benefits of having SSO Cluster
* Step by step guide available for SSO Clustering.
* Is there any pre-requisite or important deadlocks while performing SSO Clustering.
Thanks in advance for all your suggestions.
Thanks,
Prashant
Please mark this post accordingly if it answers your query or is helpful.* Impacts of NOT having SSO Clusterà -->SSO is the key service in order to run BizTalk environment. That is why it is recommended to have SSO as a cluster service in production environemt along with
your SQL instance as cluster. This is for high availability of the service.
Consider SSO is running only on one physical machine and if that goes off, your whole biztalk environment will stop working and it will be a downtime. That is why it is always recommended to have SSO as cluster.
* Benefits of having SSO Cluster--> same as above appoint.
* Step by step guide available for SSO Clustering.-->
https://msdn.microsoft.com/en-us/library/aa559783.aspx?f=255&MSPPError=-2147217396
* Is there any pre-requisite or important deadlocks while performing SSO Clustering.--> nope. It’s very straight forward , please follow the guide . any windows Admin person can perform the clustering of this service.
Make sure you keep the backup always at safe place.
Greetings,HTH
Naushad Alam
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or
Mark As Answer
alamnaushad.wordpress.com -
IHow to force display of trailing zeros for fixed point numbers?
I have an 8 bit unsigned fixed point number, with 7 integer bits and 1 fractional bit, so the desired delta is 0.5. I want it to always display the fractional bit, even when that bit is 0. In other words, as this number is incremented, I want to see:
0.0
0.5
1.0
1.5
etc.
But instead I'm seeing:
0
0.5
1
1.5
etc.
I set the display format to Floating point, with 1 digit of precision. The "Hide trailing zeros" checkbox is NOT checked. What am I doing wrong?
I realize I could convert to single precision for display purposes to make this happen, but I'd rather make this work with fixed point.
Thanks,
-RonI just rustled up a VI with what I understand your input to be - unsigned 7 bit mantissa and 1 bit exponent input, and have it displaying 2 decimal places.... Is this what you're after or did I miss it?
- Cheers, Ed
Attachments:
zeros.vi 7 KB -
Does any one know how to attach a document from your mail, while you are already in your e-mail, meaning not having to look for your file first and then open the e-mail.
Luis
Good question - and one that a lot of (business) people would like solved!
Your question prompted me to do some research, and I found this workaround posted by Scott Grossberg:
His solution actually addresses a second problem too - how to attach a document when replying to an email message. In your case you may not need to consider the "reply" aspect - but if not right now, it'll come in useful someday!
I've pasted it verbatim - if it works for you (it does for me) then all credit goes to Scott for solving the problem. There's just one thing I'd add to his solution: you will probably want to rename the message, as by default Goodreader gives it the Subject line: Mail with GoodReader attachments.
THE GOODREADER OPTION
1. CREATE the document you want to send.
2. SAVE it to GoodReader (this will require you to buy and install the app).
3. Go to your email and OPEN the email thread to which you want to Reply and attach your file.
4. COMPOSE your Reply.
5. DOUBLE TAP the message.
6. TAP SELECT ALL. This will copy the entire email thread.
7. OPEN GOODREADER on the iPad and go to the file you want to send as part of your Reply.
8. At the bottom of the GoodReader screen you will see an EXPORT icon (it looks like a rectangle with an arrow pointing to the right).
9. TAP the Export button.
10. TAP EMAIL FILE. Depending on your needs, tap either SEND FILE “AS IS” or “FLATTEN ANNOTATIONS.” This will open a compose message screen with the chosen document already attached.
11. TAP in the body of the email screen. TAP PASTE. This will place your composed Reply and the prior email thread into the message.
12. ENTER the Recipients’ names in the TO: field of your message.
13. SEND your email Reply.
The modified version (= when composing a new message rather than a reply):
1 Make sure that the doc you want to attach is saved in GoodReader
2 In the message you are composing, double tap, select all, and then copy.
3 Open GoodReader and select the file you want to attach
4 Select the export button at the bottom of screen
5 Select e-mail file
6 Position cursor in body of the email message, tap and paste. You may want to delete the "sent from GoodReader" text that precedes the attachment.
7 Rename your message (as by default it will be Mail with GoodReader attachments)
8 Add the recipient's address in the To field.
Hope this helps! All thanks to Scott for this workaround.
Maybe you are looking for
-
Use of multiple ipods on one computer and library
Is it possible to sync two Ipods on the same computer with the same or different Itunes libraries? If so, please refer me to the proper help info.
-
Can not change my apple id ;
I tried several time to change apple id. I dont want to use a email from internet provider. I tried many time but the system do not accept toSave my modifications. When I clock on the save change nothing happen. I tried from safari using various m
-
Itunes opens with library and purchased music missing
About every two weeks to a month I open itunes and it says it is copying library. It says the library is corrupt and itunes opens completely empty. No record of any songs play list or purchase history. I have about 11 files in my itunes folder marked
-
I have searched this forum and others looking for help. Got close but not there yet! My 30GB will no longer play video on the TV. TV shows, movies, podcasts all play on the Ipod, but no longer on the TV. In the past I successfully used a camcorder co
-
Hi all is it possible for pickup emty file , if it ok where is it configuration in file adapter?