Precision loss - conversions between exact values and floating point values
Hi!
I read this in your SQL Reference manual, but I don't quite get it.
Conversions between exact numeric values (TT_TINYINT, TT_SMALLINT, TT_INTEGER, TT_BIGINT, NUMBER) and floating-point values (BINARY_FLOAT, BINARY_DOUBLE) can be inexact because the exact numeric values use decimal precision whereas the floating-point numbers use binary precision.
Could you please give two examples: one where a TT_TINYINT is converted to a BINARY_DOUBLE and one when a TT_BIGINT is converted into a DOUBLE, both cases give examples on lost precision? This would be very helpful.
Thanks!
Sune
chokpa wrote:
Public Example (float... values){}
new Example (1, 1e2, 3.0, 4.754);It accepts it if I just use 1,2,3,4 as the values being passed in, but doesn't like it if I use actual float values.Those are double literals, try
new Example (1f, 1e2f, 3.0f, 4.754f);
Similar Messages
-
Passing floating point values, but being recognised as doubles and int's?
Hi,
I was wondering how to differentiate between floating point values and ints etc
I am passing values into a public class with the parameters (float... values)
Public Example (float... values){}new Example (1, 1e2, 3.0, 4.754);
It accepts it if I just use 1,2,3,4 as the values being passed in, but doesn't like it if I use actual float values.
How come?
Cheerschokpa wrote:
Public Example (float... values){}
new Example (1, 1e2, 3.0, 4.754);It accepts it if I just use 1,2,3,4 as the values being passed in, but doesn't like it if I use actual float values.Those are double literals, try
new Example (1f, 1e2f, 3.0f, 4.754f); -
Difference between parent currency and parent in value dimension
Hi
Dear friends please tell me about following:
1.Difference between <Parent Currency> and <Parent> in value dimension and its significance.
2.Difference between <Parent Currency Adjs.> and <Parent Adjs.> in value dimension and its significance.
Thanks
Mayank
Edited by: mayanka bhusan on Jun 17, 2010 10:08 PMWhen you have an entity which contributes to two or more parent entities, you can specify if an adjustment applies and contributes to all parent entities or the selected entity.
1. Create the adjustment to <Parent Curr Adjs> and the adjustment value contributes to all parents.
2. Create the adjustment to [Parent Adjs] and you can select which parent entity you want the adjustment value to contribute to.
<Parent Currency> is where the translation happens.
<Parent Curr Total> is the total of the translated value plus any adjustments applying to all parents -i.e. <Parent Curr Adjs>
[Parent] simply carries the <Parent Curr Total> numbers to the next level of the value hierarchy
[Parent Total] is the total of the previous level plus any adjustments applying to the specified parent -i.e. [Parent Adjs] -
Pack and Floating Point Data Type in ABAP
Dear All,
I am new to ABAP. Started with data types. Came across pack and floating point.
Please let me know what PACK and Floating Point stands for with few examples and the main difference between them.
Regards
Arun VHi,
You'd better ask this question in ABAP forum http://forums.sdn.sap.com/forum.jspa?forumID=50 .
Best Regards,
Ada -
[Solved] Bash and Floating point arithmetic
I didn't realize how troublesome floating point numbers can be until now.
What I want to do should be simple I dare say:
properRounding( ( currentTime - downloadTime ) / ( dueTime - downloadTime ) * 100 )
however best I've been able to achieve so far is this:
echo "($currentTime-$downloadTime)/($dueTime-$downloadTime)*100" | bc -l
Which prints the correct floating point value.
I've tried to put the result in a variable, but I must be doing it wrong as I get the most peculiar error. I can live without it, but it would make life easier.
As for the rounding, that is a must. I've read that if you remove the -l param from bc, then it will round, but in my case something goes wrong as I just get the value 0 in return and besides, concluded after a simple test, bc always rounds down as in integer division, which I can not use.
So of course I'll continue reading and hopefully someday arrive at a solution, but I would very much appreciate if someone could lend me a hand.
This after all is not just a learning experience, I'm trying to create something useful.
Best regards.
edit:
nb:
all variables are integers.
Last edited by zacariaz (2012-09-09 14:50:18)Just for the fun of it, here's my progress thus far... Well, there really isn't much more to do. The rest is a conky thing.
#!/bin/bash
# Variables from unitinfo.txt - date as unix timestamps.
dueTime="$(date +%s -d "$(grep 'Due time: ' ~/unitinfo.txt | cut -c11-)")"
if [ "$1" = "end" ]
then echo $dueTime
fi
downloadTime="$(date +%s -d "$(grep 'Download time: ' ~/unitinfo.txt | cut -c16-)")"
if [ "$1" = "start" ]
then echo $downloadTime
fi
progress="$(grep 'Progress: ' ~/unitinfo.txt | cut -c11-12 | sed 's/ *$//')"
if [ "$1" = "prog1" ]
then echo $progress
fi
# The rest
#progress valued 0-1 for use with conky proress bars
progress2=$( echo 2k $progress 100 / f | dc )
if [ "$1" = "prog2" ]
then echo $progress2
fi
# Current time - unix timestamp.
currentTime="$(date +%s)"
# Remaining time - unix timestamp
remainingTime=$(( dueTime-$currentTime ))
if [ "$1" = "remain" ]
then echo $remainingTime
fi
# Elapsed time - unix timestamp
elapsedTime=$(( currentTime-downloadTime ))
if [ "$1" = "elap1" ]
then echo $elapsedTime
fi
# Total amount of time available - unix timestamp
totalTime=$(( dueTime-downloadTime ))
if [ "$1" = "total" ]
then echo $totalTime
fi
# How much time has elapsed in percent
progress3="$(echo 3k $elapsedTime $totalTime / 100 \* 0k 0.5 + 1 / f | dc)"
if [ "$1" = "elap2" ]
then echo $progress3
fi
# Like the above bur 0-1
progress4=$( echo 2k $progress3 100 / f | dc )
if [ "$1" = "elap3" ]
then echo $progress4
fi
# In percent, expected completion vs $dueTime - less than 100 is better.
expectedCompletion="$( echo 3k $elapsedTime 10000 \* $progress / $totalTime / 0k 0.5 + 1 / f | dc )"
if [ "$1" = "exp1" ]
then echo $expectedCompletion
fi
# Same as above, but unix timestamp
expectedCompletion2=$(( downloadTime+(expectedCompletion*totalTime/100) ))
if [ "$1" = "exp2" ]
then echo $expectedCompletion2
fi
#efficiency
if [ "$1" = "ef1" ]; then
if [ $progress -lt $progress3 ]
then echo "you're behind schedule."
elif [ $progress -eq $progress3 ]
then echo "You're right on schedule."
else
echo "You're ahead of schedule."
fi
fi
if [ "$1" = "ef2" ]; then
if [ $expectedCompletion -gt 100 ]
then echo "You're not going to make it!"
else
echo "You're going to make it!"
fi
fi -
MIDP and floating-point numbers
Hiya,
I need to use floating numbers in a few occasions in a MIDP app that I'm programming at the moment. Whenever I do so though I get a nervous-breaking error at the pre-verification stage of the build. I am working with Wireless Toolkit 2.0 and the rror I get is:
Building "MyMIDlet"
Error preverifying class <ClassName>
ERROR: floating-point constants should not appear
com.sun.kvem.ktools.ExecutionException: Preverifier returned 1
Build failedI get this error whenever I use a floating-point varible or even whenever I compare something to a floating-point value.
It's got me really puzzled and I can't think of any way around the problem. Any help would be very much appreciated...
Thanks!also WTK 2.1 (and CLDC 1.1I think ) does support FP. You think right, CLDC 1.1, that's when they added the floats (in theory a device could be MIDP 1.0 on top of CLDC 1.1, and it would also have floats). There's only one CLDC 1.1 device I've heard of: Nokia 6320.
shmoove -
Hi all,
I have a field <field> of type FLTP and length 16. This field has a value 4.650000000000000E+01. I want to print this value as 46.5. How can I do this.
Waiting for replies. ThanksI have the same problem like you, but cannot solve it with these answers in this thread here.
My <fs> is assigned to a field of a table (dynamicly and direktly). To copy the value in <fs> to an P-Variable, it doesn't helped me...
See my code:
DATA:
grfk_ok_code TYPE sy-ucomm,
grfk_values TYPE TABLE OF GPRVAL WITH HEADER LINE,
wa_ztab TYPE zqm_chq,
l_index TYPE n,
l_field TYPE string,
l_fs2p TYPE p DECIMALS 3
FIELD-SYMBOLS: <fs_field> TYPE ANY.
LOOP AT ztab INTO wa_ztab.
UNASSIGN <fs_field>.
l_index = sy-tabix.
CONCATENATE 'grfk_values-val' l_index INTO l_field.
ASSIGN (l_field) TO <fs_field>.
IF sy-subrc <> 0.
RETURN.
ENDIF.
<fs_field> = wa_ztab-cf_dlp.
l_fs2p = <fs_field>.
<fs_field> = l_fs2p.
ENDLOOP.
And I cannot use the floating point values in the grfk_value table...
Regards,
Steffen -
Right justification of floating point values
Hi all
i need to convert a incoming floating point value into (8.2) format i.e. (33678.9956 into 33678.99) i.e. spaces should be padded before if number of digits before decimal is less than 8 and i need to right justify all the incoming values..
pls help me in doing that through graphical mapping.Hi Barry,
sorry, the format given in the previous post is incorrect...
the required format is just opposite to that..i.e. all DOTS in the same column.
hope my requirement is clear..
Regards,
Manohar -
Easiest way to split a floating point value
Hello, I am trying to split a floating-point value (double) into its fractional and integer parts? I have been trying to find some sort of method in BigDecimal or Double that would do it but so far I haven't come up with anything. I know it could be done by searching through it as a String but that sounds like a very inefficent way to do it. I would appreciate any help you could give. Thanks
float f;
int i = (int) f;
float frac = f-i; -
what is difference between distribution list and share point group? Can we add distribution list into person and group column of share point list?
there is a workaround you can try, create audience and add DL to them and deal with the audience or convert DL to groups
https://social.technet.microsoft.com/Forums/en-US/02f0d773-8188-4d94-a448-0c04d838b0cf/distribution-lists-in-sharepoint?forum=sharepointgenerallegacy
Kind Regards,
John Naguib
Technical Consultant/Architect
MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation
Please remember to mark your question as answered if this solves your problem -
How to retrieve the procedure value and pass the value to a form field
How to retrieve the procedure value and pass the value to a form field?
Set property for the field and the value is the actual procedure/function.
Cheers -
Relation between Sales org and Shipping Point
Hai all,
Can any one tell me wt is the relation between Sales Org and Shipping point?
Ravi
< PLEASE DONT USE SMS LANGUAGE AND PLEASE SEARCH THE FORUMS. >Hi Ravi,
There is no direct relation.
Sales organisation in broader level, it is responsible for selling a product in a company.
It is liable to the customer interms of service of the product or service and confirmation of the sale order, delivery and invoicing.
Shipping Point is a logical point from where the shipment / dispatch begins.
Both Sales organisation & Shipping point wil be linked to plant (one or more).
In case of sale order, sales org will decide the delivering plant.
Shipping point will be picked based on delivery plant, sh.conditions (cmr) & loading grp (mmr).
hope this is clear to you now! -
Hi all;
Please help.
I am getting floating point values in my source IDoc like 1.234- but while inserting into the ODS system i need the negative sign before 1.234.
How to achive this out.
NalinHi
You can achive this by using graphical mapping UUser defined function.
Mapping source fieldremove context UDF --- target field
UDF
for(int i=0;i<Float.length;i++)
if(Float<i>.endsWith("-"))
result.addValue("-"+Float<i>.substring(0,Float<i>.length()-1));
else
result.addValue(Float<i>);
Mudit
Award points if it helps -
Display Report Level Filter value and Input Controls Value
Hi,
Please let me know how to display Report Level Filter value and Input COntrol values in the report.
I have 2 tabs in the WebI Report. The first tab has the summary details about the other tabs like reprot desc, prompt values, reprot filter values,etc.
In the 2nd tab I have the actual report which has input controls defined, prompt values and global level report filters.
Can anyone please tell me how to display the Report level filter values and the Input Control values in the first tab report.
For ex: Tab 2 has a Report level filter: Region = NA
I need to display in Tab 1 in as Region: NA
I used the function ReportFilterSummary but that is giving me other details, I want only the object name and the value.
Also how to dispaly the Input Control values in the tab 1.
Please let me know if you have any suggestions for this issue.
Thanksdid you try
=ReportFilter([Year])
if you are making report filter over the year, it will return the value of the filter
by the way, the filter should be applied over all the report not to a specific block to be able to get the correct value
the Input control also considered as report filter, only if you're applying them on the level of the report, if you applying an input contron over a specific block or chart, you will not get the values for ReportFilter
good luck -
How to get po delivered value and po invoived value?
HI experts,
i need to create bex query with PO total value, PO NET VALUE Item wise, po delivered value,
po still remaining value and po invoiced value.
AFter extensive search i got 0net_po_val for PO net value item wise.
Remaining 4. Fields am unable to search in bw targets. So how to proceed?? Any inputs?
Thanx in advance.
br,
Ravi kiranHi Ravi,
Please find the logic for the same:
PO Delivered Value
EKBE (BEWTP = E and SHKZG) SHKZG = S is positive and
SHKZG = H is negative.
PO Still Remaining Value
PO Value- PO Delivered Value
PO Invoiced Value
EKBE(BEWTP = Q and SHKZG) SHKZG = S is positive and
SHKZG = H is negative.
Maybe you are looking for
-
HP-8600 plus Firmware Downgrade
I just got an 8600 aka CM750A that is rejecting the ink cartridges I bought after the install cartridges got used up. It tells me to get the OEM ones over and over but I got a whole case of these LMI ones, which were much cheaper than OEM. Looks like
-
Hello, In CVI2013 there was a bug (bug id 433769) when changing the uir file: the change did not show up, one needed to rebuild the project, this seems to have been fixed, but now there is something else... I have a project with several source files
-
The App store has stopped working after a clean install of OS X Snow Leopard. The get/install buttons go grey after I've clicked on them then nothing.... It doesn't hang, all the navigation buttons work fine, and I can log into iTunes fine. Just can'
-
Hi All We are using WCS v5.0.56.0, a 4400 series WLC for Guest access, plus a mixture of 2100 series and 4400 series WLC's in our WIFI environment. The WLC's are running v5.2.193.0 I am running a unique client report in WCS filtering by our Guest SS
-
I cant open iCloud Drive in the Browser.
My problem is, that I can't open iCloud Drive in the Browser. If I klick on the icon there is only this message (german) On the other hand I can open every file in the finder or with the programmes like pages on the Mac and iPhone. Does someone knows